]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 2 Oct 2017 23:26:58 +0000 (01:26 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 2 Oct 2017 23:33:38 +0000 (01:33 +0200)
On the Hurd, the rtld needs to see its own dumb versions of a few functions
(defined in sysdeps/mach/hurd/dl-sysdep.c) overridden by libc's versions once
loaded. rtld should thus not have hidden attribute for these.  To achieve this,
the Hurd port used to just define NO_HIDDEN, which disables it completely. For
now, this changes that to disabling it for all rtld functions, for simplicity.

See Roland's comment on https://sourceware.org/bugzilla/show_bug.cgi?id=15605#c5

The ld.so numbers remain at

  8 .rel.plt      000000c8  00000c24  00000c24  00000c24  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .plt          000001a0  00000cf0  00000cf0  00000cf0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .plt.got      00000010  00000e90  00000e90  00000e90  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 18 .got.plt      00000070  0002d000  0002d000  0002c000  2**2
                  CONTENTS, ALLOC, LOAD, DATA

which is about 3 times as much as on Linux.

The libc.so numbers get divided by 3 (the remainings are mostly RPC stub calls)

* include/libc-symbols.h [NO_RTLD_HIDDEN] (rtld_hidden_proto,
rtld_hidden_tls_proto, rtld_hidden_def, rtld_hidden_weak,
rtld_hidden_rtld_hidden_ver, data_def, rtld_hidden_data_weak,
rtld_hidden_data_ver): Define to empty.
* include/assert.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__assert_fail,
__assert_perror_fail): Likewise.
* include/dirent.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
(__rewinddir): Likewise.
* include/libc-internal.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
(__profile_frequency): Likewise.
* include/setjmp.h (__sigsetjmp): Likewise.
* include/signal.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__sigaction,
__libc_sigaction): Likewise.
* include/stdlib.h [NO_RTLD_HIDDEN] (unsetenv, __strtoul_internal): Do
not set hidden attribute.
* include/string.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__stpcpy, __strdup,
__strerror_t, __strsep_g, memchr, memcmp, memcpy, memmove, memset,
rawmemchr, stpcpy, strchr, strcmp, strlen, strnlen, strsep): Likewise.
* include/sys/stat.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__fxstat,
__fxstat64, __lxstat, __lxstat64, __xstat, __xstat64,
__fxstatat64): Likewise.
* include/sys/utsname.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
(__uname): Likewise.
* include/sysdeps/generic/_itoa.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
(_itoa_upper_digits, _itoa_lower_digits): Likewise.
* sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Do not set.
(NO_RTLD_HIDDEN): Set.
* sysdeps/mach/hurd/configure: Refresh.
* config.h.in: Refresh.

15 files changed:
ChangeLog
config.h.in
include/assert.h
include/dirent.h
include/libc-internal.h
include/libc-symbols.h
include/setjmp.h
include/signal.h
include/stdlib.h
include/string.h
include/sys/stat.h
include/sys/utsname.h
sysdeps/generic/_itoa.h
sysdeps/mach/hurd/configure
sysdeps/mach/hurd/configure.ac

index a43569336dc735a43c3efdcf1e4f5ce5c2d58a94..9cbff977ede6a10b10a90551a4f94e7b76c54937 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2017-10-03  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+       * include/libc-symbols.h [NO_RTLD_HIDDEN] (rtld_hidden_proto,
+       rtld_hidden_tls_proto, rtld_hidden_def, rtld_hidden_weak,
+       rtld_hidden_rtld_hidden_ver, data_def, rtld_hidden_data_weak,
+       rtld_hidden_data_ver): Define to empty.
+       * include/assert.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__assert_fail,
+       __assert_perror_fail): Likewise.
+       * include/dirent.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
+       (__rewinddir): Likewise.
+       * include/libc-internal.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
+       (__profile_frequency): Likewise.
+       * include/setjmp.h (__sigsetjmp): Likewise.
+       * include/signal.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__sigaction,
+       __libc_sigaction): Likewise.
+       * include/stdlib.h [NO_RTLD_HIDDEN] (unsetenv, __strtoul_internal): Do
+       not set hidden attribute.
+       * include/string.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__stpcpy, __strdup,
+       __strerror_t, __strsep_g, memchr, memcmp, memcpy, memmove, memset,
+       rawmemchr, stpcpy, strchr, strcmp, strlen, strnlen, strsep): Likewise.
+       * include/sys/stat.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__fxstat,
+       __fxstat64, __lxstat, __lxstat64, __xstat, __xstat64,
+       __fxstatat64): Likewise.
+       * include/sys/utsname.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
+       (__uname): Likewise.
+       * include/sysdeps/generic/_itoa.h [IS_IN(rtld) && NO_RTLD_HIDDEN]
+       (_itoa_upper_digits, _itoa_lower_digits): Likewise.
+       * sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Do not set.
+       (NO_RTLD_HIDDEN): Set.
+       * sysdeps/mach/hurd/configure: Refresh.
+       * config.h.in: Refresh.
+
 2017-10-02  Joseph Myers  <joseph@codesourcery.com>
 
        * sysdeps/ieee754/dbl-64/s_atan.c: Include <libm-alias-double.h>.
index 014fb4ea0ef8ef5fde6cd8cea8fd6bcda3622d7a..0d38476fa43c7b7db6be555951430533c9af7afb 100644 (file)
    include/libc-symbols.h that avoid PLT slots in the shared objects.  */
 #undef NO_HIDDEN
 
+/* Define this to disable in rtld the 'hidden_proto' et al macros in
+   include/libc-symbols.h that avoid PLT slots in the shared objects.  */
+#undef NO_RTLD_HIDDEN
+
 /* Define this to disable lazy relocations in DSOs.  */
 #undef BIND_NOW
 
index c0f7e1a91c650b5b5e9dcf3fa7f204a99aba5a52..61cc8aa22ff4b91385d56a168ea7d8326f827963 100644 (file)
@@ -20,7 +20,7 @@ extern void __assert_fail_base (const char *fmt, const char *assertion,
                                const char *function)
      __THROW  __attribute__ ((__noreturn__)) attribute_hidden;
 
-# if IS_IN (libc) || IS_IN (rtld)
+# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
 hidden_proto (__assert_fail)
 hidden_proto (__assert_perror_fail)
 # endif
index 6fcc2f391ba4ae8e60cf46ad552acbf7af73589c..caaeb0be85f0ad75610b7126375d77452b1bde4d 100644 (file)
@@ -77,7 +77,7 @@ extern __typeof (scandirat) __scandirat;
 libc_hidden_proto (__scandirat)
 libc_hidden_proto (scandirat64)
 
-#  if IS_IN (rtld)
+#  if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 extern __typeof (__rewinddir) __rewinddir attribute_hidden;
 #  endif
 # endif
index 7403c24e25cd5e9b5a5329befaddb71f918fd4fc..69cd781aee5e64469473dd12cadf6f0e92585484 100644 (file)
@@ -49,7 +49,7 @@ extern void __libc_thread_freeres (void);
 /* Define and initialize `__progname' et. al.  */
 extern void __init_misc (int, char **, char **) attribute_hidden;
 
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 extern __typeof (__profile_frequency) __profile_frequency attribute_hidden;
 # endif
 
index 10fd2063b01d5caedb62c99a5a839d17e7a04feb..e0d4dc3170ae4ae78da97b28e5323224cc83b5e5 100644 (file)
@@ -558,7 +558,7 @@ for linking")
 # define libc_hidden_data_ver(local, name)
 #endif
 
-#if IS_IN (rtld)
+#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define rtld_hidden_def(name) hidden_def (name)
index e45328b18a9e00578ad3725f1e32992311538cf7..c234287515fd7004d70cbf9f1d829d1580b99fd7 100644 (file)
@@ -28,7 +28,7 @@ libc_hidden_proto (__libc_longjmp)
 libc_hidden_proto (_setjmp)
 libc_hidden_proto (__sigsetjmp)
 
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 extern __typeof (__sigsetjmp) __sigsetjmp attribute_hidden;
 # endif
 #endif
index 7cbe64b8adf9b1311b5c3fb752226e22ca27f5b8..293258ad65d6fda3133963bf21931d8e94ef045d 100644 (file)
@@ -54,7 +54,7 @@ extern int __xpg_sigpause (int sig);
 /* Allocate real-time signal with highest/lowest available priority.  */
 extern int __libc_allocate_rtsig (int __high);
 
-#  if IS_IN (rtld)
+#  if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 extern __typeof (__sigaction) __sigaction attribute_hidden;
 extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
 #  endif
index c0fcb957774fa6bea782f8945b9004a2bbc5494d..5974fb3d24b1f3dc75d3fd5c4b502675acaa683c 100644 (file)
@@ -294,7 +294,7 @@ struct abort_msg_s
 extern struct abort_msg_s *__abort_msg;
 libc_hidden_proto (__abort_msg)
 
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 extern __typeof (unsetenv) unsetenv attribute_hidden;
 extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
 # endif
index 968d6fea057f1dd1118a113c21bc1f91b922f816..bb4922cbbe65dd438059106d2ce69508d201e16e 100644 (file)
@@ -143,7 +143,7 @@ libc_hidden_builtin_proto (strspn)
 libc_hidden_builtin_proto (strstr)
 libc_hidden_builtin_proto (ffs)
 
-#if IS_IN (rtld)
+#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 extern __typeof (__stpcpy) __stpcpy attribute_hidden;
 extern __typeof (__strdup) __strdup attribute_hidden;
 extern __typeof (__strerror_r) __strerror_r attribute_hidden;
index eb4475418570f09ca1f7b916c1935943200c2a37..b82d4527801d4797bcd18ba3729a96379163b044 100644 (file)
@@ -14,7 +14,7 @@ extern int __mkdir (const char *__path, __mode_t __mode);
 libc_hidden_proto (__mkdir)
 extern int __mknod (const char *__path,
                    __mode_t __mode, __dev_t __dev);
-#if IS_IN (libc) || IS_IN (rtld)
+#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
 hidden_proto (__fxstat)
 hidden_proto (__fxstat64)
 hidden_proto (__lxstat)
@@ -37,7 +37,7 @@ libc_hidden_proto (__xmknodat)
 libc_hidden_proto (__fxstatat)
 libc_hidden_proto (__fxstatat64)
 
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;
 # endif
 
index 14f4247dd4135d68c9ad4703a8dcf40c5edf3794..9ed5fa25657438a2f2c0c25999f607d86ff100db 100644 (file)
@@ -7,7 +7,7 @@ extern int __uname (struct utsname *__name);
 libc_hidden_proto (uname)
 libc_hidden_proto (__uname)
 
-# if IS_IN (rtld)
+# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
 extern __typeof (__uname) __uname attribute_hidden;
 # endif
 #endif
index a065ecb89014fbd2ab24d323fcb6153ea69e416e..6998c0859f82a36b8f748109a9e97369e92b4b8a 100644 (file)
@@ -46,7 +46,7 @@ extern char *_itoa (unsigned long long int value, char *buflim,
 
 extern const char _itoa_upper_digits[];
 extern const char _itoa_lower_digits[];
-#if IS_IN (libc) || IS_IN (rtld)
+#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
 hidden_proto (_itoa_upper_digits)
 hidden_proto (_itoa_lower_digits)
 #endif
index 163b5c773095cbd4aa797634d55bd9e9b226dc07..66cc0ce3a53ebb42914d0510cadef13c7e98fb57 100644 (file)
@@ -1,6 +1,6 @@
 # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
 
-$as_echo "#define NO_HIDDEN 1" >>confdefs.h
+$as_echo "#define NO_RTLD_HIDDEN 1" >>confdefs.h
 
 
 if test -n "$sysheaders"; then
index 5539a8c8aff13a0d7ebc7f9d7b8aa23050d3e249..774ffc80a96c8791f084ca415d7ee11530b38bf1 100644 (file)
@@ -3,7 +3,7 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 dnl We need this setting because of the need for PLT calls in ld.so.
 dnl See Roland's comment in
 dnl https://sourceware.org/bugzilla/show_bug.cgi?id=15605
-AC_DEFINE([NO_HIDDEN])
+AC_DEFINE([NO_RTLD_HIDDEN])
 
 if test -n "$sysheaders"; then
   OLD_CPPFLAGS=$CPPFLAGS