* Fix strtoll / strtoull namespace for 32-bit (bug 17594)
@ 2014-11-12 23:49 Joseph Myers
2014-11-13 19:02 ` Roland McGrath
0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2014-11-12 23:49 UTC (permalink / raw)
To: libc-alpha
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).
2014-11-12 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.
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index f97fc44..bd59180 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)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix strtoll / strtoull namespace for 32-bit (bug 17594)
2014-11-12 23:49 Fix strtoll / strtoull namespace for 32-bit (bug 17594) Joseph Myers
@ 2014-11-13 19:02 ` Roland McGrath
0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2014-11-13 19:02 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
Looks OK.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-13 19:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-12 23:49 Fix strtoll / strtoull namespace for 32-bit (bug 17594) Joseph Myers
2014-11-13 19:02 ` Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).