Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
This matches a similar change made to glibc.
No functional changes here.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
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>
|
|
Define a common view of __errno_location, __h_errno_location in common header
and use that everywhere, __uClibc_main.c is no special.
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.
_stdio_init,_stdio_term,_locale_init: make all hidden weak in common header
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
This reverts commit 0d6ee549bc86fd330672a79d9a87d2c3825eea67.
We need to find a solution that will work in shared and static libraries
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
Closes #2089 (https://bugs.busybox.net/show_bug.cgi?id=2089)
__errno_location / __h_errno_location access has to go through the PLT
like malloc/free, so the linuxthread variants gets used instead when
compiling with -pthread.
Based on http://github.com/mat-c/uClibc/commit/328d392c54aa5dc2b8e7f398a419087de497de2b
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|
|
|
|
text data bss dec hex filename
- 45 0 480 525 20d libc/inet/gethostbyname.o
+ 18 0 0 18 12 libc/inet/gethostbyname.o
|
|
Appears to build fine (several .configs tried)
|
|
|
|
and marked with libc_hidden_proto/def(),
or not be exported in .h files
and be hidden (or even static if possible).
We have five functions which violate this. Fixing:
netdb.h: export ruserpass()
rpc/rpc.h: export xdr_accepted_reply() and xdr_rejected_reply()
make inet_ntoa_r static function (it is not exported in any .h file)
make _time_tzset hidden function (it is not exported in any .h file)
|
|
|
|
|
|
make it compile and let vapier worry about the rest :)
|
|
|
|
|
|
|
|
(__set_h_errno): Just assign to `h_errno' (which will be expanded to the
thread-friendly version when appropriate).
|
|
-Erik
|
|
|
|
|
|
|
|
partial IPV6 support. This adds things like gethostbyname2().
Off by defaut, of course,
|
|
|
|
|
|
|