summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-07-18 10:42:48 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-08-16 11:08:23 -0700
commit15e8f11ee4cf0de2ac89a3cdb0903a09a7039fe3 (patch)
tree20d96c27505a9fd68251ae70ef8b688103b0bb17
parentfae39ac3fb0774b837efeb947990151c97ddcc54 (diff)
downloadglibc-15e8f11ee4cf0de2ac89a3cdb0903a09a7039fe3.tar.gz
Enable hidden visibility in libc.a compiled with PIE
When building libc.a with PIE, enable hidden visibility to allow direct access to definitions within libc.a without using GOT. Size comparison of elf/ldconfig when the compiler defaults to -fPIE: On x86-64: text data bss dec hex Before: 619206 20132 5488 644826 9d6da After : 619062 20132 5488 644682 9d64a On i686: text data bss dec hex Before: 556305 10816 3056 570177 8b341 After : 553688 10756 3056 567500 8a8cc * include/libc-symbols.h (attribute_hidden): Enable hidden visibility in libc.a compiled with PIE.
-rw-r--r--include/libc-symbols.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index fe3ab81c51..d6a1c260f6 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -363,7 +363,8 @@ for linking")
strong_alias(real, name)
#endif
-#if defined SHARED || defined LIBC_NONSHARED
+#if defined SHARED || defined LIBC_NONSHARED \
+ || (BUILD_PIE_DEFAULT && IS_IN (libc))
# define attribute_hidden __attribute__ ((visibility ("hidden")))
#else
# define attribute_hidden