summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2014-08-18NPTL: ARC supportVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.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>
2014-04-09ctype.h: Tweak commentBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-04sysinfo.h: Prevent redeclarationsBernhard Reutner-Fischer
Guard against duplicate inclusion. We should go back to just including the linux/sysinfo.h .. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-04-02libc: Fix buglet around __prognameBernhard Reutner-Fischer
508b20ead1710e8c295630d096960e51a65b7e5d disentangled program_invocation_name and __progname but forgot to make __progname conditional on __UCLIBC_HAS___PROGNAME__, resulting in getconf attempting to re-define __progname in case __UCLIBC_HAS___PROGNAME__ was not defined. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-23elf: Add ARC Magic and RelocationsVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-11-06pull kconfig from linux-3.11Bernhard Reutner-Fischer
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-06-14libc: hide obstack relocationsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-14libc/misc/gnu/obprintf.c: implement obstack_printf and obstack_vprintfAnthony G. Basile
This adds a straight forward implementation for obstack_printf and obstack_vprintf on uClibc's already existing obstack_grow and vasprintf. It does not attempt to port over glibc's implementation in terms of _IO_* structs and functions. Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-06-07Reinstate hidden protos for config_{open,close,read}()Vineet Gupta
Partially reverts "parser_config.[ch]: remove duplicated hidden functions" There's a namespace collision for config_{open,close,read} functions between uClibc and Busybox. Callers in uClibc and busybox need to call their local variants. In case of static linking, both the variants need to be pulled in the final executable. Turns out that the existing hidden attribute is not enough for static linked Busybox where the linker treats these symbols as duplicate and pulls in only the local (Busybox's own) variants in the final link. This obviously causes the uClibc callers to crap out at runtime. This can be fixed by restoring the libc_hidden_proto() annotation which causes the libc variants to be aliased with __GI_ prefix thus making both the symbols distinct from linker's perspective. This issue was found with ARC gcc 4.8 + uClibc trunk. I can confirm the same thing with ARM uClibc buildroot build (when switching to uClibc daily snapshot). All the credit for debugging the issue goes to Anton,Joern and Jeremy - I simply found the cure :-) Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Anton Kolesov <akolesov@synopsys.com> Cc: Jeremy Bennett <jeremy.bennett@embecosm.com> Cc: Joern Rennecke <joern.rennecke@embecosm.com> Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Cc: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-04add UCLIBC_SUSV2_LEGACY to hide vallocBernhard Reutner-Fischer
valloc was marked as LEGACY in SUSv2, removed from SUSv3 and later. TODO: Remove this (point people to memalign and it's successors?). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-04-03stdlib: avoid relocationBernhard Reutner-Fischer
valloc uses memalign Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14metag: Add NPTL supportMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-14elf: Add ELF magic number and relocations for the Meta architectureMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20stat: Use fstatat64 if arch does not have the stat syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20stat64: Use fstatat64 if arch does not have the stat64 syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20statfs: Use statfs64 if arch does not have the statfs syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20sendfile: Use sendfile64 if arch does not have the sendfile syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20truncate: Use truncate64 if arch does not have the truncate syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20symlink: Use symlinkat if arch does not have the symlink syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20readlink: Use readlinkat if arch does not have the readlink syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20rename: Use renameat if arch does not have the rename syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20mkdir: Use mkdirat if arch does not have the mkdir syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20chown: Use fchownat if arch does not have the chown syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20unlink: Use unlinkat if arch does not have the unlink syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20link: Use linkat if arch does not have the link syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20access: Use faccessat if arch does not have the access syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20chmod: Use fchmodat if arch does not have the chmod syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20dup2: Use dup3 if arch does not have the dup2 syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-18libc: add non standard execvpe functionHenning Heinold
Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-11libc: add posix_fallocate()Bernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-18mount.h: updateBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-01-16getpwnam: hide relocationBernhard Reutner-Fischer
The non-reentrant version of getpwnam is used in the RPC code (for !HAS_REENTRANT_RPC) 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-11-16include/elf.h: update for ELFOSABI_* changes.Thomas Schwinge
ELFOSABI_GNU replaces ELFOSABI_LINUX, the latter is kept as a compatibility alias, and ELFOSABI_HURD is removed. See the table on <http://www.sco.com/developers/gabi/latest/ch4.eheader.html#osabi> for reference. Signed-off-by: Thomas Schwinge <thomas@codesourcery.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-14libc/stdlib: add mkostemp helpersMike Frysinger
Some projects (like udev) are starting to use this. Imported from glibc. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-14libc/sysdeps: add dup3 syscall wrapperMike Frysinger
Some projects (like udev) are starting to use this. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-14include/: ignore more symlinksMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-06-15signal.h: needs size_tPeter 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-15sched.h: update header, needs size_tPeter S. Mazinger
While there, guard __clone[2] with _LIBC Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15signal: remove sigblock, siggetmask and sigsetmaskPeter S. Mazinger
rcmd.c uses sigblock and sigsetmask, make the function static and include them directly until a rewrite is done. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15sigpause.c: provide the X/Open variant, since the BSD version is deprecatedPeter S. Mazinger
Do not export __sigpause. Provide __bsd_sigpause (unprototyped) if anyone may need it. Adapt cancellation to use cancel.h. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15socketcalls.c: rewrite to use cancel.hPeter S. Mazinger
__socketcall.c: remove guard, we definitely need this syscall Re-added guard plus added comment (Bernhard) Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15rework cancellation for sigwait, sigtimedwait and sigwaitinfoPeter S. Mazinger
sigtimedwait: - provide __sigtimedwait_nocancel - use __SYSCALL_SIGSET_T_SIZE instead of _NSIG / 8 - do not provide __sigtimedwait - guard a section to avoid failure on archs if SI_TKILL/SI_USER are not defined sigwaitinfo: - simply use sigtimedwait since that handles cancellation already sigwait: - use non-cancellable functions (sigtimedwait, sigsuspend) - get rid of code already done in __sigtimedwait_nocancel Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15lseek, lseek64: add cancellation for all THREADSPeter S. Mazinger
LT_OLD provides cancellable versions, do it for all THREADS. llseek.c: use newly added macros for offset handling. Add a comment about endianness issue around offset. Compile llseek.c only on 32bit archs. Provide aliases for 64bit archs or if syscall is not available. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15sigsuspend.c: add cancellation support independently of rt_sigsuspendPeter S. Mazinger
signal.h: add __SYSCALL_SIGSET_T_SIZE, since kernel sigset_t is different on mips and use that instead of _NSIG / 8 Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>