about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-11-13 19:50:55 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-11-13 19:50:55 +0000
commit2a1cfd94a26e0fa96d8f284897213b65c60142d6 (patch)
tree4ea3d0832469c75ddf3cc5d147f96a15e6c98868
parent20ed0d266f2c04f5612e2cedf02ede0d0c152e73 (diff)
downloadglibc-2a1cfd94a26e0fa96d8f284897213b65c60142d6.tar.gz
glibc-2a1cfd94a26e0fa96d8f284897213b65c60142d6.tar.xz
glibc-2a1cfd94a26e0fa96d8f284897213b65c60142d6.zip
Fix strtoll / strtoull namespace for 32-bit (bug 17594).
For 32-bit platforms, strtoll and strtoull are strong symbols in libc,
but they are not in ISO C90, and are brought in by references to
__strtoll_internal / __strtoull_internal from scanf.  (For 64-bit
platforms, they are properly weak.)  This patch makes them weak for
32-bit (it has a side-effect of making other symbols weak that don't
need to be weak, such as strtol, but that's harmless).

Tested for x86 (testsuite, and that the disassembly of installed
shared libraries is unchanged by the patch).  This fixes all 120
unXFAILed FAILs of the new linknamespace tests seen for x86 (in fact,
there are now seven XPASSes of those tests for x86

XPASS: conform/POSIX2008/fcntl.h/linknamespace
XPASS: conform/UNIX98/libgen.h/linknamespace
XPASS: conform/XOPEN2K/fcntl.h/linknamespace
XPASS: conform/XOPEN2K/libgen.h/linknamespace
XPASS: conform/XOPEN2K8/fcntl.h/linknamespace
XPASS: conform/XOPEN2K8/libgen.h/linknamespace
XPASS: conform/XPG4/libgen.h/linknamespace

so suggesting that the failures seen for those on x86_64 are in some
way architecture-specific or 64-bit-specific).

	[BZ #17594]
	* stdlib/strtol.c (SYM__): New macro.
	(SYM__1): Likewise.
	(__strtol): Likewise.
	(strtol): Rename to __strtol and define as weak alias of
	__strtol.  Use libc_hidden_weak.
-rw-r--r--ChangeLog9
-rw-r--r--NEWS2
-rw-r--r--stdlib/strtol.c9
3 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 91f8746ca5..59c30e09a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-11-13  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #17594]
+	* stdlib/strtol.c (SYM__): New macro.
+	(SYM__1): Likewise.
+	(__strtol): Likewise.
+	(strtol): Rename to __strtol and define as weak alias of
+	__strtol.  Use libc_hidden_weak.
+
 2014-11-13  Stefan Liebler  <stli@linux.vnet.ibm.com>
 
 	* sysdeps/s390/s390-32/dl-machine.h (RTLD_START):
diff --git a/NEWS b/NEWS
index 918b4a1a82..c582c8e559 100644
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,7 @@ Version 2.21
   6652, 12926, 14132, 14138, 14171, 15215, 15884, 17266, 17344, 17363,
   17370, 17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522,
   17555, 17570, 17571, 17572, 17573, 17574, 17582, 17583, 17584, 17585,
-  17589.
+  17589, 17594.
 
 * New locales: tu_IN, bh_IN.
 
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index f97fc440a5..bd59180595 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -82,6 +82,10 @@
 #define INTERNAL(X) INTERNAL1(X)
 #define INTERNAL1(X) __##X##_internal
 
+#define SYM__(X) SYM__1 (X)
+#define SYM__1(X) __ ## X
+#define __strtol SYM__ (strtol)
+
 
 extern INT INTERNAL (__strtol_l) (const STRING_TYPE *, STRING_TYPE **, int,
 				  int, __locale_t);
@@ -100,11 +104,12 @@ libc_hidden_def (INTERNAL (strtol))
 
 
 INT
-strtol (nptr, endptr, base)
+__strtol (nptr, endptr, base)
      const STRING_TYPE *nptr;
      STRING_TYPE **endptr;
      int base;
 {
   return INTERNAL (__strtol_l) (nptr, endptr, base, 0, _NL_CURRENT_LOCALE);
 }
-libc_hidden_def (strtol)
+weak_alias (__strtol, strtol)
+libc_hidden_weak (strtol)