about summary refs log tree commit diff
path: root/sysdeps/generic/symbol-hacks.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-06-12 10:21:22 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-06-12 10:21:22 -0500
commit6a97b62a5b4f18aea849d6f4d8de58d1469d2521 (patch)
tree0fdb35cb468bdb040fd3a1f01b4ddcc70b0f30dd /sysdeps/generic/symbol-hacks.h
parent94f2c076692a5a4beaa9a85eb10dbe4d891acb1e (diff)
downloadglibc-6a97b62a5b4f18aea849d6f4d8de58d1469d2521.tar.gz
glibc-6a97b62a5b4f18aea849d6f4d8de58d1469d2521.tar.xz
glibc-6a97b62a5b4f18aea849d6f4d8de58d1469d2521.zip
Fix unsafe compiler optimization
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.
Diffstat (limited to 'sysdeps/generic/symbol-hacks.h')
-rw-r--r--sysdeps/generic/symbol-hacks.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
index bc7b4c4441..9eaf014ff2 100644
--- a/sysdeps/generic/symbol-hacks.h
+++ b/sysdeps/generic/symbol-hacks.h
@@ -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