about summary refs log tree commit diff
path: root/sysdeps/generic/symbol-hacks.h
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2016-12-26 10:08:57 +0100
committerFlorian Weimer <fweimer@redhat.com>2016-12-26 10:11:05 +0100
commit524a8ef2ad76af8ac049293d993a1856b0d888fb (patch)
treeff9d41f1c2c7c1a2361e3f46a8376a23b96faf17 /sysdeps/generic/symbol-hacks.h
parent66a704c43cfec810fea67a6959f2d1c94f4d594f (diff)
downloadglibc-524a8ef2ad76af8ac049293d993a1856b0d888fb.tar.gz
glibc-524a8ef2ad76af8ac049293d993a1856b0d888fb.tar.xz
glibc-524a8ef2ad76af8ac049293d993a1856b0d888fb.zip
PLT avoidance for __stack_chk_fail [BZ #7065]
Add a hidden __stack_chk_fail_local alias to libc.so,
and make sure that on targets which use __stack_chk_fail,
this does not introduce a local PLT reference into libc.so.
Diffstat (limited to 'sysdeps/generic/symbol-hacks.h')
-rw-r--r--sysdeps/generic/symbol-hacks.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
index ce576c9fd2..d614c099c9 100644
--- a/sysdeps/generic/symbol-hacks.h
+++ b/sysdeps/generic/symbol-hacks.h
@@ -4,4 +4,16 @@
 asm ("memmove = __GI_memmove");
 asm ("memset = __GI_memset");
 asm ("memcpy = __GI_memcpy");
+
+/* Some targets do not use __stack_chk_fail_local.  In libc.so,
+   redirect __stack_chk_fail to a hidden reference
+   __stack_chk_fail_local, to avoid the PLT reference.
+   __stack_chk_fail itself is a global symbol, exported from libc.so,
+   and cannot be made hidden.  */
+
+# if IS_IN (libc) && defined SHARED && \
+  defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
+asm (".hidden __stack_chk_fail_local\n"
+     "__stack_chk_fail = __stack_chk_fail_local");
+# endif
 #endif