1 |
commit: 0a4c5e8d86b6cef5b24b5a0cdea494f9857531a0 |
2 |
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jul 2 20:22:39 2021 +0000 |
4 |
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 2 22:01:27 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a4c5e8d |
7 |
|
8 |
dev-util/valgrind: Add patch to support linking with LLD |
9 |
|
10 |
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org> |
11 |
|
12 |
dev-util/valgrind/files/valgrind-3.17.0-lld.patch | 77 +++++++++++++++++++++++ |
13 |
dev-util/valgrind/valgrind-3.17.0.ebuild | 2 + |
14 |
2 files changed, 79 insertions(+) |
15 |
|
16 |
diff --git a/dev-util/valgrind/files/valgrind-3.17.0-lld.patch b/dev-util/valgrind/files/valgrind-3.17.0-lld.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..56a7c0f72f4 |
19 |
--- /dev/null |
20 |
+++ b/dev-util/valgrind/files/valgrind-3.17.0-lld.patch |
21 |
@@ -0,0 +1,77 @@ |
22 |
+https://bugs.kde.org/show_bug.cgi?id=439046 |
23 |
+--- |
24 |
+diff --git a/configure.ac b/configure.ac |
25 |
+index 4582fb5d0..63fd6c25e 100755 |
26 |
+--- a/configure.ac |
27 |
++++ b/configure.ac |
28 |
+@@ -2639,30 +2639,52 @@ CFLAGS=$safe_CFLAGS |
29 |
+ # will reside. -Ttext aligns just the .text section start (but not any |
30 |
+ # other section). |
31 |
+ # |
32 |
+-# So test for -Ttext-segment which is supported by all bfd ld versions |
33 |
++# LLVM ld.lld 10.0 changed the semantics of its -Ttext. See "Breaking changes" |
34 |
++# in https://releases.llvm.org/10.0.0/tools/lld/docs/ReleaseNotes.html |
35 |
++# The --image-base option (since version 6.0?) provides the semantics needed. |
36 |
++# -Ttext-segment generates an error, but -Ttext now more closely |
37 |
++# follows the GNU (bfd) ld's -Ttext. |
38 |
++# |
39 |
++# So test first for --image-base support, and if that fails then |
40 |
++# for -Ttext-segment which is supported by all bfd ld versions |
41 |
+ # and use that if it exists. If it doesn't exist it must be an older |
42 |
+ # version of gold and we can fall back to using -Ttext which has the |
43 |
+ # right semantics. |
44 |
+ |
45 |
+-AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment]) |
46 |
+- |
47 |
+ safe_CFLAGS=$CFLAGS |
48 |
+-CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror" |
49 |
++AC_MSG_CHECKING([if the linker accepts -Wl,--image-base]) |
50 |
++ |
51 |
++CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,--image-base=$valt_load_address_pri_norml -Werror" |
52 |
+ |
53 |
+ AC_LINK_IFELSE( |
54 |
+ [AC_LANG_SOURCE([int _start () { return 0; }])], |
55 |
+ [ |
56 |
+ linker_using_t_text="no" |
57 |
+- AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"]) |
58 |
++ AC_SUBST([FLAG_T_TEXT], ["--image-base"]) |
59 |
+ AC_MSG_RESULT([yes]) |
60 |
+ ], [ |
61 |
+- linker_using_t_text="yes" |
62 |
+- AC_SUBST([FLAG_T_TEXT], ["-Ttext"]) |
63 |
+ AC_MSG_RESULT([no]) |
64 |
++ |
65 |
++ AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment]) |
66 |
++ |
67 |
++ CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml -Werror" |
68 |
++ |
69 |
++ AC_LINK_IFELSE( |
70 |
++ [AC_LANG_SOURCE([int _start () { return 0; }])], |
71 |
++ [ |
72 |
++ linker_using_t_text="no" |
73 |
++ AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"]) |
74 |
++ AC_MSG_RESULT([yes]) |
75 |
++ ], [ |
76 |
++ linker_using_t_text="yes" |
77 |
++ AC_SUBST([FLAG_T_TEXT], ["-Ttext"]) |
78 |
++ AC_MSG_RESULT([no]) |
79 |
++ ]) |
80 |
+ ]) |
81 |
++ |
82 |
+ CFLAGS=$safe_CFLAGS |
83 |
+ |
84 |
+-# If the linker only supports -Ttext (not -Ttext-segment) then we will |
85 |
++# If the linker only supports -Ttext (not -Ttext-segment or --image-base) then we will |
86 |
+ # have to strip any build-id ELF NOTEs from the statically linked tools. |
87 |
+ # Otherwise the build-id NOTE might end up at the default load address. |
88 |
+ # (Pedantically if the linker is gold then -Ttext is fine, but newer |
89 |
+@@ -2688,7 +2710,7 @@ AC_LINK_IFELSE( |
90 |
+ AC_MSG_RESULT([no]) |
91 |
+ ]) |
92 |
+ else |
93 |
+-AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.]) |
94 |
++AC_MSG_NOTICE([ld --image-base or -Ttext-segment used, no need to strip build-id NOTEs.]) |
95 |
+ AC_SUBST([FLAG_NO_BUILD_ID], [""]) |
96 |
+ fi |
97 |
+ CFLAGS=$safe_CFLAGS |
98 |
+-- |
99 |
|
100 |
diff --git a/dev-util/valgrind/valgrind-3.17.0.ebuild b/dev-util/valgrind/valgrind-3.17.0.ebuild |
101 |
index 890f4104452..148f504a570 100644 |
102 |
--- a/dev-util/valgrind/valgrind-3.17.0.ebuild |
103 |
+++ b/dev-util/valgrind/valgrind-3.17.0.ebuild |
104 |
@@ -33,6 +33,8 @@ src_prepare() { |
105 |
|
106 |
eapply "${FILESDIR}"/${PN}-3.15.0-Build-ldst_multiple-test-with-fno-pie.patch |
107 |
|
108 |
+ eapply "${FILESDIR}"/${PN}-3.17.0-lld.patch |
109 |
+ |
110 |
if [[ ${CHOST} == *-solaris* ]] ; then |
111 |
# upstream doesn't support this, but we don't build with |
112 |
# Sun/Oracle ld, we have a GNU toolchain, so get some things |