From 8f550715c2b211036fc273add3cb5219397ed312 Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Wed, 16 Apr 2014 15:27:52 +0530 Subject: LT.old: Make __errno_location/__h_errno_location thread safe 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 CC: Francois Bedard Cc: Joern Rennecke Cc: Jeremy Bennett Cc: Thomas Petazzoni Cc: Peter Korsgaard Cc: Khem Raj Cc: buildroot@busybox.net Signed-off-by: Vineet Gupta Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/internals/__errno_location.c | 1 - libc/misc/internals/__h_errno_location.c | 1 - 2 files changed, 2 deletions(-) (limited to 'libc/misc') diff --git a/libc/misc/internals/__errno_location.c b/libc/misc/internals/__errno_location.c index be7a9093e..9bbc2d779 100644 --- a/libc/misc/internals/__errno_location.c +++ b/libc/misc/internals/__errno_location.c @@ -16,4 +16,3 @@ int *__errno_location(void) { return &errno; } -libc_hidden_weak(__errno_location) diff --git a/libc/misc/internals/__h_errno_location.c b/libc/misc/internals/__h_errno_location.c index 6653681cb..b30859e81 100644 --- a/libc/misc/internals/__h_errno_location.c +++ b/libc/misc/internals/__h_errno_location.c @@ -16,4 +16,3 @@ int *__h_errno_location(void) { return &h_errno; } -libc_hidden_weak(__h_errno_location) -- cgit v1.2.3