summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/i386
AgeCommit message (Collapse)Author
8 daysx86: Fix __libc_sigaction implementation.Dmitry Chestnykh
For x86 we have to copy only mask, handler and flags. We haven't set SA_RESTORER bit in sa_flags anyway. This patch fixes multiple test failures on x86. Also we have to build uClibc with FP for x86 because without FP NPTL and libgcc code cannot properly unwind the stack during asynchronous cancellation of system calls. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-03-03x86: enable time64Waldemar Brodkorb
2023-07-14[PATCH] libc/sysdeps/linux/common/bits/wchar.h: resync with glibc, fix build ↵Waldemar Brodkorb
issue with gcc 12 The current definition of __WCHAR_MIN and __WCHAR_MAX are only correct when wchar_t is an int. This is not the case on ARM/AArch64 where wchar_t is an unsigned int, or some other architectures where wchar_t is a long. The current incorrect definition causes a build issue for example when building mpd, which uses boost, with gcc 12.x: In file included from /home/thomas/buildroot/aarch64/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/boost/integer.hpp:20, from /home/thomas/buildroot/aarch64/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/boost/crc.hpp:42, from ../src/storage/StorageState.cxx:43: /home/thomas/buildroot/aarch64/host/aarch64-buildroot-linux-uclibc/sysroot/usr/include/boost/integer_traits.hpp:105:69: error: narrowing conversion of ‘-2147483648’ from ‘int’ to ‘wchar_t’ [-Wnarrowing] 105 | public detail::integer_traits_base<wchar_t, WCHAR_MIN, WCHAR_MAX> | ^ This issue was fixed in glibc in 2013, see bug report https://sourceware.org/bugzilla/show_bug.cgi?id=15036, and upstream commit https://sourceware.org/git/?p=glibc.git;a=commit;h=052aff95782fefe9c63566471063e8b20836bfb8. Since the i386-specific definition of __WCHAR_MIN and __WCHAR_MAX was also removed at the same time in glibc, we do the same as part of this commit. Reported-by: Clément Ramirez <clement.ramirez@bootlin.com> With-some-useful-help-from: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-07-26Added support for creation of Static Position-Independent Executables (PIE) ↵linted
on i386, x86_64, and arm. This patch adds the generation of rcrt1.o which is used by gcc when compiling with the --static-pie flag. rcrt1.o differs from crt1.o and Scrt1.o in that it the executable has a dynamic section but no relocations have been performed prior to _start being called. crt1.o assumes there to be no dynamic relocations, and Scrt1.o has all relocations performed prior to execution by lsdo. The new reloc_static_pie function handles parsing the dynamic section, and performing the relocations in a architecture agnostic method. It also sets _dl_load_base which is used when initalizing TLS to ensure loading from the proper location. This allows for easier porting of static-pie support to additional architectures as only modifications to crt1.S to find the load address are required. Signed-off-by: linted <linted@users.noreply.github.com>
2021-04-09open: Add support for O_TMPFILENicolas Cavallari
Since Linux 3.11, O_TMPFILE allows to create unnamed files that can be linked later on. It is internally defined as (O_TMPFILE | O_DIRECTORY) to make it fail on old kernels. Copying definitions from glibc for O_TMPFILE is not enough to support O_TMPFILE; The open() wrapper also need to pass the mode when the flag contains O_TMPFILE, otherwise, it will pass mode 000 which will succeed but yield unexpected results. openat() is curiously not affected since it passes the mode unconditionally.. Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
2021-02-19fcntl.h: Make F_DUPFD_CLOEXEC if _USE_XOPEN2K8Paul Cercueil
The F_DUPFD_CLOEXEC flag was added in POSIX 2008.09. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2020-07-02Rename __unused struct members to include a namespaceEd Wildgoose
Rename various spare fields in structs to include a namespace This should avoid accidental clashes with uses of the __unused symbol in upstream projects. eg currently it causes a compile error in dhcpcd 8.x due to their re-use of the __unused symbol as a macro This follows the style of glibc which does something equivalent
2020-02-03csky: add statx conditionalsWaldemar Brodkorb
Similar to glibc commit https://sourceware.org/git/?p=glibc.git;a=commit;h=6bbfc5c09fc5b5e3d4a0cddbbd4e2e457767dae7 we need to handle Linux kernel change, which removed stat64 family from default syscall set. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de>
2019-10-30Make __syscall_error return long, as expected by syscall() callersCarlos Santos
The return type of syscall() is long so __syscall_error, which is jumped to by syscall handlers to stash an error number into errno, must return long too otherwhise it returs 4294967295L instead of -1L. For example, syscall for x86_64 is defined in libc/sysdeps/linux/x86_64/syscall.S as syscall: movq %rdi, %rax /* Syscall number -> rax. */ movq %rsi, %rdi /* shift arg1 - arg5. */ movq %rdx, %rsi movq %rcx, %rdx movq %r8, %r10 movq %r9, %r8 movq 8(%rsp),%r9 /* arg6 is on the stack. */ syscall /* Do the system call. */ cmpq $-4095, %rax /* Check %rax for error. */ jae __syscall_error /* Branch forward if it failed. */ ret /* Return to caller. */ In libc/sysdeps/linux/x86_64/__syscall_error.c, __syscall_error is defined as int __syscall_error(void) attribute_hidden; int __syscall_error(void) { register int err_no __asm__ ("%rcx"); __asm__ ("mov %rax, %rcx\n\t" "neg %rcx"); __set_errno(err_no); return -1; } So __syscall_error returns -1 as a 32-bit int in a 64-bit register, %rax (0x00000000ffffffff, whose decimal value is decimal 4294967295) and a test like this always returns false: if (syscall(number, ...) == -1) foo(); Fix the error by making __syscall_error return a long, like syscall(). The problem can be circumvented by the caller by coercing the returned value to int before comparing it to -1: if ((int) syscall(number, ...) == -1) foo(); The same problem probably occurs on other 64-bit systems but so far only x86_64 was tested, so this change must be considered experimental. Signed-off-by: Carlos Santos <unixmania@gmail.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.
2017-07-28cleanup unused defines and includes from clone.SWaldemar Brodkorb
2017-06-08fcntl.h: fixup namespace for O_DIRECTORY/O_NOFOLLOW/O_CLOEXECWaldemar Brodkorb
Sync with GNU C library. Found while trying to compile linux-rdma to uClibc-ng. Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
2017-05-17x86: fix segfaults on SMP machineWaldemar Brodkorb
As reported by Bering-uClibc project uClibc-ng for x86 generates a segfault on SMP machines when trying to run ntpd. A small test case is here: https://gist.github.com/ddrown Use a similar nop instruction as for x86_64 in the code. Signed-off-by: KP.Kirchdoerfer <kapeka@bering-uclibc.de>
2017-02-01g/c __libc_errnomirabilos
Signed-off-by: mirabilos <m@mirbsd.org> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2017-01-29use safe, even if possibly a few cycles slower, six-argument syscall ↵mirabilos
implementation Signed-off-by: mirabilos <m@mirbsd.org> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2017-01-29extract six-argument syscalls from the restmirabilos
(still same implementation though) Signed-off-by: mirabilos <m@mirbsd.org> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2017-01-29remove dead codeWaldemar Brodkorb
Signed-off-by: mirabilos <m@mirbsd.org> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2017-01-28remove PID cachingWaldemar Brodkorb
Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e and remove the PID caching. These simplifies the architecture specific assembly code. The run of the test suite found no regressions, it even solves some of the test failures for x86/x86_64/sparc. Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com> Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com> Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
2016-11-27remove UCLIBC_HAS_LFSWaldemar Brodkorb
2016-09-26use a single libc and deduplicate threading codeWaldemar Brodkorb
Similar to musl libc a single libc has many benefits and solves some open issues with uClibc-ng. - no pthread_mutex_* weak symbols exported anymore - applications no longer failing to link when either -lrt or -lpthread are missing for dynamic and static linking mode - smaller C library - slightly better runtime performance
2016-08-27remove DOMULTI supportWaldemar Brodkorb
A single test with targeting ARM showed that this feature seems bit rotted. Remove DOMULTI and simplify Makefiles.
2016-07-31remove unused code, RTLD_PRIVATE_ERRNO is never definedWaldemar Brodkorb
2016-07-17cleanup CALL_MCOUNT / PROFWaldemar Brodkorb
As this is only implemented for a few architecture and not well tested, just remove it.
2016-07-17cleanup PTR_MANGLE/PTR_DEMANGLE supportWaldemar Brodkorb
As this is only implemented for a few architecture and not well tested, just remove it. Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
2016-01-10Add implementation for copysignl for i386Waldemar Brodkorb
Patch from OpenWrt. Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
2015-12-07add definitions for O_PATHWaldemar Brodkorb
Only alpha, hppa and sparc need non-default value.
2015-12-05remove __UCLIBC_ASM_GLOBAL_DIRECTIVE__Waldemar Brodkorb
.globl can be used for every architecture so remove the define. Sync with GNU C library.
2015-12-05remove __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__Waldemar Brodkorb
It's even no longer required for non-ported ppc64 architecture. Sync with GNU C library. This simplify the macros in include/libc-symbols.h.
2015-08-02fix inline asm changing the stack pointer leading to segfaults problemmirabilos
2014-08-25fcntl.h: Define F_SETPIPE_SZ and F_GETPIPE_SZKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-25mathinline.h: Use __extern_inlineBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20libc/sysdeps: commonize ret_ERRVALBaruch Siach
* Add a common ret_ERRVAL definition * Remove ret_ERRVAL from architectures using the common 'ret' * Add 'undef' to architectures that need a different return instruction * Add '#include <common/sysdep.h>' to cris and ia64 that were missing it Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-29i386/sysdep.h: Remove STABS_* macrosKhem Raj
uclibc is compiled with elf/dwarf and secondly HAVE_CPP_ASM_DEBUGINFO is not defined so we generate bogus .stab sections needlessly Some of post processing tools get confused when they see both dwarf and stab sections Signed-off-by: Khem Raj <raj.khem@gmail.com>
2013-04-01libc: rename TRUNCATE64_HAS_4_ARGS to SYSCALL_ALIGN_64BITMike Frysinger
The reason truncate64 takes 4 args on some arches is that their ABI requires 64bit values to be aligned on register pair boundaries. Since this alignment affects more than just truncate64, rename the define to properly document its purpose. This also allows us to expand it to the other impacted syscalls (which will be done in a follow up commit). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-02-11libc/{arm, i386}/Makefile.arch: Don't build 64-bit code if LFS is disabledMarkos Chandras
Fixes the following compilation error: _lfs_64.h: # error Do not include this header in files not built when LFS is disabled Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-10buildsys: use kbuild styleBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-10libc: add {get,set,swap,make}context user context manipulation functionsFlorian Fainelli
Add the obsolescent SUSv3 family of user context manipulating functions for arm, i386, mips, x86_64. Signed-off-by: Timon ter Braak <timonterbraak@gmail.com> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-18drop support for pre ISO-C compilersMike Frysinger
This drops __signed, __volatile, and __const. Only the latter was used in the code base, and for uClibc, not consistently. Much of the code used plain "const" which meant "__const" was useless. Really, the point of this is to stay in sync with what glibc did. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18Replace FSF snail mail address with URLsMike Frysinger
This matches a similar change made to glibc. No functional changes here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-10-02libc/sysdeps: add __kernel_long and __kernel_ulongChris Packham
Linux 3.4 added __kernel_long_t and __kernel_ulong_t and various exported header files were updated to use these new types. Add the definitions for __kernel_long_t and __kernel_ulong_t to the relevant kernel_types.h headers. This change was automated with the following scriptlet git grep --name-only 'typedef.*__kernel_old_dev_t' \ | xargs sed -i '/typedef.*__kernel_old_dev_t/ a\ typedef long\t\t__kernel_long_t;\ typedef unsigned long\t__kernel_ulong_t;' Whitespace in arm, avr32, hppa, sparc was then manually fixed up. Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> -- Here's a cleaned up patch which should get the whitespace right. I'm a bit iffy about the sparc changes they make sense to me but it's not a platform I have access to. I can break this up per arch or per maintainer if requested. libc/sysdeps/linux/alpha/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/arm/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/avr32/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/bfin/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/c6x/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/cris/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/e1/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/h8300/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/hppa/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/i386/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/ia64/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/m68k/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/microblaze/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/mips/bits/kernel_types.h | 4 ++++ libc/sysdeps/linux/nios2/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/powerpc/bits/kernel_types.h | 4 ++++ libc/sysdeps/linux/sh/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/sh64/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/sparc/bits/kernel_types.h | 4 ++++ libc/sysdeps/linux/v850/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/x86_64/bits/kernel_types.h | 2 ++ libc/sysdeps/linux/xtensa/bits/kernel_types.h | 2 ++ 22 files changed, 50 insertions(+) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-08-04i386/bits/syscalls.h: allow immediate values as 6th syscall argNatanael Copa
Allow use of immedate values as the 6th syscall argument. Otherwise we must store the arg on memory. This gives gcc more options to optimize better. This also works around an issue with posix_fallocate. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15vfork: make all archs consistentPeter S. Mazinger
__vfork is hidden. __GI_vfork is strong (not weak as it was). vfork is weak. e1 can use the generic version. Note: libc_hidden_def(x) has different meaning in .c and .S files. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15Reorder includes and include only what is necessaryPeter S. Mazinger
Use param.h instead of MIN. Use stddef.h instead of offsetof. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15*64.[cS]: use _lfs_64.h instead of features.h and remove LFS guardPeter S. Mazinger
_lfs_64.h makes the compile fail, if LFS is not enabled, no need for the guard. Reorganize to include only the minimal necessary headers. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15i386/posix_fadvise64: remove fallback code, uClibc does not do thatPeter S. Mazinger
Makefile.arch: include it only if ADVANCED_REALTIME is defined. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15remove libc_hidden_proto(ioperm) from all headers except armPeter S. Mazinger
While there, guard everywhere ioperm and iopl prototypes with __UCLIBC_LINUX_SPECIFIC__ Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15huge_vall.h: add for i386,ia64,m68k,sparcPeter S. Mazinger
relevant only for gcc < 3.3 or non-gcc compiler Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15cleanup bits/setjmp.h of stuff moved to jmpbuf-offsets.h and jmpbuf-unwind.hPeter S. Mazinger
Make sure we use the new jmpbuf-*.h headers While there, adapt the offset on microblaze and the _JMPBUF_UNWINDS macro on bfin, it seems, these were changed in the meantime. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15make use of jmpbuf-offsets.h and jmpbuf-unwind.hPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15jmpbuf-unwind.h: add NTPL related sectionPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>