olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone
00db10
#
00db10
# In rhel-6.x the Makerules are not entirely as mature as they are
00db10
# in glibc 2.21 (from which the example link-libc-args is taken from).
00db10
# In rhel-6.x the applications are not built like their counterpart
00db10
# real applications, and because of that compiling DSOs that use TLS
00db10
# will fail with undefined references to __tls_get_addr which resides
00db10
# in ld.so and is never included in the link. This patch enhances
00db10
# only the build-module and build-module-asneeded targets to include
00db10
# a more fully and correct link line as the compiler driver would use
00db10
# when constructing an application or DSO. We do not adjust the link
00db10
# lines used to build lib* targets.
00db10
#
00db10
# The rest of this patch is brought in by glibc-rh1292018-0a.patch
00db10
# where we need to link against ld.so from libm.so.
00db10
#
00db10
00db10
commit fab7ce3f5b4060bf62659e8b58529de4156b5a2f
00db10
Author: Joseph Myers <joseph@codesourcery.com>
00db10
Date:   Fri May 31 16:16:33 2013 +0000
00db10
00db10
    Link extra-libs consistently with libc and ld.so.
00db10
00db10
diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules
00db10
--- glibc-2.17-c758a686/Makerules	2015-02-18 19:53:00.000000000 -0500
00db10
+++ glibc-2.17-c758a686/Makerules	2015-02-18 20:08:33.299000028 -0500
00db10
@@ -437,6 +437,25 @@
00db10
 load-map-file = $(map-file:%=-Wl,--version-script=%)
00db10
 endif
00db10
 
00db10
+# Compiler arguments to use to link a shared object with libc and
00db10
+# ld.so.  This is intended to be as similar as possible to a default
00db10
+# link with an installed libc.
00db10
+link-libc-args = -Wl,--start-group \
00db10
+                 $(libc-for-link) \
00db10
+                 $(common-objpfx)libc_nonshared.a \
00db10
+                 $(as-needed) $(elf-objpfx)ld.so $(no-as-needed) \
00db10
+                 -Wl,--end-group
00db10
+
00db10
+# The corresponding shared libc to use.  This may be modified for a
00db10
+# particular target.
00db10
+libc-for-link = $(common-objpfx)libc.so
00db10
+
00db10
+# The corresponding dependencies.  As these are used in dependencies,
00db10
+# not just commands, they cannot use target-specific variables so need
00db10
+# to name both possible libc.so objects.
00db10
+link-libc-deps = $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so \
00db10
+                 $(common-objpfx)libc_nonshared.a $(elf-objpfx)ld.so
00db10
+
00db10
 # Pattern rule to build a shared object from an archive of PIC objects.
00db10
 # This must come after the installation rules so Make doesn't try to
00db10
 # build shared libraries in place from the installed *_pic.a files.
00db10
@@ -518,12 +537,13 @@
00db10
 # not for shared objects
00db10
 define build-module
00db10
 $(build-module-helper) -o $@ $(shlib-lds-flags) \
00db10
-	  $(csu-objpfx)abi-note.o $(build-module-objlist)
00db10
+	  $(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args)
00db10
 endef
00db10
 define build-module-asneeded
00db10
 $(build-module-helper) -o $@ $(shlib-lds-flags) \
00db10
 	  $(csu-objpfx)abi-note.o \
00db10
-	  -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed
00db10
+	  -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \
00db10
+	  $(link-libc-args)
00db10
 endef
00db10
 
00db10
 build-module-helper-objlist = \