]> sourceware.org Git - glibc.git/commitdiff
Add hidden visibility to internal function prototypes
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 22 Aug 2017 11:49:14 +0000 (13:49 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 22 Aug 2017 11:50:28 +0000 (13:50 +0200)
Add hidden visibility to internal function prototypes to allow direct
access to internal functions within libc.a without using GOT when the
compiler defaults to -fPIE.

Size comparison of elf/ldconfig when the compiler defaults to -fPIE:

On x86-64:
        text    data     bss     dec     hex
Before: 619646   20132    5488  645266   9d892
After : 619502   20132    5488  645122   9d802
On i686:
        text    data     bss     dec     hex
Before: 550333   10748    3060  564141   89bad
After : 546453   10732    3060  560245   88c75

* include/libc-symbols.h (__hidden_proto_hiddenattr): New for
building libc.a.
(hidden_proto): Likewise.
(hidden_tls_proto): Likewise.
(__hidden_proto): Likewise.

(Reapplied after the revert in df1deda60050cc8a68156cf6c81ad42363647a29.)

ChangeLog
include/libc-symbols.h

index 753257810b7a81dbca0eb75f35f938dc010c479d..53fdcb496a30979659a4b5e01b026a67fe6ed0a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-08-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * include/libc-symbols.h (__hidden_proto_hiddenattr): New for
+       building libc.a.
+       (hidden_proto): Likewise.
+       (hidden_tls_proto): Likewise.
+       (__hidden_proto): Likewise.
+
 2017-08-22  Florian Weimer  <fweimer@redhat.com>
 
        math: Statically link tests of internal functionality.
index d6a1c260f6cb80aacd16c9b1b991559421419cf3..fe3571af52925f1c9cb8e2211d5914cf2ca08986 100644 (file)
@@ -513,8 +513,20 @@ for linking")
 # endif
 #else
 # ifndef __ASSEMBLER__
-#  define hidden_proto(name, attrs...)
-#  define hidden_tls_proto(name, attrs...)
+#  if !defined SHARED && IS_IN (libc) && !defined LIBC_NONSHARED \
+      && !defined NO_HIDDEN
+#   define __hidden_proto_hiddenattr(attrs...) \
+  __attribute__ ((visibility ("hidden"), ##attrs))
+#   define hidden_proto(name, attrs...) \
+  __hidden_proto (name, , name, ##attrs)
+#   define hidden_tls_proto(name, attrs...) \
+  __hidden_proto (name, __thread, name, ##attrs)
+#  define __hidden_proto(name, thread, internal, attrs...)          \
+  extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+# else
+#   define hidden_proto(name, attrs...)
+#   define hidden_tls_proto(name, attrs...)
+# endif
 # else
 #  define HIDDEN_JUMPTARGET(name) JUMPTARGET(name)
 # endif /* Not  __ASSEMBLER__ */
This page took 0.043631 seconds and 5 git commands to generate.