[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[glibc] 01/01: hurd: disable hidden only in rtld



This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch glibc-2.26
in repository glibc.

commit 70480d3f15e2ad374674a939f7fd74a958ed3f1d
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Mon Oct 2 23:57:48 2017 +0000

    hurd: disable hidden only in rtld
    
        - patches/hurd-i386/git-NO_HIDDEN.diff: New patch.
        - patches/hurd-i386/unsubmitted-NO_HIDDEN.diff: Remove patch.
        - patches/hurd-i386/unsubmitted-exp-hidden-jump.diff: Remove patch.
---
 debian/changelog                                   |   3 +
 debian/patches/hurd-i386/git-NO_HIDDEN.diff        | 251 +++++++++++++++++++++
 .../patches/hurd-i386/unsubmitted-NO_HIDDEN.diff   |  26 ---
 .../hurd-i386/unsubmitted-exp-hidden-jump.diff     |  76 -------
 debian/patches/series                              |   3 +-
 5 files changed, 255 insertions(+), 104 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f7c72a4..4c94608 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -93,6 +93,9 @@ glibc (2.26-0experimental0) UNRELEASED; urgency=medium
     - patches/hurd-i386/git-revoke-linknamespace.diff: New patch.
     - patches/hurd-i386/git-seekdir-linknamespace.diff: New patch.
     - patches/hurd-i386/git-ifaddrs-linknamespace.diff: New patch.
+    - patches/hurd-i386/git-NO_HIDDEN.diff: New patch.
+    - patches/hurd-i386/unsubmitted-NO_HIDDEN.diff: Remove patch.
+    - patches/hurd-i386/unsubmitted-exp-hidden-jump.diff: Remove patch.
     - testsuite-xfail-debian.mk: Update.
     - testsuite-xfail-debian.mk: Remove now-removed XPG3 entries.
 
diff --git a/debian/patches/hurd-i386/git-NO_HIDDEN.diff b/debian/patches/hurd-i386/git-NO_HIDDEN.diff
new file mode 100644
index 0000000..7054a6e
--- /dev/null
+++ b/debian/patches/hurd-i386/git-NO_HIDDEN.diff
@@ -0,0 +1,251 @@
+commit 3d1870fa3301c5cd00d5fdab0014c4e22b71fef2
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date:   Tue Oct 3 01:26:58 2017 +0200
+
+    Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN
+    
+    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.
+
+Index: glibc-2.26/include/libc-symbols.h
+===================================================================
+--- glibc-2.26.orig/include/libc-symbols.h
++++ glibc-2.26/include/libc-symbols.h
+@@ -544,7 +544,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: glibc-2.26/include/stdlib.h
+===================================================================
+--- glibc-2.26.orig/include/stdlib.h
++++ glibc-2.26/include/stdlib.h
+@@ -287,7 +287,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: glibc-2.26/sysdeps/mach/hurd/configure.ac
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/configure.ac
++++ glibc-2.26/sysdeps/mach/hurd/configure.ac
+@@ -3,7 +3,7 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the
+ 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
+Index: glibc-2.26/sysdeps/mach/hurd/configure
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/configure
++++ glibc-2.26/sysdeps/mach/hurd/configure
+@@ -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: glibc-2.26/include/assert.h
+===================================================================
+--- glibc-2.26.orig/include/assert.h
++++ glibc-2.26/include/assert.h
+@@ -20,7 +20,7 @@ extern void __assert_fail_base (const ch
+ 				const char *function)
+      __THROW  __attribute__ ((__noreturn__));
+ 
+-# 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: glibc-2.26/include/dirent.h
+===================================================================
+--- glibc-2.26.orig/include/dirent.h
++++ glibc-2.26/include/dirent.h
+@@ -76,7 +76,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 (__closedir) __closedir attribute_hidden;
+ extern __typeof (__fdopendir) __fdopendir attribute_hidden;
+ extern __typeof (__readdir) __readdir attribute_hidden;
+Index: glibc-2.26/include/libc-internal.h
+===================================================================
+--- glibc-2.26.orig/include/libc-internal.h
++++ glibc-2.26/include/libc-internal.h
+@@ -49,7 +49,7 @@ extern void __libc_thread_freeres (void)
+ /* Define and initialize `__progname' et. al.  */
+ extern void __init_misc (int, char **, char **);
+ 
+-# if IS_IN (rtld)
++# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+ extern __typeof (__profile_frequency) __profile_frequency attribute_hidden;
+ # endif
+ 
+Index: glibc-2.26/include/setjmp.h
+===================================================================
+--- glibc-2.26.orig/include/setjmp.h
++++ glibc-2.26/include/setjmp.h
+@@ -25,7 +25,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: glibc-2.26/include/signal.h
+===================================================================
+--- glibc-2.26.orig/include/signal.h
++++ glibc-2.26/include/signal.h
+@@ -53,7 +53,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: glibc-2.26/include/string.h
+===================================================================
+--- glibc-2.26.orig/include/string.h
++++ glibc-2.26/include/string.h
+@@ -142,7 +142,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: glibc-2.26/include/sys/stat.h
+===================================================================
+--- glibc-2.26.orig/include/sys/stat.h
++++ glibc-2.26/include/sys/stat.h
+@@ -12,7 +12,7 @@ extern __mode_t __umask (__mode_t __mask
+ extern int __mkdir (const char *__path, __mode_t __mode);
+ 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)
+@@ -35,7 +35,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: glibc-2.26/include/sys/utsname.h
+===================================================================
+--- glibc-2.26.orig/include/sys/utsname.h
++++ glibc-2.26/include/sys/utsname.h
+@@ -7,7 +7,7 @@ extern int __uname (struct utsname *__na
+ 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: glibc-2.26/sysdeps/generic/_itoa.h
+===================================================================
+--- glibc-2.26.orig/sysdeps/generic/_itoa.h
++++ glibc-2.26/sysdeps/generic/_itoa.h
+@@ -46,7 +46,7 @@ extern char *_itoa (unsigned long long i
+ 
+ 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: glibc-2.26/config.h.in
+===================================================================
+--- glibc-2.26.orig/config.h.in
++++ glibc-2.26/config.h.in
+@@ -93,6 +93,10 @@
+    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
+ 
diff --git a/debian/patches/hurd-i386/unsubmitted-NO_HIDDEN.diff b/debian/patches/hurd-i386/unsubmitted-NO_HIDDEN.diff
deleted file mode 100644
index c6d736a..0000000
--- a/debian/patches/hurd-i386/unsubmitted-NO_HIDDEN.diff
+++ /dev/null
@@ -1,26 +0,0 @@
-TODO: drop, now that we have hidden support.
-
-hurd-i386 defines NO_HIDDEN, thus __GI_* versions are not available.
-
-This was introduced by
-
-https://sourceware.org/bugzilla/show_bug.cgi?id=15605
-
-Since Debian glibc is built with -O2, we shouldn't actually have the issue, but
-we should try not to define NO_HIDDEN
-
---- a/sysdeps/generic/symbol-hacks.h
-+++ b/sysdeps/generic/symbol-hacks.h
-@@ -1,9 +1,12 @@
- /* Some compiler optimizations may transform loops into memset/memmove
-    calls and without proper declaration it may generate PLT calls.  */
- #if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED
-+#include <config.h>
-+#  if !defined NO_HIDDEN
- asm ("memmove = __GI_memmove");
- asm ("memset = __GI_memset");
- asm ("memcpy = __GI_memcpy");
-+#  endif
- 
- /* Some targets do not use __stack_chk_fail_local.  In libc.so,
-    redirect __stack_chk_fail to a hidden reference
diff --git a/debian/patches/hurd-i386/unsubmitted-exp-hidden-jump.diff b/debian/patches/hurd-i386/unsubmitted-exp-hidden-jump.diff
deleted file mode 100644
index a2964b4..0000000
--- a/debian/patches/hurd-i386/unsubmitted-exp-hidden-jump.diff
+++ /dev/null
@@ -1,76 +0,0 @@
-hidden jump can not work in these snippets in the NO_HIDDEN case, because %ebx
-is not set as PIC register, and thus one can't use the @plt version.
-
-Until we avoid using NO_HIDDEN (see
-https://sourceware.org/bugzilla/show_bug.cgi?id=15605#c5), we need this.
-
-diff --git a/sysdeps/i386/fpu/e_expl.S b/sysdeps/i386/fpu/e_expl.S
-index 7d75fe22a1..8c06f5c3ee 100644
---- a/sysdeps/i386/fpu/e_expl.S
-+++ b/sysdeps/i386/fpu/e_expl.S
-@@ -81,7 +81,13 @@ ENTRY(IEEE754_EXPL)
- 	movzwl	4+8(%esp), %eax
- 	xorb	$0x80, %ah	// invert sign bit (now 1 is "positive")
- 	cmpl	$0xc006, %eax	// is num positive and exp >= 6 (number is >= 128.0)?
-+	#if !defined(PIC) || !defined(NO_HIDDEN)
- 	jae	HIDDEN_JUMPTARGET (__expl) // (if num is denormal, it is at least >= 64.0)
-+	#else
-+	jb	0f
-+	jmp	__expl // (if num is denormal, it is at least >= 64.0)
-+0:
-+	#endif
- #endif
- 	fldt	4(%esp)
- /* I added the following ugly construct because expl(+-Inf) resulted
-diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S
-index 9e162848e4..04f07dcc5e 100644
---- a/sysdeps/i386/fpu/e_powl.S
-+++ b/sysdeps/i386/fpu/e_powl.S
-@@ -242,7 +242,11 @@ ENTRY(__ieee754_powl)
- 	cfi_adjust_cfa_offset (28)
- 	fstpt	12(%esp)	// x
- 	fstpt	(%esp)		// <empty>
-+	#if !defined(PIC) || !defined(NO_HIDDEN)
- 	call	HIDDEN_JUMPTARGET (__powl_helper)	// <result>
-+	#else
-+	call	__powl_helper	// <result>
-+	#endif
- 	addl	$36, %esp
- 	cfi_adjust_cfa_offset (-36)
- 	ret
-diff --git a/sysdeps/i386/fpu/s_expm1.S b/sysdeps/i386/fpu/s_expm1.S
-index 59fded2d5a..60096d23ae 100644
---- a/sysdeps/i386/fpu/s_expm1.S
-+++ b/sysdeps/i386/fpu/s_expm1.S
-@@ -51,7 +51,13 @@ ENTRY(__expm1)
- 	movzwl	4+6(%esp), %eax
- 	xorb	$0x80, %ah	// invert sign bit (now 1 is "positive")
- 	cmpl	$0xc086, %eax	// is num >= 704?
-+	#if !defined(PIC) || !defined(NO_HIDDEN)
- 	jae	HIDDEN_JUMPTARGET (__exp)
-+	#else
-+	jb	0f
-+	jmp	__exp
-+0:
-+	#endif
- 
- 	fldl	4(%esp)		// x
- 	fxam			// Is NaN, +-Inf or +-0?
-diff --git a/sysdeps/i386/fpu/s_expm1f.S b/sysdeps/i386/fpu/s_expm1f.S
-index 4f0b2e7832..51d5aa8c4f 100644
---- a/sysdeps/i386/fpu/s_expm1f.S
-+++ b/sysdeps/i386/fpu/s_expm1f.S
-@@ -51,7 +51,13 @@ ENTRY(__expm1f)
- 	movzwl	4+2(%esp), %eax
- 	xorb	$0x80, %ah	// invert sign bit (now 1 is "positive")
- 	cmpl	$0xc2b1, %eax	// is num >= 88.5?
-+	#if !defined(PIC) || !defined(NO_HIDDEN)
- 	jae	HIDDEN_JUMPTARGET (__expf)
-+	#else
-+	jb	0f
-+	jmp	__expf
-+0:
-+	#endif
- 
- 	flds	4(%esp)		// x
- 	fxam			// Is NaN, +-Inf or +-0?
diff --git a/debian/patches/series b/debian/patches/series
index 1dea679..9053fab 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -94,7 +94,6 @@ hurd-i386/tg-io_select_timeout.diff
 hurd-i386/tg-poll_errors_fixes.diff
 hurd-i386/unsubmitted-clock_t_centiseconds.diff
 hurd-i386/submitted-path_mounted.diff
-hurd-i386/unsubmitted-NO_HIDDEN.diff
 hurd-i386/tg-socket_flags.diff
 hurd-i386/tg-socketpair_flags.diff
 hurd-i386/tg-pipe2.diff
@@ -156,7 +155,6 @@ hurd-i386/git-clone.diff
 hurd-i386/git-gethostname.diff
 hurd-i386/git-tst-udp-timeout.diff
 hurd-i386/git-tst-udp-nonblocking.diff
-hurd-i386/unsubmitted-exp-hidden-jump.diff
 hurd-i386/git-hidden-def.diff
 hurd-i386/git-hidden-def-2.diff
 hurd-i386/git-dl-sysdep-check.diff
@@ -168,6 +166,7 @@ hurd-i386/git-dirfd-linknamespace.diff
 hurd-i386/git-revoke-linknamespace.diff
 hurd-i386/git-seekdir-linknamespace.diff
 hurd-i386/git-ifaddrs-linknamespace.diff
+hurd-i386/git-NO_HIDDEN.diff
 
 i386/local-biarch.diff
 i386/unsubmitted-quiet-ldconfig.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-glibc/glibc.git


Reply to: