1 |
commit: cbd2a52033efd9a333508d5cd9bd35bd00a2c06b |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 28 18:23:57 2015 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Dec 28 18:31:07 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbd2a520 |
7 |
|
8 |
sys-libs/glibc: workaround ia64 early ldso crashes #503838 |
9 |
|
10 |
.../2.19/glibc-2.19-ia64-gcc-4.8-reloc-hack.patch | 32 ++++++++++++++++++++++ |
11 |
sys-libs/glibc/glibc-2.19-r1.ebuild | 5 +++- |
12 |
sys-libs/glibc/glibc-2.20-r2.ebuild | 2 ++ |
13 |
sys-libs/glibc/glibc-2.21-r1.ebuild | 2 ++ |
14 |
sys-libs/glibc/glibc-2.22-r1.ebuild | 2 ++ |
15 |
5 files changed, 42 insertions(+), 1 deletion(-) |
16 |
|
17 |
diff --git a/sys-libs/glibc/files/2.19/glibc-2.19-ia64-gcc-4.8-reloc-hack.patch b/sys-libs/glibc/files/2.19/glibc-2.19-ia64-gcc-4.8-reloc-hack.patch |
18 |
new file mode 100644 |
19 |
index 0000000..72a616a |
20 |
--- /dev/null |
21 |
+++ b/sys-libs/glibc/files/2.19/glibc-2.19-ia64-gcc-4.8-reloc-hack.patch |
22 |
@@ -0,0 +1,32 @@ |
23 |
+https://bugs.gentoo.org/503838 |
24 |
+http://gcc.gnu.org/PR60465 |
25 |
+https://sourceware.org/ml/libc-alpha/2015-12/msg00556.html |
26 |
+https://trofi.github.io/posts/189-glibc-on-ia64-or-how-relocations-bootstrap.html |
27 |
+ |
28 |
+newer versions of gcc generate relocations in the elf_get_dynamic_info func |
29 |
+which glibc relies on to populate some info structs. those structs are then |
30 |
+used by ldso to process relocations in itself. glibc requires that there are |
31 |
+no relocations until that point (*after* elf_get_dynamic_info), so we end up |
32 |
+crashing during elf_get_dynamic_info because the relocation has not yet been |
33 |
+processed. |
34 |
+ |
35 |
+this hack shuffles the code in a way that tricks gcc into not generating the |
36 |
+relocation. we need to figure out something better for upstream. |
37 |
+ |
38 |
+--- a/elf/get-dynamic-info.h |
39 |
++++ b/elf/get-dynamic-info.h |
40 |
+@@ -66,8 +66,12 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp) |
41 |
+ info[DT_VALTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM |
42 |
+ + DT_VERSIONTAGNUM + DT_EXTRANUM] = dyn; |
43 |
+ else if ((d_tag_utype) DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM) |
44 |
+- info[DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM |
45 |
+- + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn; |
46 |
++ { |
47 |
++ d_tag_utype i = |
48 |
++ DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM |
49 |
++ + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM; |
50 |
++ info[i] = dyn; |
51 |
++ } |
52 |
+ ++dyn; |
53 |
+ } |
54 |
+ |
55 |
|
56 |
diff --git a/sys-libs/glibc/glibc-2.19-r1.ebuild b/sys-libs/glibc/glibc-2.19-r1.ebuild |
57 |
index a683fa5..998b7fd 100644 |
58 |
--- a/sys-libs/glibc/glibc-2.19-r1.ebuild |
59 |
+++ b/sys-libs/glibc/glibc-2.19-r1.ebuild |
60 |
@@ -157,8 +157,11 @@ eblit-src_unpack-pre() { |
61 |
} |
62 |
|
63 |
eblit-src_unpack-post() { |
64 |
+ cd "${S}" |
65 |
+ |
66 |
+ epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838 |
67 |
+ |
68 |
if use hardened ; then |
69 |
- cd "${S}" |
70 |
einfo "Patching to get working PIE binaries on PIE (hardened) platforms" |
71 |
gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch |
72 |
epatch "${FILESDIR}"/2.19/glibc-2.19-hardened-configure-picdefault.patch |
73 |
|
74 |
diff --git a/sys-libs/glibc/glibc-2.20-r2.ebuild b/sys-libs/glibc/glibc-2.20-r2.ebuild |
75 |
index 8280980..0ea96b2 100644 |
76 |
--- a/sys-libs/glibc/glibc-2.20-r2.ebuild |
77 |
+++ b/sys-libs/glibc/glibc-2.20-r2.ebuild |
78 |
@@ -160,6 +160,8 @@ eblit-src_unpack-pre() { |
79 |
eblit-src_prepare-post() { |
80 |
cd "${S}" |
81 |
|
82 |
+ epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838 |
83 |
+ |
84 |
if use hardened ; then |
85 |
einfo "Patching to get working PIE binaries on PIE (hardened) platforms" |
86 |
gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch |
87 |
|
88 |
diff --git a/sys-libs/glibc/glibc-2.21-r1.ebuild b/sys-libs/glibc/glibc-2.21-r1.ebuild |
89 |
index 9963ae3..3dcbb52 100644 |
90 |
--- a/sys-libs/glibc/glibc-2.21-r1.ebuild |
91 |
+++ b/sys-libs/glibc/glibc-2.21-r1.ebuild |
92 |
@@ -160,6 +160,8 @@ eblit-src_unpack-pre() { |
93 |
eblit-src_prepare-post() { |
94 |
cd "${S}" |
95 |
|
96 |
+ epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838 |
97 |
+ |
98 |
if use hardened ; then |
99 |
einfo "Patching to get working PIE binaries on PIE (hardened) platforms" |
100 |
gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch |
101 |
|
102 |
diff --git a/sys-libs/glibc/glibc-2.22-r1.ebuild b/sys-libs/glibc/glibc-2.22-r1.ebuild |
103 |
index d6f6033..6e41fa9 100644 |
104 |
--- a/sys-libs/glibc/glibc-2.22-r1.ebuild |
105 |
+++ b/sys-libs/glibc/glibc-2.22-r1.ebuild |
106 |
@@ -163,6 +163,8 @@ eblit-src_unpack-pre() { |
107 |
eblit-src_prepare-post() { |
108 |
cd "${S}" |
109 |
|
110 |
+ epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838 |
111 |
+ |
112 |
if use hardened ; then |
113 |
# We don't enable these for non-hardened as the output is very terse -- |
114 |
# it only states that a crash happened. The default upstream behavior |