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

[glibc] 01/01: hurd: fixes for hidden support



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 99b143f9cd67668abac0a5362511bfd82c4e91f2
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Sep 24 16:18:40 2017 +0000

    hurd: fixes for hidden support
    
        - patches/hurd-i386/git-hidden-def.diff: New patch.
        - patches/hurd-i386/git-hidden-def.diff-2: New patch.
        - patches/hurd-i386/git-dl-sysdep-check.diff: New patch.
---
 debian/changelog                                  |   3 +
 debian/patches/hurd-i386/git-dl-sysdep-check.diff | 173 ++++++++++++++++++++++
 debian/patches/hurd-i386/git-hidden-def-2.diff    |  83 +++++++++++
 debian/patches/hurd-i386/git-hidden-def.diff      | 136 +++++++++++++++++
 debian/patches/series                             |   3 +
 5 files changed, 398 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 03b9fed..7084145 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -78,6 +78,9 @@ glibc (2.26-0experimental0) UNRELEASED; urgency=medium
     - patches/hurd-i386/git-tst-udp-nonblocking.diff: New patch.
     - patches/hurd-i386/submitted-resolv.diff: New patch.
     - patches/hurd-i386/unsubmitted-exp-hidden-jump.diff: New patch.
+    - patches/hurd-i386/git-hidden-def.diff: New patch.
+    - patches/hurd-i386/git-hidden-def.diff-2: New patch.
+    - patches/hurd-i386/git-dl-sysdep-check.diff: New patch.
     - testsuite-xfail-debian.mk: Update with new tests failing on hurd-i386.
 
  -- Adam Conrad <adconrad@0c3.net>  Sat, 02 Sep 2017 12:15:10 -0600
diff --git a/debian/patches/hurd-i386/git-dl-sysdep-check.diff b/debian/patches/hurd-i386/git-dl-sysdep-check.diff
new file mode 100644
index 0000000..cdce840
--- /dev/null
+++ b/debian/patches/hurd-i386/git-dl-sysdep-check.diff
@@ -0,0 +1,173 @@
+commit 5e6f32531eab502afb094ad62aad333c63a58cfd
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date:   Sun Sep 24 17:54:02 2017 +0200
+
+    hurd: Make sure dl-sysdep.c defines proper symbol names
+    
+            * sysdeps/mach/hurd/dl-sysdep.c (check_no_hidden): New macro.
+            (__open, __close, __libc_read, __libc_write, __writev, __libc_lseek64,
+            __mmap, __fxstat64, __xstat64, __access, __access_noerrno, __getpid,
+            __getcwd, __sbrk, __strtoul_internal, _exit, abort): Use check_no_hidden
+            to make sure that these symbols are defined.
+
+diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
+index 8a8ac76efa..ae29489923 100644
+--- a/sysdeps/mach/hurd/dl-sysdep.c
++++ b/sysdeps/mach/hurd/dl-sysdep.c
+@@ -292,6 +292,11 @@ _dl_sysdep_start_cleanup (void)
+    dynamic linker re-relocates itself to be user-visible (for -ldl),
+    it will get the user's definition (i.e. usually libc's).  */
+ 
++/* This macro checks that the function does not get renamed to be hidden: we do
++   need these to be overridable by libc's.  */
++#define check_no_hidden(name) \
++static void __check_##name##_no_hidden(void) __attribute__((alias(#name)));
++
+ /* Open FILE_NAME and return a Hurd I/O for it in *PORT, or return an
+    error.  If STAT is non-zero, stat the file into that stat buffer.  */
+ static error_t
+@@ -347,6 +352,7 @@ open_file (const char *file_name, int flags,
+   return err;
+ }
+ 
++check_no_hidden(__open);
+ int weak_function
+ __open (const char *file_name, int mode, ...)
+ {
+@@ -358,6 +364,7 @@ __open (const char *file_name, int mode, ...)
+     return (int)port;
+ }
+ 
++check_no_hidden(__close);
+ int weak_function
+ __close (int fd)
+ {
+@@ -366,6 +373,7 @@ __close (int fd)
+   return 0;
+ }
+ 
++check_no_hidden(__libc_read);
+ __ssize_t weak_function
+ __libc_read (int fd, void *buf, size_t nbytes)
+ {
+@@ -389,6 +397,7 @@ __libc_read (int fd, void *buf, size_t nbytes)
+ }
+ libc_hidden_weak (__libc_read)
+ 
++check_no_hidden(__libc_write);
+ __ssize_t weak_function
+ __libc_write (int fd, const void *buf, size_t nbytes)
+ {
+@@ -406,6 +415,7 @@ __libc_write (int fd, const void *buf, size_t nbytes)
+ libc_hidden_weak (__libc_write)
+ 
+ /* This is only used for printing messages (see dl-misc.c).  */
++check_no_hidden(__writev);
+ __ssize_t weak_function
+ __writev (int fd, const struct iovec *iov, int niov)
+ {
+@@ -439,7 +449,7 @@ __writev (int fd, const struct iovec *iov, int niov)
+   return 0;
+ }
+ 
+-
++check_no_hidden(__libc_lseek64);
+ off64_t weak_function
+ __libc_lseek64 (int fd, off64_t offset, int whence)
+ {
+@@ -452,6 +462,7 @@ __libc_lseek64 (int fd, off64_t offset, int whence)
+   return offset;
+ }
+ 
++check_no_hidden(__mmap);
+ __ptr_t weak_function
+ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
+ {
+@@ -514,6 +525,7 @@ __mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
+   return (__ptr_t) mapaddr;
+ }
+ 
++check_no_hidden(__fxstat64);
+ int weak_function
+ __fxstat64 (int vers, int fd, struct stat64 *buf)
+ {
+@@ -529,6 +541,7 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
+ }
+ libc_hidden_def (__fxstat64)
+ 
++check_no_hidden(__xstat64);
+ int weak_function
+ __xstat64 (int vers, const char *file, struct stat64 *buf)
+ {
+@@ -551,12 +564,14 @@ libc_hidden_def (__xstat64)
+    whether debugging malloc is allowed even for SUID binaries.  This
+    stub will always fail, which means that malloc-debugging is always
+    disabled for SUID binaries.  */
++check_no_hidden(__access);
+ int weak_function
+ __access (const char *file, int type)
+ {
+   errno = ENOSYS;
+   return -1;
+ }
++check_no_hidden(__access_noerrno);
+ int weak_function
+ __access_noerrno (const char *file, int type)
+ {
+@@ -564,6 +579,7 @@ __access_noerrno (const char *file, int type)
+   return -1;
+ }
+ 
++check_no_hidden(__getpid);
+ pid_t weak_function
+ __getpid (void)
+ {
+@@ -587,8 +603,8 @@ strong_alias (__getpid, __GI___getpid)
+    the functionality here.  (We could, it just requires duplicating or
+    reusing getcwd.c's code but using our special lookup function as in
+    `open', above.)  */
+-char *
+-weak_function
++check_no_hidden(__getcwd);
++char *weak_function
+ __getcwd (char *buf, size_t size)
+ {
+   errno = ENOSYS;
+@@ -597,8 +613,8 @@ __getcwd (char *buf, size_t size)
+ 
+ /* This is used by dl-tunables.c to strdup strings.  We can just make this a
+    mere allocation.  */
+-void *
+-weak_function
++check_no_hidden(__sbrk);
++void *weak_function
+ __sbrk (intptr_t increment)
+ {
+   vm_address_t addr;
+@@ -606,8 +622,8 @@ __sbrk (intptr_t increment)
+   return (void *) addr;
+ }
+ 
+-unsigned long int
+-weak_function
++check_no_hidden(__strtoul_internal);
++unsigned long int weak_function
+ __strtoul_internal (const char *nptr, char **endptr, int base, int group)
+ {
+   assert (base == 0 || base == 10);
+@@ -620,6 +636,7 @@ __strtoul_internal (const char *nptr, char **endptr, int base, int group)
+ strong_alias (__strtoul_internal, __GI___strtoul_internal)
+ strong_alias (__strtoul_internal, __GI_____strtoul_internal)
+ 
++check_no_hidden(_exit);
+ void weak_function attribute_hidden
+ _exit (int status)
+ {
+@@ -640,6 +657,7 @@ strong_alias (_exit, __GI__exit)
+ # define ABORT_INSTRUCTION
+ #endif
+ 
++check_no_hidden(abort);
+ void weak_function
+ abort (void)
+ {
diff --git a/debian/patches/hurd-i386/git-hidden-def-2.diff b/debian/patches/hurd-i386/git-hidden-def-2.diff
new file mode 100644
index 0000000..0487d6b
--- /dev/null
+++ b/debian/patches/hurd-i386/git-hidden-def-2.diff
@@ -0,0 +1,83 @@
+commit 1c6d89e9a40302430d5986a09c7cf7594b93143c
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date:   Sun Sep 17 21:57:39 2017 +0200
+
+    Add missing libc_hidden_weak/def calls
+    
+            * io/read.c (read): Add libc_hidden_weak.
+            * sysdeps/mach/hurd/read.c (read): Likewise.
+            * io/write.c (write): Likewise.
+            * sysdeps/mach/hurd/write.c (write): Likewise.
+            * io/pread64.c (__pread64): Likewise.
+            * sysdeps/mach/hurd/pread64.c (__pread64): Likewise.
+            * posix/pread64.c (__pread64): Add libc_hidden_def.
+
+diff --git a/io/read.c b/io/read.c
+index 2f7b6743f7..7537dd759d 100644
+--- a/io/read.c
++++ b/io/read.c
+@@ -45,3 +45,4 @@ stub_warning (read)
+ weak_alias (__libc_read, __read)
+ libc_hidden_weak (__read)
+ weak_alias (__libc_read, read)
++libc_hidden_weak (read)
+diff --git a/io/write.c b/io/write.c
+index cb413c76f9..931f837dfa 100644
+--- a/io/write.c
++++ b/io/write.c
+@@ -46,3 +46,4 @@ stub_warning (write)
+ weak_alias (__libc_write, __write)
+ libc_hidden_weak (__write)
+ weak_alias (__libc_write, write)
++libc_hidden_weak (write)
+diff --git a/posix/pread64.c b/posix/pread64.c
+index c20e75c7a8..9ff06d99bf 100644
+--- a/posix/pread64.c
++++ b/posix/pread64.c
+@@ -40,5 +40,6 @@ __libc_pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
+   return -1;
+ }
+ strong_alias (__libc_pread64, __pread64)
++libc_hidden_def (__pread64)
+ weak_alias (__libc_pread64, pread64)
+ stub_warning (pread64)
+diff --git a/sysdeps/mach/hurd/pread64.c b/sysdeps/mach/hurd/pread64.c
+index c4a61c92e2..903304956c 100644
+--- a/sysdeps/mach/hurd/pread64.c
++++ b/sysdeps/mach/hurd/pread64.c
+@@ -34,5 +34,6 @@ __libc_pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
+ 
+ #ifndef __libc_pread64
+ weak_alias (__libc_pread64, __pread64)
++libc_hidden_weak (__pread64)
+ weak_alias (__libc_pread64, pread64)
+ #endif
+diff --git a/sysdeps/mach/hurd/read.c b/sysdeps/mach/hurd/read.c
+index 5cef0b415f..776a7a5610 100644
+--- a/sysdeps/mach/hurd/read.c
++++ b/sysdeps/mach/hurd/read.c
+@@ -30,3 +30,4 @@ libc_hidden_def (__libc_read)
+ weak_alias (__libc_read, __read)
+ libc_hidden_weak (__read)
+ weak_alias (__libc_read, read)
++libc_hidden_weak (read)
+diff --git a/sysdeps/mach/hurd/write.c b/sysdeps/mach/hurd/write.c
+index bfa96735e2..32f4905df1 100644
+--- a/sysdeps/mach/hurd/write.c
++++ b/sysdeps/mach/hurd/write.c
+@@ -30,3 +30,4 @@ libc_hidden_def (__libc_write)
+ weak_alias (__libc_write, __write)
+ libc_hidden_weak (__write)
+ weak_alias (__libc_write, write)
++libc_hidden_weak (write)
+diff --git a/sysdeps/posix/pread64.c b/sysdeps/posix/pread64.c
+index f28ef31329..68ef9cbbcc 100644
+--- a/sysdeps/posix/pread64.c
++++ b/sysdeps/posix/pread64.c
+@@ -58,5 +58,6 @@ __libc_pread64 (int fd, void *buf, size_t nbyte, off64_t offset)
+ 
+ #ifndef __libc_pread64
+ weak_alias (__libc_pread64, __pread64)
++libc_hidden_weak (__pread64)
+ weak_alias (__libc_pread64, pread64)
+ #endif
diff --git a/debian/patches/hurd-i386/git-hidden-def.diff b/debian/patches/hurd-i386/git-hidden-def.diff
new file mode 100644
index 0000000..d63534d
--- /dev/null
+++ b/debian/patches/hurd-i386/git-hidden-def.diff
@@ -0,0 +1,136 @@
+commit a166531fdf601560a0005479427f60d3173f8257
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date:   Tue Sep 12 01:34:19 2017 +0200
+
+    hurd: Fix build without NO_HIDDEN
+    
+            * posix/sched_primax.c (__sched_get_priority_max): Add
+            libc_hidden_def.
+            * posix/sched_primin.c (__sched_get_priority_min): Likewise.
+            * sysdeps/mach/hurd/mmap.c (__mmap): Likewise.
+            * sysdeps/mach/hurd/mmap64.c (__mmap64): Likewise.
+            * sysdeps/mach/hurd/mprotect.c (__mprotect): Likewise.
+            * sysdeps/mach/hurd/munmap.c (__munmap): Likewise.
+            * sysdeps/mach/hurd/dl-sysdep.c (__GI___getpid,
+            __GI___strtoul_internal, __GI_____strtoul_internal, __GI___chk_fail,
+            __GI___fortify_fail, __GI___assert_fail, __GI___assert_perror_fail):
+            Add aliases.
+
+Index: glibc-2.26/posix/sched_primax.c
+===================================================================
+--- glibc-2.26.orig/posix/sched_primax.c
++++ glibc-2.26/posix/sched_primax.c
+@@ -26,6 +26,7 @@ __sched_get_priority_max (int algorithm)
+   __set_errno (ENOSYS);
+   return -1;
+ }
++libc_hidden_def (__sched_get_priority_max)
+ stub_warning (sched_get_priority_max)
+ 
+ weak_alias (__sched_get_priority_max, sched_get_priority_max)
+Index: glibc-2.26/posix/sched_primin.c
+===================================================================
+--- glibc-2.26.orig/posix/sched_primin.c
++++ glibc-2.26/posix/sched_primin.c
+@@ -26,6 +26,7 @@ __sched_get_priority_min (int algorithm)
+   __set_errno (ENOSYS);
+   return -1;
+ }
++libc_hidden_def (__sched_get_priority_min)
+ stub_warning (sched_get_priority_min)
+ 
+ weak_alias (__sched_get_priority_min, sched_get_priority_min)
+Index: glibc-2.26/sysdeps/mach/hurd/mmap.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/mmap.c
++++ glibc-2.26/sysdeps/mach/hurd/mmap.c
+@@ -162,4 +162,5 @@ __mmap (__ptr_t addr, size_t len, int pr
+   return (__ptr_t) mapaddr;
+ }
+ 
++libc_hidden_def (__mmap)
+ weak_alias (__mmap, mmap)
+Index: glibc-2.26/sysdeps/mach/hurd/mmap64.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/mmap64.c
++++ glibc-2.26/sysdeps/mach/hurd/mmap64.c
+@@ -44,4 +44,5 @@ __mmap64 (__ptr_t addr, size_t len, int
+   return __mmap (addr, len, prot, flags, fd, small_offset);
+ }
+ 
++libc_hidden_def (__mmap64)
+ weak_alias (__mmap64, mmap64)
+Index: glibc-2.26/sysdeps/mach/munmap.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/munmap.c
++++ glibc-2.26/sysdeps/mach/munmap.c
+@@ -43,4 +43,5 @@ __munmap (__ptr_t addr, size_t len)
+   return 0;
+ }
+ 
++libc_hidden_def (__munmap)
+ weak_alias (__munmap, munmap)
+Index: glibc-2.26/sysdeps/mach/mprotect.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/mprotect.c
++++ glibc-2.26/sysdeps/mach/mprotect.c
+@@ -47,4 +47,5 @@ __mprotect (__ptr_t addr, size_t len, in
+     }
+   return 0;
+ }
++libc_hidden_def (__mprotect)
+ weak_alias (__mprotect, mprotect)
+Index: glibc-2.26/sysdeps/mach/hurd/dl-sysdep.c
+===================================================================
+--- glibc-2.26.orig/sysdeps/mach/hurd/dl-sysdep.c
++++ glibc-2.26/sysdeps/mach/hurd/dl-sysdep.c
+@@ -577,6 +577,10 @@ __getpid (void)
+   return pid;
+ }
+ 
++/* We need this alias to satisfy references from libc_pic.a objects
++   that were affected by the libc_hidden_proto declaration for __getpid.  */
++strong_alias (__getpid, __GI___getpid)
++
+ /* This is called only in some strange cases trying to guess a value
+    for $ORIGIN for the executable.  The dynamic linker copes with
+    getcwd failing (dl-object.c), and it's too much hassle to include
+@@ -611,6 +615,11 @@ __strtoul_internal (const char *nptr, ch
+   return _dl_strtoul (nptr, endptr);
+ }
+ 
++/* We need this alias to satisfy references from libc_pic.a objects
++   that were affected by the libc_hidden_proto declaration for __strtoul_internal.  */
++strong_alias (__strtoul_internal, __GI___strtoul_internal)
++strong_alias (__strtoul_internal, __GI_____strtoul_internal)
++
+ void weak_function attribute_hidden
+ _exit (int status)
+ {
+@@ -649,6 +658,10 @@ abort (void)
+ /* We need this alias to satisfy references from libc_pic.a objects
+    that were affected by the libc_hidden_proto declaration for abort.  */
+ strong_alias (abort, __GI_abort)
++strong_alias (abort, __GI___chk_fail)
++strong_alias (abort, __GI___fortify_fail)
++strong_alias (abort, __GI___assert_fail)
++strong_alias (abort, __GI___assert_perror_fail)
+ 
+ /* This function is called by interruptible RPC stubs.  For initial
+    dynamic linking, just use the normal mach_msg.  Since this defn is
+Index: glibc-2.26/sysdeps/i386/dl-tlsdesc.S
+===================================================================
+--- glibc-2.26.orig/sysdeps/i386/dl-tlsdesc.S
++++ glibc-2.26/sysdeps/i386/dl-tlsdesc.S
+@@ -126,7 +126,11 @@ _dl_tlsdesc_dynamic:
+ 	.p2align 4,,7
+ .Lslow:
+ 	cfi_adjust_cfa_offset (28)
++#ifdef NO_RTLD_HIDDEN
++	call	JUMPTARGET (___tls_get_addr)
++#else
+ 	call	HIDDEN_JUMPTARGET (___tls_get_addr)
++#endif
+ 	jmp	.Lret
+ 	cfi_endproc
+ 	.size	_dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic
diff --git a/debian/patches/series b/debian/patches/series
index afa2ccb..3d424a6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -157,6 +157,9 @@ hurd-i386/git-tst-udp-timeout.diff
 hurd-i386/git-tst-udp-nonblocking.diff
 hurd-i386/submitted-resolv.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
 
 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: