summaryrefslogtreecommitdiff
path: root/libc/sysdeps
AgeCommit message (Collapse)Author
2019-10-15Fix value for O_mask_was_saved based on gdb observationmirabilos
(gdb) print offsetof(struct __jmp_buf_tag, __mask_was_saved) $12 = (int *) 0x1f0 using https://stackoverflow.com/a/39663128/2171120
2019-10-15sparc64: Make structure match kernel uapimirabilos
Update from linux/arch/sparc/include/uapi/asm/uctx.h
2019-10-15sparc64: Use the jmpbuf-offsets.h header instead of duplicating itmirabilos
2019-10-10aarch64: sync with glibc code to see any differences in a better wayWaldemar Brodkorb
2019-10-05or1k: Fix compiling with PIC and latest binutils use PLT for __syscall_errorStafford Horne
This symbol was causing a build failure with the new toolchain. It looks like it has always been wrong. The main issue was checking for PIC rather than __PIC__. Remove all PSEUDO_* macros and ther SYSCALL_ERROR_NAME macro as they are not needed by uclibc-ng, they are used in glibc for building up syscalls there, but not here. Fixes error: /opt/shorne/software/or1k-linux/bin/../lib/gcc/or1k-linux/9.0.1/../../../../or1k-linux/bin/ld: libc/libc_so.a(or1k_clone.os): pc-relative relocation against dynamic symbol __syscall_error /opt/shorne/software/or1k-linux/bin/../lib/gcc/or1k-linux/9.0.1/../../../../or1k-linux/bin/ld: final link failed: bad value Signed-off-by: Stafford Horne <shorne@gmail.com>
2019-09-30PowerPC: Fix termios definitionsAdhemerval Zanella
This patch fixes the incorrect guard by __USE_MISC of struct winsize and struct termio in powerpc termios header. Current states leads to build failures if the program defines _XOPEN_SOURCE, but not _DEFAULT_SOURCE or either _BSD_SOURCE or _SVID_SOURCE. Without any definition, __USE_MISC will not be defined and neither the struct definitions. This patch copies the default Linux ioctl-types.h by adjusting only the character control field (c_cc) size in struct termio. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [Vadim: adopted for uclibc ]
2019-07-05riscv: clear a3/a4 in crt1Christoph Hellwig
We don't support shared libraries and thus _init/_fini. But loading nommu binaries blows they aren't cleared, so do that. Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-07-05riscv: add the MAP_UNINITIALIZED definitionChristoph Hellwig
This avoids a nommu build failure. Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-05-27sparc: remove asm constraintRomain Naour
uClibc-ng don't build with gcc 9.1 [1] due to a new check that "catch illegal asm constraint usage" [2]. gcc 9.1 print this error: "invalid hard register usage between earlyclobber operand and input operand" The asm constraint is present in uClibc since it support sparc (back in 2002)[3]. Note: There is no such constraint is Glibc counterpart code [4]. [1] https://gitlab.com/kubu93/toolchains-builder/-/jobs/205435757 [2] https://github.com/gcc-mirror/gcc/commit/b782636f28f5c378897c238081d28d7a4a6ca578 [3] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=3b6d086531102b6d09ce852feb1e370d5dca3ce9 [4] +https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/sysdep.h;h=981b2a26b7a91093f821c97876 +e55bc4be2d9f8a;hb=HEAD
2019-05-13preadv/pwritev: fix offset argument typeMax Filippov
preadv/pwritev don't provide separate version for 64-bit wide off_t, and default to 32-bit wide off_t, which results in a mismatch between declaration and definition for user programs built with -D_FILE_OFFSET_BITS=64. Make offset argument of both functions __off64_t. This fixes test misc/tst-preadvwritev on xtensa. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-12-14xtensa: add custom bits/poll.hMax Filippov
Definitions of POLLWRNORM, POLLWRBAND and POLLREMOVE in xtensa linux kernel are non-standard. Provide bits/poll.h with correct values for these constants. This fixes the following strace build errors: In file included from xlat/pollflags.h:4:0, from poll.c:34: ./static_assert.h:40:24: error: static assertion failed: "POLLWRBAND != 0x0100" # define static_assert _Static_assert ^ xlat/pollflags.h:75:1: note: in expansion of macro ‘static_assert’ static_assert((POLLWRBAND) == (0x0100), "POLLWRBAND != 0x0100"); ^~~~~~~~~~~~~ ./static_assert.h:40:24: error: static assertion failed: "POLLREMOVE != 0x0800" # define static_assert _Static_assert ^ xlat/pollflags.h:117:1: note: in expansion of macro ‘static_assert’ static_assert((POLLREMOVE) == (0x0800), "POLLREMOVE != 0x0800"); ^~~~~~~~~~~~~ Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2018-12-14several patches for uclibc nghan_mao@c-sky.com
I've got several patches to fix ltp/openmp/uclibc-ng-test testcase fail on c-sky. - fix a ltp testcase. - fix the problem that pthread creat will fail when libomp is linked before libc, the variable pagesize is not init. - fix tst-cancel4 and tst-cancel16. tst-cancelx4 and tst-cancelx16 still fail with this patch applied, cleanup handler is not called for open/creat/fcntl, seems some thing wrong with unwind, I haven't check the rootcause yet.
2018-11-27statfs.h: sync generic header with glibcWaldemar Brodkorb
Fix issues with aarch64 and df with mismatching header between kernel and libc.
2018-11-23Defined INLINE_SYSCALL_NOERR_NCS in mips/bits/syscalls.hVolodymyr Boyko
On Linux/MIPS (O32 ABI) for system call we have two result registers - v0 and a3. v0 contains actual syscall result on success or error number on fail, a3 set to 0/1 for indicating syscall success/fail. (if a3 == 1, v0 contains errno). Now as we can see from definition of handle_sys (arch/mips/kernel/scall32-o32.S), handler treats returned by syscall function (let's call "original") values in range [-EMAXERRNO; 0[ as -errno, a3 is set to 1 and final returned (to userspace) value is (-original). INLINE_SYSCALL_NOERR_NCS defined in mips/bits/syscalls.h will handle this behaviour. Signed-off-by: Volodymyr Boyko <boyko.cxx@gmail.com>
2018-11-01Add support for Thumb-only processors.Christophe Lyon
* ldso/ldso/arm/aeabi_read_tp.S: Add Thumb version. * ldso/ldso/arm/dl-startup.h: Do not force ARM encoding, adjust for Thumb. * ldso/ldso/arm/resolve.S: Force Thumb encoding on Thumb-only processors. * libc/sysdeps/linux/arm/crt1.S: Do not force ARM encoding, adjust for Thumb. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-11-01time.h: Add CLOCK_TAIPetr Vorel
Added in kernel in kernel 3.10 in 1ff3c9677bff ("timekeeping: Add CLOCK_TAI clockid") NOTE: CLOCK_SGI_CYCLE was not added, as it has been lately removed. Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2018-10-20do not expose recvmmsg/sendmmsg for unsupported kernelsWaldemar Brodkorb
2018-09-21bugfix renameat2 wrong implement.Guo Ren
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-08-16sched_setaffinity: use the same style with glibc'sGuo Ren
Call getpid() in INTERNAL_SYSCALL will break the argument regs, because gcc couldn't save destoryed regs for system call asm. Ref to glibc, we could just remove all the check code. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-08-10arm/clone.S: Fix threading supportChristophe Lyon
Change clone.S so that in FDPIC case we take into account the fact that we are given a function descriptor. * libc/sysdeps/linux/arm/clone.S (__clone): Support __FDPIC__. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10Add runtime support needed for C++ exceptionsChristophe Lyon
Implements __gnu_Unwind_Find_got(), which is called from libgcc while unwinding. * libc/sysdeps/linux/arm/Makefile.arch (CSRC): Add find._got.c. * libc/sysdeps/linux/arm/find_got.c: New file. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10Add application startup code for FDPICChristophe Lyon
* libc/sysdeps/linux/arm/crt1.S: Define _start for __FDPIC__. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-08-10rtld: Add FDPIC code for armChristophe Lyon
Add FDPIC dynamic relocations support, similar to what other FDPIC targets do. Lazy binding is implemented in a folllow-up patch. Disable the SEND* macros because they involve relocations to access constant strings that are unsupported by the existing arm version. Define DL_START, START, ARCH_NEEDS_BOOTSTRAP_RELOCS, DL_CHECK_LIB_TYPE similarly to what other FDPIC targets do. Define raise() because _dl_find_hash references __aeabi_uidivmod, which uses __aeabi_idiv0 which in turn references raise. * include/elf.h (R_ARM_FUNCDESC): Define. (R_ARM_FUNCDESC_VALUE): Define. * ldso/include/dl-string.h (SEND_STDERR, SEND_ADDRESS_STDERR) (SEND_NUMBER_STDERR): Define empty for __FDPIC__. * ldso/ldso/arm/dl-inlines.h: New file. * ldso/ldso/arm/dl-startup.h (PERFORM_BOOTSTRAP_RELOC): Fix type of load_addr. Fix handling of R_ARM_RELATIVE, add support for R_ARM_FUNCDESC_VALUE. (DL_START, START): Define for __FDPIC__. (raise): Define. * ldso/ldso/arm/dl-sysdep.h (ARCH_NEEDS_BOOTSTRAP_RELOCS): Define. (DL_CHECK_LIB_TYPE): Define. (elf_machine_type_class): Take into account FDPIC related relocations. (elf_machine_load_address): Support __FDPIC__. (elf_machine_relative): Likewise. * ldso/ldso/arm/elfinterp.c (_dl_linux_resolver): Dummy support for __FDPIC__, implemented in a later patch. (_dl_do_reloc): Fix reloc_adr computation for __FDPIC__, fix handling of local symbols. Fix handling of R_ARM_RELATIVE, add support for R_ARM_FUNCDESC_VALUE, R_ARM_FUNCDESC. * ldso/ldso/arm/resolve.S: Make _dl_linux_resolve hidden. * ldso/ldso/fdpic/dl-inlines.h (htab_delete): Declare. * libc/sysdeps/linux/arm/bits/elf-fdpic.h: New file, similar to bfin's. * libc/sysdeps/linux/arm/crtreloc.c: Likewise. * libc/sysdeps/linux/arm/find_exidx.c (__dl_addr_in_loadaddr) Define. (find_exidx_callback): Support __FDPIC__. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2018-06-10risc-v: initial 64 bit port, static only (no TLS/NPTL)Waldemar Brodkorb
Only a simple hello world is tested in qemu system emulation.
2018-04-17common/sendfile.c: bugfix can't support offset is NULLGuo Ren
In ltp testcase sendfile08.c, it use offset=NULL to test the api. PATCH V2: fixup the stupid missing check in the end. Sorry for lose test. See "man sendfile" and it really support offset is NULL. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-04-17Revert "common/sendfile.c: bugfix can't support offset is NULL"Waldemar Brodkorb
This reverts commit b00fd230ed0b49b9f23d829ad5d09859f34bb754.
2018-04-13lseek.c: bugfix ltp lseek01.cGuo Ren
Ref the implement from the glibc and high=0 seems so bad. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-04-13common/sendfile.c: bugfix can't support offset is NULLGuo Ren
In ltp testcase sendfile08.c, it use offset=NULL to test the api. See "man sendfile" and it really support offset is NULL. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-04-13or1k: add F_{DUPFD_CLOEXEC, SETPIPE_SZ, GETPIPE_SZ}Thomas Petazzoni
Those definitions exist on all other architectures, but were not present in or1k specific headers when or1k support was merged. On the kernel side, their support is completely architecture independent, so we just need those definitions to make those fcntl() calls available on or1k. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-04-02use __NR_newfstatat only for modern Linux architecturesWaldemar Brodkorb
Otherwise it breaks mips64 n64. Should be used for aarch64/tilegx only.
2018-03-22hppa: fix runtime issuesWaldemar Brodkorb
Sync clone()/vfork() with GNU C Library. Allow CFI and fix strsignal() / tcsetattr().
2018-03-15csky: support bsd-setjmp and bsd-_setjmp.Guo Ren
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-03-12tile: add basic support for tilegxWaldemar Brodkorb
This adds basic support for tile architecture. Only static binaries, no ld.so or threading support. Tested with qemu-tilegx only.
2018-03-09sparc32: Add nop before __startcontext to stop unwindingWaldemar Brodkorb
From glibc commit 9aa5c222b9e0409143410a02b6364a3b25dbf028 [BZ #22919]
2018-02-26stat.h: fix issue with aarch64Waldemar Brodkorb
2018-02-17bits/socket.h: add missing definesWaldemar Brodkorb
Newer iproute2 package make use of some of defines. Sync missing defines with GNU C library.
2018-02-12uClibc-ng does not implement name_to_handle_atAlexey Neyman
... so don't declare it. Otherwise, eudev finds it declared and tries to link with it - and fails. Signed-off-by: Alexey Neyman <stilor@att.net>
2018-02-04mman: disable memfd_create declarationWaldemar Brodkorb
2018-02-03csky: bugfix ltp open12 failed.Guo Ren
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2018-02-03bits/mman.h: consolidate header fileWaldemar Brodkorb
Sync with GNU C library and consolidate duplicate non architecture specific defines. MAP_UNINITIALIZED is only defined to 0x4000000 and used by the Linux kernel when CONFIG_MMAP_ALLOW_UNINITIALIZED is enabled. CONFIG_MMAP_ALLOW_UNINITIALIZED is only available for nommu. See Documentation/nommu-mmap.txt.
2018-01-31aarch64/sys/ucontext.h: include bits/sigcontext.hBernd Kuhls
Fixes a buildroot build error with ffmpeg In file included from /home/bernd/buildroot/output/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/signal.h:329:0, from fftools/ffmpeg.h:26, from fftools/ffmpeg_opt.c:23: /home/bernd/buildroot/output/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/sys/ucontext.h:52:16: error: field 'uc_mcontext' has incomplete type mcontext_t uc_mcontext; ^~~~~~~~~~~ using this defconfig: BR2_aarch64=y BR2_PACKAGE_FFMPEG=y sys/ucontext.h for other archs already include bits/sigcontext.h, on aarch64 this is needed as well. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
2018-01-21simplify and fix getcwdWaldemar Brodkorb
The fallback code is not used as all supported kernels have the syscall. Check if a absolute path is returned from syscall.
2018-01-15rt: cleanup and allow to build for linuxthreadsWaldemar Brodkorb
It seems there is no real dependency to NPTL for these clock_* functions when UCLIBC_ADVANCED_REALTIME is enabled. No regressions found. Reported-by: Baruch Siach <baruch@tkos.co.il>
2018-01-15nds32: Add syscall macros for 5 and 6 parametersStafford Horne
This is to fix an error after switching to use generic syscalls. libc/sysdeps/linux/common/syscall.c: In function 'syscall': libc/sysdeps/linux/common/syscall.c:27:2: warning: implicit declaration of function 'internal_syscall_ncs6' [-Wimplicit-function-declaration] return INLINE_SYSCALL_NCS(sysnum, 6, arg1, arg2, arg3, arg4, arg5, arg6); ^ Defining these functions as described by Vincent Ren-Wei Chen <vincentc@andestech.com> Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-01-15nds32: Use new common syscall() implementationStafford Horne
Traditionally nds32 has had a generic syscall implementation supporting varargs. During an audit it was found that this implementation seems to duplicate the new common implementation and is no longer needed. Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-01-15or1k: Use new common syscall() implementationStafford Horne
Now that the common syscall implementation supports vararg calling conventions we can safely use it on OpenRISC. This saves a bit of code in the openrisc implementation. Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-01-15syscall: Make common implementation match unistd.hStafford Horne
The definition of syscall() in unistd.h is with varargs. Traditionally the common implementation in uclibc has been with regular arguments. This patch updates that by using varargs. This has caused issues on architectures like or1k which have different calling conventions for varargs and regular arg parameters. The implementation here is based on an implementation from Joel Stanley <joel@jms.id.au>. There is a difference that I do not initialize the stack args with 0 as they are immediately overwritten by va_args. Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-01-08csky: bugfix libc sync_file_range.c for csky.Guo Ren
Use __NR_sync_file_range2 for csky sync_file_range function. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-12-31m68k: add NPTL/TLS supportWaldemar Brodkorb
Port over NPTL/TLS support from GNU C Library. In the first step only the slower syscall is used for TLS access. The uClibc-ng testsuite shows 79 errors, so their is room for bugfixes and improvements.
2017-12-28csky: add Copyright.Guo Ren
Signed-off-by: Guo Ren <ren_guo@c-sky.com>