]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix unsafe compiler optimization
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>
Wed, 12 Jun 2013 15:21:22 +0000 (10:21 -0500)
committerRyan S. Arnold <rsa@linux.vnet.ibm.com>
Fri, 26 Jul 2013 14:30:36 +0000 (09:30 -0500)
GCC 4.8 enables -ftree-loop-distribute-patterns at -O3 by default and
this optimization may transform loops into memset/memmove calls. Without
proper handling this may generate unexpected PLT calls on GLIBC.
This patch fixes by create memset/memmove alias to internal GLIBC
__GI_memset/__GI_memmove symbols.
(cherry picked from commit 6a97b62a5b4f18aea849d6f4d8de58d1469d2521)

ChangeLog
sysdeps/generic/symbol-hacks.h
sysdeps/wordsize-32/symbol-hacks.h

index d622405a592b49791945c1da62117e257e8da18e..9737691ca5fa71e6155835f7ece61fda5d83a4bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-06-11  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
+
+       [BZ #15605]
+       * sysdeps/generic/symbol-hacks.h: Add workaround for memset/memmove calls
+       generated by the compiler on loop optimizations.
+       * sysdeps/wordsize-32/symbol-hacks.h: Include next symbol-hacks.h for
+       general definitions.
+
 2013-06-11  Ryan S. Arnold  <rsa@linux.vnet.ibm.com>
 
        * sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_platforms): Add ppc405,
index bc7b4c44411ced7fe196bb4607b86db8baaf0725..9eaf014ff2414cfd4b27f89fc094a54c3b4d8403 100644 (file)
@@ -1 +1,6 @@
-/* Fortunately nothing to do.  */
+/* Some compiler optimizations may transform loops into memset/memmove
+   calls and without proper declaration it may generate PLT calls.  */
+#if !defined __ASSEMBLER__ && !defined NOT_IN_libc && defined SHARED
+asm ("memmove = __GI_memmove");
+asm ("memset = __GI_memset");
+#endif
index 52a14fc6717e17b0e60ef81b703dcb5375ae757a..ad5b2313d6cdfdfc1c751324e29d52eb713b5401 100644 (file)
@@ -16,6 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include_next "symbol-hacks.h"
+
 /* A very dirty trick: gcc emits references to __divdi3, __udivdi3,
    __moddi3, and __umoddi3.  These functions are exported and
    therefore we get PLTs.  Unnecessarily so.  Changing gcc is a big