summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/bits
AgeCommit message (Collapse)Author
2016-06-25bits/sigset.h: Fix _EXTERN_INLINE redefinitionLeonid Lisovskiy
Commit 251a3c19cb "sleep: employ __USE_EXTERN_INLINES (with necessary fixes)" introduces following problems: 1. __USE_EXTERN_INLINES forcibly enabled build fails ... LD libuClibc-1.0.15.so libc/libc_so.a(cmsg_nxthdr.os): In function `__GI___cmsg_nxthdr': cmsg_nxthdr.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr' libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here libc/libc_so.a(creat.os): In function `__GI___cmsg_nxthdr': creat.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr' libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here ... 2. libuargp wrongly contains __cmsg_nxthdr/__sigismember/__sigdelset/__sigaddset global symbols on platforms which includes signal.h from sys/procfs.h As result, static linking will fail: TEST_LINK argp/ bug-argp1 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigismember': sigsetops.c:(.text+0x0): multiple definition of `__sigismember' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x0): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigaddset': sigsetops.c:(.text+0x28): multiple definition of `__sigaddset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x28): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigdelset': sigsetops.c:(.text+0x4c): multiple definition of `__sigdelset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x4c): first defined here We have to partially revert 251a3c19cb to fix problems above. It is safe to do this after commit 162cfaea20 *: inline constant __sig{add,del}set and __sigismember since we are able to use new inlines from within libc and leave the rest of world(__USE_EXTERN_INLINES) equal to glibc now. Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
2016-05-18remove linuxthreads.new, rename linuxthreads.oldWaldemar Brodkorb
Linuxthreads.new isn't really useful with the existence of NPTL/TLS for well supported architectures. There is no reason to use LT.new for ARM/MIPS or other architectures supporting NPTL/TLS. It is not available for noMMU architectures like Blackfin or FR-V. To simplify the live of the few uClibc-ng developers, LT.new is removed and LT.old is renamed to LT. LINUXTHREADS_OLD -> UCLIBC_HAS_LINUXTHREADS
2016-04-15replace FSF addresses with URLsNikola Forró
License notices in most of the source files refer to an outdated FSF address. Replace it with URL, like in the rest of the source files.Signed-off-by: Nikola Forró <nforro@redhat.com>
2016-03-31bits/byteswap-common.h: import recent headers from glibcAnthony G. Basile
On systems where uClibc doesn't provide an arch specific byteswap.h, we fall back on bits/byteswap-common.h. However, there is a bug in this header in the __bswap_constant_64(x) macro. If, for example, a double is passed, we get 'invalid operands to binary &' in which we mismatch a 'double' and 'long long unsigned int'. The newer glibc headers fix this and so we import them. Also, since the inclusion of byteswap.h is not appropriate for assembly code, we guard a portion of endian.h which uses byteswap.h from inclusion in any assembly. This is needed, for example, for f2fs-tools 1.6.0 on 32-bit big endian PowerPC. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2016-01-30add exp10() from glibcWaldemar Brodkorb
Some software make use of exp10, so add it. Basic testing with LTP. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-01-10Provide XTI __t_scalar_t types, like glibcWaldemar Brodkorb
Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
2016-01-01Add argp implementationSalvatore Cro
Argp is an advanced support for parsing unix-style argument vectors. In addition to the common getopt interface, it provides automatic response to `--help' and `--version' options and use of custom parser in conjunction with argp native option parser, among others. Argp support is required by elfutils package and prelink. In uClibc argp functionalities has been moved from C library to libuargp.so Further the libc.so linker script contains an AS_NEEDED entry so that it doesn't need to link libuargp.so explicitely. Disable argp test if feature disabled. Signed-off-by: Salvatore Cro <salvatore.cro@st.com> Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2015-12-22Do define some IPv6 related symbols even with IPv6 disabledWaldemar Brodkorb
Fixes compilation of some faulty applictions. Patch from Freetz.org Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
2015-12-17libc/stdio: Rework custom streams interface similar to glibc.Waldemar Brodkorb
Save 20 bytes per FILE structure, avoid indirect call for read/write/seek/close operations for normal streams. Additionally, custom streams has fileno = -2 now, like in glibc. bloat-o-meter report (UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y): function old new delta fopencookie 69 131 +62 ftello64 233 260 +27 fseeko64 298 319 +21 fclose 423 442 +19 .rodata 16696 16708 +12 fileno_unlocked 53 45 -8 __ns_name_pack 859 851 -8 vswscanf 184 144 -40 vdprintf 231 187 -44 vsscanf 210 151 -59 vswprintf 269 201 -68 vsnprintf 249 181 -68 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/7 up/down: 141/-295) Total: -154 bytes Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
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-06-10siginfo: add signal info for seccomp related SIGSYSDaniel Golle
uClibc doesn't define signal info for the SIGSYS signal which is issued in case of hitting a syscall prohibited by seccomp. This is sad as it makes debugging seccomp filter policies impossible on some architectures (at least ARM and PowerPC, maybe also others) which do not coincidentally set si_value.sival_int as the syscall number. To fix this, import the definitions and macros needed from glibc. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-25Revert "Do not define unimplemented functions"Waldemar Brodkorb
This reverts commit bd3eaf83ef1b4954b6c0e7ba8bbdd29b2cd4a833. They are now implemented.
2015-03-29merge uClibc git masterWaldemar Brodkorb
2015-03-24libc: TIME64_COMPAT32 for sparc, mipsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22libc: add getrandom(2)Bernhard Reutner-Fischer
Introduce a <sys/random.h> for it. /* FIXME: aren't there a couple of __restrict and const missing ? */ extern int getrandom(void *__buf, size_t count, unsigned int flags) __nonnull ((1)) __wur; Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-18libm: Add missing C99 float/ld wrappersBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-04Merge remote-tracking branch 'origin/upstream' into 1.0Waldemar Brodkorb
2015-02-27libc: silence warningBernhard Reutner-Fischer
include/bits/sigset.h:219:62: warning: right-hand operand of comma expression has no effect [-Wunused-value] include/bits/sigset.h:210:63: warning: right-hand operand of comma expression has no effect [-Wunused-value] Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20sync with uClibcWaldemar Brodkorb
2015-02-17libc: add setns()Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-14Revert "resolve merge"Waldemar Brodkorb
This reverts commit 6b6ede3d15f04fe825cfa9f697507457e3640344.
2015-02-14resolve mergeWaldemar Brodkorb
2014-12-30remove another two warnings.Waldemar Brodkorb
2014-12-25merge upstream changesWaldemar Brodkorb
2014-12-12unistd: allow to turn off getopt_longBernhard Reutner-Fischer
The GNU variant of getopt() previously had no way to turn off getopt_long() support.
2014-09-26Do not define unimplemented functionsCristian Morales Vega
e.g. fminf() is not implemented, only fmin(), but both are defined. Signed-off-by: Cristian Morales Vega <cristian@samknows.com>
2014-08-25mathinline.h: Use __extern_inlineBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-01bits/time.h: sync with latest glibcMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-07-22syscalls-common.h: Rename some macro args for correct documentationVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23weak symbols need to be "defined" weak but "declared" strongVineet Gupta
Patch "LT.old: Make __errno_location/__h_errno_location thread safe" uncovered yet another bug with static linking and errno (hopefully this is last of them all). Currently, __errno_location is declared weak but is defined strong. While this provides with the desired weak semantics in dso, it is subtly broken in static links. Quoting Joern Rennecke (ARC gcc expert): | I think the issue is that you declare the function as weak in the | header file. That is a rare instance where you want the reference | use declaration that differs a bit from the definition. | If the reference uses a weakly declared function, that creates a | weakref, i.e. the linker won't bother to look for this symbol at | all - if it gets linked in for some other reason, fine, | otherwise, it stays zero. So the solution to declare strong, define weak. Supporting data ----------------- orig code: ARM mmap wrapper (LT.old build + my prev patch for errno) _mmap: @ args = 8, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 stmfd sp!, {r4, r5, r7, lr} ldr r5, [sp, #20] movs ip, r5, asl #20 beq .L2 bl __errno_location(PLT) mov r3, #22 str r3, [r0, #0] mvn r0, #0 ... ... .weak __errno_location A statically linked hello world program which uses mmap too. As we can see__errno_location is completely gone - which is semantically wrong - we need functional errno. 00008274 <__GI_mmap>: 8274: e92d40b0 push {r4, r5, r7, lr} 8278: e59d5014 ldr r5, [sp, #20] 827c: e1b0ca05 lsls ip, r5, #20 8280: 0a000004 beq 8298 8284: e320f000 nop {0} ^^^^^^^^^^ 8288: e3a03016 mov r3, #22 828c: e5803000 str r3, [r0] 8290: e3e00000 mvn r0, #0 This in turn is due to a fixup in ARM ld which transforms branch-to-null into a nop. It is better than crashing but still wrong since errno handling is removed. With the patch, errno_location is restored back in test program. 00008274 <__GI_mmap>: 8274: e92d40b0 push {r4, r5, r7, lr} 8278: e59d5014 ldr r5, [sp, #20] 827c: e1b0ca05 lsls ip, r5, #20 8280: 0a000004 beq 8298 <__GI_mmap+0x24> 8284: eb000010 bl 82cc <__errno_location> 8288: e3a03016 mov r3, #22 828c: e5803000 str r3, [r0] Cc: Christian Ruppert <christian.ruppert@abilis.com> CC: Francois Bedard <Francois.Bedard@synopsys.com> Cc: Anton Kolesov <Anton.Kolesov@synopsys.com> Cc: Joern Rennecke <joern.rennecke@embecosm.com> Cc: Jeremy Bennett <jeremy.bennett@embecosm.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Khem Raj <raj.khem@gmail.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-23LT.old: Make __errno_location/__h_errno_location thread safeVineet Gupta
WHY: errno in uClibc is not thread safe HOW: __errno_location and it's sibling __h_errno_location need to be called via PLT - even from within libc. That way when linked with pthread, intra-uClibc callers will also use the thread safe version. This is achieved by removing the GI alias for these functions, ensuring that they get called normally (via PLT) Verified with ARC LT.old and ARM cubieboard2 buildroot (LT.old) NPTL is unaffected by this bug. ------------ History behind this patch --------------------- This is a long standing bug (https://bugs.busybox.net/show_bug.cgi?id=2089) Others have tried to fix it in past (alteast Peter Korsgaard's patch in 2010), but somehow failed to be merged (or were backed out afterwards). http://lists.uclibc.org/pipermail/uclibc/2010-July/044176.html One of the causes could be side effect of atleast one more bug related to pthreads and static link which has now been fixed. http://lists.uclibc.org/pipermail/uclibc/2013-October/047958.html I have solved this w/o looking at other pacthes but would like to give credit to Peter and others for confirming that it makes sense. Cc: Christian Ruppert <christian.ruppert@abilis.com> CC: Francois Bedard <Francois.Bedard@synopsys.com> Cc: Joern Rennecke <joern.rennecke@embecosm.com> Cc: Jeremy Bennett <jeremy.bennett@embecosm.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Khem Raj <raj.khem@gmail.com> Cc: buildroot@busybox.net Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06Fix weak/strong attribute of __errno_location and it's __GI aliasVineet Gupta
A simple statically linked hello world program was segfaulting for ARC in linuxthreads.old configuration (although the root casue applies cross-arch for NPTL as well as linuxthreads.old as described) The crash was due to branch to NULL in _stdio_init 0001026c <_stdio_init>: 1026c: push_s blink 1026e: st.a r13,[sp,-8] 10272: bl.d 0 --> supposed call to __errno_location The call was NOT getting patched to libc internal only alias __GI___errno_location, because it was weak while it's exported cousin, __errno_location was strong/normal. arc-linux-uclibc-nm libc/misc/internals/__errno_location.os 00000000 W __GI___errno_location 00000000 T __errno_location This is exactly opposite to what is expected. Quoting Peter S. Mazinger, commit 87936cd013041 "errno and *_init cleanup" | The rule adopted: | for enabled threads we make in libc the __GI_x() variants strong, x() weak | and (should) provide another strong x() in libpthread. | If threads are disabled, even the __GI_x() variants are weak. With the fix, we see the right settings as below 00000000 T __GI___errno_location 00000000 W __errno_location Note that problem won't show up in a static busybox build as it references errno and that seems to elide the issue. I can confirm the same/more issues with latest ARM buildroot builds w/o my fix. (1). linuxthreads.old (broken just like ARC) arm-linux-nm uclibc-snapshot/libc/misc/internals/__errno_location.os 00000000 W __GI___errno_location 00000000 T __errno_location But presumably the issue there is NOT catestrophic because ARM linker is likely smarter and patches a NOP instead of NULL branch. 00008388 <_stdio_init>: 8388: e92d4038 push {r3, r4, r5, lr} 838c: e320f000 nop {0} (2) NPTL build (exported version is not weak) 00000000 T __GI___errno_location 00000000 T __errno_location This causes a static link with libpthread and test program referencing errno to fail to link. #include <errno.h> int main(void) { printf("%d\n", errno); } arm-linux-gcc -static -pthread -o tst tst.o arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__errno_location.os): In function `__errno_location': __errno_location.c:(.text+0x0): multiple definition of `__errno_location' arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpthread.a (errno_location.os):errno_location.c:(.text+0x0): first defined here Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-18bits/waitstatus.h: correctly interpret status 0x007f on MIPSDenys Vlasenko
On other architectures exit status of 0x007f is not possible, they don't have signal 127. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-07eventfd.h: Use new "bits/" scheme for arch-specific flagsHiroaki KAWAI
As in timerfd.h, eventfd.h needs arch-specific definition files. alpha, mips and sparc needs separate file, all the other arch will use common definition. This problem is already fixed in glibc. Also sanitize and provide bits for hppa. Make sure not to install the new bits/eventfd unless eventfd support is enabled. Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@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: add posix_fallocate()Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05mman: rename MAP_UNINITIALIZE to MAP_UNINITIALIZEDBernhard Reutner-Fischer
The name was changed to include a trailing 'D' when it went into the kernel. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-26libc/sysdeps: sync bits/in.h with glibcMike Frysinger
URL: https://bugs.busybox.net/show_bug.cgi?id=5888 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-17socket.h: pull socket_type.h from eglibcBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-12-03sched.h: include stdlib.h for malloc/freeBernhard Reutner-Fischer
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-08-04bits/time.h: sync with glibc 2.16Peter Korsgaard
CLOCK_MONOTONIC_RAW is available since 2.6.28 (2d42244ae71d: clocksource: introduce CLOCK_MONOTONIC_RAW), and CLOCK_*_COARSE since 2.6.32 (da15cfdae033: time: Introduce CLOCK_REALTIME_COARSE). Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15bits/types.h: remove thread types, users should include pthread.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-15getopt.h: cleanup header, remove anything already in cdefs.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-15types.h: both icc and tendra support long longPeter 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-15uClibc_pthread.h: remove __pthread_mutex_destroy, unusedPeter 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-15remove uClibc_mutex.h on installPeter S. Mazinger
Add a comment to uClibc_stdio.h to keep macros in sync with uClibc_mutex.h Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15errno, h_errno: correct them for non-TLSPeter S. Mazinger
Move h_errno related stuff to separate file. Do not hide errno and h_errno for non-TLS, else it keeps being 0. Make __[h_]errno_location weak for non-TLS. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>