This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.20-176-g939da41


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  939da41143341bbcdd3dd50ee7b57776603da260 (commit)
      from  293d9a41805b1eeb440a2c59a717b332cd9c2384 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=939da41143341bbcdd3dd50ee7b57776603da260

commit 939da41143341bbcdd3dd50ee7b57776603da260
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Nov 12 22:36:34 2014 +0000

    Fix stpcpy / mempcpy namespace (bug 17573).
    
    Various glibc functions call __stpcpy and __mempcpy for namespace
    reasons instead of plain stpcpy and mempcpy.  But __stpcpy and
    __mempcpy are macros that call __builtin_stpcpy and __builtin_mempcpy,
    and unless GCC optimizes the calls, they end up calling the C
    functions stpcpy and mempcpy.
    
    For calls from within shared libc, libc_hidden_builtin_proto ensures
    that calls to those C functions are in turn mapped to call __GI_stpcpy
    and __GI_mempcpy.  However, for static libc, and for calls from shared
    libraries other than libc, the ELF symbols stpcpy and mempcpy end up
    getting called, breaking the ISO C namespace (in the case of stpcpy)
    or glibc conventions about not relying on the "future library
    directions" reservations (in the case of mempcpy).
    
    This patch fixes this by adding declarations of these functions to
    include/string.h, under an appropriate condition, with __asm__ used to
    change the assembler name used for calls (the mempcpy case was
    previously discussed, and the approach for the fix is as I suggested
    in <https://sourceware.org/ml/libc-alpha/2013-02/msg00063.html>).
    
    Tested for x86_64 with the testsuite; also checked that dcigettext.o
    (an example previously noted of undesired calls to stpcpy and mempcpy)
    now calls __stpcpy and __mempcpy instead, as do non-libc shared
    libraries (__stpcpy and __mempcpy were already exported from shared
    libc).  Disassembly of installed shared libraries isn't easy to
    compare because of reordered PLT entries resulting from the change in
    functions called (libnsl, libnss_compat, libnss_dns, libnss_files,
    libnss_hesiod, libnss_nis, libnss_nisplus, libpthread, librt all have
    such changes).
    
    	[BZ #17573]
    	* include/string.h [NOT_IN_libc || !SHARED] (mempcpy): Declare
    	with asm name __mempcpy.
    	[NOT_IN_libc || !SHARED] (stpcpy): Declare with asm name __stpcpy.

diff --git a/ChangeLog b/ChangeLog
index 1a798b5..f33d582 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-11-12  Joseph Myers  <joseph@codesourcery.com>
 
+	[BZ #17573]
+	* include/string.h [NOT_IN_libc || !SHARED] (mempcpy): Declare
+	with asm name __mempcpy.
+	[NOT_IN_libc || !SHARED] (stpcpy): Declare with asm name __stpcpy.
+
 	[BZ #17572]
 	* sysdeps/x86_64/rawmemchr.S (rawmemchr): Rename to __rawmemchr
 	and define as weak alias of __rawmemchr.
diff --git a/NEWS b/NEWS
index e94ba06..befd5e5 100644
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,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, 17583, 17584.
+  17555, 17570, 17571, 17572, 17573, 17583, 17584.
 
 * New locales: tu_IN, bh_IN.
 
diff --git a/include/string.h b/include/string.h
index 8323412..2603e9c 100644
--- a/include/string.h
+++ b/include/string.h
@@ -113,6 +113,13 @@ libc_hidden_builtin_proto (strspn)
 libc_hidden_builtin_proto (strstr)
 libc_hidden_builtin_proto (ffs)
 
+#if defined NOT_IN_libc || !defined SHARED
+/* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
+   __mempcpy and __stpcpy if not inlined.  */
+extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
+extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
+#endif
+
 # ifndef _ISOMAC
 #  ifndef index
 #   define index(s, c)	(strchr ((s), (c)))

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    5 +++++
 NEWS             |    2 +-
 include/string.h |    7 +++++++
 3 files changed, 13 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]