arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-rh1256317-0.patch

147e83
commit ac63a0783cdee8454c84fc45f37330d98b6039e7
147e83
Author: Dmitry V. Levin <ldv@altlinux.org>
147e83
Date:   Fri Jun 5 22:20:13 2015 +0000
147e83
147e83
    Prepare for restoration of .interp section in libpthread.so
147e83
    
147e83
    Make runtime-linker.h available outside $(elf-objpfx) by moving
147e83
    the file to $(common-objpfx) and the rules for it to Makerules.
147e83
    
147e83
    Tested for x86_64 and x86 (testsuite, and that no compiled code
147e83
    changed by the patch).
147e83
    
147e83
    * Makeconfig (+interp): Remove unused variable.
147e83
    * elf/Makefile ($(objpfx)interp.os): Define for [$(build-shared) = yes]
147e83
    only.  Depend on $(common-objpfx)runtime-linker.h instead of
147e83
    $(elf-objpfx)runtime-linker.h.
147e83
    ($(elf-objpfx)runtime-linker.h): Rename to
147e83
    $(common-objpfx)runtime-linker.h and move ...
147e83
    * Makerules [$(build-shared) = yes]: ... here.
147e83
    * elf/interp.c: Include <runtime-linker.h> instead of
147e83
    <elf/runtime-linker.h>.
147e83
147e83
commit 78ad175b3060aae058ed5d05ced2bc58714901cd
147e83
Author: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
147e83
Date:   Tue Jun 2 21:04:06 2015 +0300
147e83
147e83
    nptl: restore .interp section in libpthread.so
147e83
    
147e83
    In commit 02657da2cf4457804ed938ee08b8316249126444, .interp section
147e83
    was removed from libpthread.so.  This led to an error:
147e83
    
147e83
      $ /lib64/libpthread.so.0
147e83
      Native POSIX Threads Library by Ulrich Drepper et al
147e83
      Copyright (C) 2015 Free Software Foundation, Inc.
147e83
      This is free software; see the source for copying conditions.
147e83
      There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
147e83
      PARTICULAR PURPOSE.
147e83
      Forced unwind support included.
147e83
      Segmentation fault
147e83
    
147e83
      (gdb) bt
147e83
      #0  0x00000000000055a6 in _exit@plt ()
147e83
    
147e83
    Unfortunately, there is no way to add a regression test for the bug
147e83
    because .interp specifies the path to dynamic linker of the target
147e83
    system.
147e83
    
147e83
    [BZ #18479]
147e83
    * nptl/pt-interp.c: New file.
147e83
    * nptl/Makefile (libpthread-routines, libpthread-shared-only-routines):
147e83
    Add pt-interp.
147e83
    [$(build-shared) = yes] ($(objpfx)pt-interp.os): Depend on
147e83
    $(common-objpfx)runtime-linker.h.
147e83
147e83
Index: glibc-2.17-c758a686/nptl/Makefile
147e83
===================================================================
147e83
--- glibc-2.17-c758a686.orig/nptl/Makefile
147e83
+++ glibc-2.17-c758a686/nptl/Makefile
147e83
@@ -30,7 +30,7 @@ routines = alloca_cutoff forward libc-lo
147e83
 	   libc-cleanup
147e83
 shared-only-routines = forward
147e83
 
147e83
-libpthread-routines = nptl-init vars events version \
147e83
+libpthread-routines = nptl-init vars events version pt-interp \
147e83
 		      pthread_create pthread_exit pthread_detach \
147e83
 		      pthread_join pthread_tryjoin pthread_timedjoin \
147e83
 		      pthread_self pthread_equal pthread_yield \
147e83
@@ -131,7 +131,8 @@ libpthread-routines = nptl-init vars eve
147e83
 #		      pthread_setgid pthread_setegid pthread_setregid \
147e83
 #		      pthread_setresgid
147e83
 
147e83
-libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
147e83
+libpthread-shared-only-routines = version pt-interp pt-allocrtsig \
147e83
+				  unwind-forcedunwind
147e83
 libpthread-static-only-routines = pthread_atfork
147e83
 
147e83
 # Since cancellation handling is in large parts handled using exceptions
147e83
@@ -591,6 +592,8 @@ $(objpfx)banner.h: Banner
147e83
 generated += banner.h
147e83
 # Give libpthread.so an entry point and make it directly runnable itself.
147e83
 LDFLAGS-pthread.so += -e __nptl_main
147e83
+# pt-interp.c exists just to get the runtime linker path into libpthread.so.
147e83
+$(objpfx)pt-interp.os: $(common-objpfx)runtime-linker.h
147e83
 endif
147e83
 
147e83
 ifeq ($(run-built-tests),yes)
147e83
Index: glibc-2.17-c758a686/nptl/pt-interp.c
147e83
===================================================================
147e83
--- /dev/null
147e83
+++ glibc-2.17-c758a686/nptl/pt-interp.c
147e83
@@ -0,0 +1 @@
147e83
+#include <elf/interp.c>
147e83
Index: glibc-2.17-c758a686/Makeconfig
147e83
===================================================================
147e83
--- glibc-2.17-c758a686.orig/Makeconfig
147e83
+++ glibc-2.17-c758a686/Makeconfig
147e83
@@ -566,7 +566,6 @@ endif
147e83
 # Variants of the two previous definitions for statically linking programs.
147e83
 +prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
147e83
 +postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
147e83
-+interp = $(addprefix $(elf-objpfx),interp.os)
147e83
 csu-objpfx = $(common-objpfx)csu/
147e83
 elf-objpfx = $(common-objpfx)elf/
147e83
 
147e83
Index: glibc-2.17-c758a686/elf/Makefile
147e83
===================================================================
147e83
--- glibc-2.17-c758a686.orig/elf/Makefile
147e83
+++ glibc-2.17-c758a686/elf/Makefile
147e83
@@ -344,16 +344,10 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld
147e83
 	$(READELF) -s $@ \
147e83
 	  | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
147e83
 
147e83
+ifeq (yes,$(build-shared))
147e83
 # interp.c exists just to get the runtime linker path into libc.so.
147e83
-$(objpfx)interp.os: $(elf-objpfx)runtime-linker.h
147e83
-
147e83
-$(elf-objpfx)runtime-linker.h: $(elf-objpfx)runtime-linker.st; @:
147e83
-$(elf-objpfx)runtime-linker.st: $(common-objpfx)config.make
147e83
-	$(name-target-directory)
147e83
-	echo '#define RUNTIME_LINKER "$(rtlddir)/$(rtld-installed-name)"' \
147e83
-		> ${@:st=T}
147e83
-	$(move-if-change) ${@:st=T} ${@:st=h}
147e83
-	touch $@
147e83
+$(objpfx)interp.os: $(common-objpfx)runtime-linker.h
147e83
+endif
147e83
 
147e83
 ifneq (ld.so,$(rtld-installed-name))
147e83
 # Make sure ld.so.1 exists in the build directory so we can link
147e83
Index: glibc-2.17-c758a686/elf/interp.c
147e83
===================================================================
147e83
--- glibc-2.17-c758a686.orig/elf/interp.c
147e83
+++ glibc-2.17-c758a686/elf/interp.c
147e83
@@ -16,7 +16,7 @@
147e83
    License along with the GNU C Library; if not, see
147e83
    <http://www.gnu.org/licenses/>.  */
147e83
 
147e83
-#include <elf/runtime-linker.h>
147e83
+#include <runtime-linker.h>
147e83
 
147e83
 const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp")))
147e83
   = RUNTIME_LINKER;
147e83
Index: glibc-2.17-c758a686/Makerules
147e83
===================================================================
147e83
--- glibc-2.17-c758a686.orig/Makerules
147e83
+++ glibc-2.17-c758a686/Makerules
147e83
@@ -123,6 +123,16 @@ $(common-objpfx)libc-abis.stamp: $(..)sc
147e83
 common-generated += $(common-objpfx)libc-abis.h
147e83
 endif # avoid-generated
147e83
 
147e83
+ifeq (yes,$(build-shared))
147e83
+$(common-objpfx)runtime-linker.h: $(common-objpfx)runtime-linker.stamp; @:
147e83
+$(common-objpfx)runtime-linker.stamp: $(common-objpfx)config.make
147e83
+	$(make-target-directory)
147e83
+	echo '#define RUNTIME_LINKER "$(rtlddir)/$(rtld-installed-name)"' \
147e83
+		> ${@:stamp=T}
147e83
+	$(move-if-change) ${@:stamp=T} ${@:stamp=h}
147e83
+	touch $@
147e83
+endif
147e83
+
147e83
 # Make sure the subdirectory for object files gets created.
147e83
 ifdef objpfx
147e83
 ifeq (,$(wildcard $(objpfx).))