]>
Commit | Line | Data |
---|---|---|
bb330e25 AF |
1 | # |
2 | # In rhel-6.x the Makerules are not entirely as mature as they are | |
3 | # in glibc 2.21 (from which the example link-libc-args is taken from). | |
4 | # In rhel-6.x the applications are not built like their counterpart | |
5 | # real applications, and because of that compiling DSOs that use TLS | |
6 | # will fail with undefined references to __tls_get_addr which resides | |
7 | # in ld.so and is never included in the link. This patch enhances | |
8 | # only the build-module and build-module-asneeded targets to include | |
9 | # a more fully and correct link line as the compiler driver would use | |
10 | # when constructing an application or DSO. We do not adjust the link | |
11 | # lines used to build lib* targets. | |
12 | # | |
13 | diff -urN glibc-2.12-2-gc4ccff1.orig/Makerules glibc-2.12-2-gc4ccff1/Makerules | |
14 | --- glibc-2.12-2-gc4ccff1.orig/Makerules 2015-02-18 19:53:00.000000000 -0500 | |
15 | +++ glibc-2.12-2-gc4ccff1/Makerules 2015-02-18 20:08:33.299000028 -0500 | |
16 | @@ -443,6 +443,25 @@ | |
17 | load-map-file = $(map-file:%=-Wl,--version-script=%) | |
18 | endif | |
19 | ||
20 | +# Compiler arguments to use to link a shared object with libc and | |
21 | +# ld.so. This is intended to be as similar as possible to a default | |
22 | +# link with an installed libc. | |
23 | +link-libc-args = -Wl,--start-group \ | |
24 | + $(libc-for-link) \ | |
25 | + $(common-objpfx)libc_nonshared.a \ | |
26 | + $(as-needed) $(elf-objpfx)ld.so $(no-as-needed) \ | |
27 | + -Wl,--end-group | |
28 | + | |
29 | +# The corresponding shared libc to use. This may be modified for a | |
30 | +# particular target. | |
31 | +libc-for-link = $(common-objpfx)libc.so | |
32 | + | |
33 | +# The corresponding dependencies. As these are used in dependencies, | |
34 | +# not just commands, they cannot use target-specific variables so need | |
35 | +# to name both possible libc.so objects. | |
36 | +link-libc-deps = $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so \ | |
37 | + $(common-objpfx)libc_nonshared.a $(elf-objpfx)ld.so | |
38 | + | |
39 | # Pattern rule to build a shared object from an archive of PIC objects. | |
40 | # This must come after the installation rules so Make doesn't try to | |
41 | # build shared libraries in place from the installed *_pic.a files. | |
42 | @@ -557,12 +576,13 @@ | |
43 | # not for shared objects | |
44 | define build-module | |
45 | $(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \ | |
46 | - $(csu-objpfx)abi-note.o $(build-module-objlist) | |
47 | + $(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args) | |
48 | endef | |
49 | define build-module-asneeded | |
50 | $(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \ | |
51 | $(csu-objpfx)abi-note.o \ | |
52 | - -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed | |
53 | + -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \ | |
54 | + $(link-libc-args) | |
55 | endef | |
56 | else | |
57 | ifneq (,$(findstring aix,$(config-os))) |