diff options
author | Richard Purdie <richard@openedhand.com> | 2007-09-04 16:01:58 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-09-04 16:01:58 +0000 |
commit | 7d4aa7f04e661d0546569f2f5a581e44e447de84 (patch) | |
tree | f268a340e4fcb69d56c93e668269bd5ce2822811 /meta/packages/prelink | |
parent | 5758f9ccce20d3e1e5519cf689d39511a953600b (diff) | |
download | poky-7d4aa7f04e661d0546569f2f5a581e44e447de84.tar.gz |
prelink: Fix R_ARM_TLS_DTPMOD32 problems
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2688 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/prelink')
-rw-r--r-- | meta/packages/prelink/prelink-20061027/arm_eabi.patch | 75 | ||||
-rw-r--r-- | meta/packages/prelink/prelink_20061027.bb | 2 |
2 files changed, 42 insertions, 35 deletions
diff --git a/meta/packages/prelink/prelink-20061027/arm_eabi.patch b/meta/packages/prelink/prelink-20061027/arm_eabi.patch index b138b5a6d5..dbce9d2895 100644 --- a/meta/packages/prelink/prelink-20061027/arm_eabi.patch +++ b/meta/packages/prelink/prelink-20061027/arm_eabi.patch | |||
@@ -1,20 +1,22 @@ | |||
1 | --- | 1 | --- |
2 | src/arch-arm.c | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- | 2 | src/arch-arm.c | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- |
3 | 1 file changed, 165 insertions(+), 5 deletions(-) | 3 | 1 file changed, 172 insertions(+), 5 deletions(-) |
4 | 4 | ||
5 | Index: prelink-0.0.20061027/src/arch-arm.c | 5 | Index: prelink-0.0.20061027/src/arch-arm.c |
6 | =================================================================== | 6 | =================================================================== |
7 | --- prelink-0.0.20061027.orig/src/arch-arm.c 2006-08-13 16:18:17.000000000 +0100 | 7 | --- prelink-0.0.20061027.orig/src/arch-arm.c 2006-08-13 16:18:17.000000000 +0100 |
8 | +++ prelink-0.0.20061027/src/arch-arm.c 2007-01-14 00:05:33.000000000 +0000 | 8 | +++ prelink-0.0.20061027/src/arch-arm.c 2007-09-04 12:29:06.000000000 +0100 |
9 | @@ -145,6 +145,24 @@ arm_prelink_rel (struct prelink_info *in | 9 | @@ -145,6 +145,26 @@ arm_prelink_rel (struct prelink_info *in |
10 | error (0, 0, "%s: R_ARM_PC24 relocs with non-zero addend should not be present in prelinked REL sections", | 10 | error (0, 0, "%s: R_ARM_PC24 relocs with non-zero addend should not be present in prelinked REL sections", |
11 | dso->filename); | 11 | dso->filename); |
12 | return 1; | 12 | return 1; |
13 | + case R_ARM_TLS_DTPOFF32: | 13 | + /* DTPOFF32, DTPMOD32 and TPOFF32 is impossible to predict unless prelink |
14 | + write_le32 (dso, rel->r_offset, value); | 14 | + sets the rules. Also for DTPOFF32/TPOFF32 there is REL->RELA problem. */ |
15 | + case R_ARM_TLS_DTPOFF32: | ||
16 | + if (dso->ehdr.e_type == ET_EXEC) | ||
17 | + error (0, 0, "%s: R_ARM_TLS_DTPOFF32 relocs should not be present in prelinked ET_EXEC REL sections", | ||
18 | + dso->filename); | ||
15 | + break; | 19 | + break; |
16 | + /* DTPMOD32 and TPOFF32 is impossible to predict unless prelink | ||
17 | + sets the rules. Also for TPOFF{32,} there is REL->RELA problem. */ | ||
18 | + case R_ARM_TLS_DTPMOD32: | 20 | + case R_ARM_TLS_DTPMOD32: |
19 | + if (dso->ehdr.e_type == ET_EXEC) | 21 | + if (dso->ehdr.e_type == ET_EXEC) |
20 | + { | 22 | + { |
@@ -31,14 +33,15 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
31 | case R_ARM_COPY: | 33 | case R_ARM_COPY: |
32 | if (dso->ehdr.e_type == ET_EXEC) | 34 | if (dso->ehdr.e_type == ET_EXEC) |
33 | /* COPY relocs are handled specially in generic code. */ | 35 | /* COPY relocs are handled specially in generic code. */ |
34 | @@ -195,6 +213,24 @@ arm_prelink_rela (struct prelink_info *i | 36 | @@ -195,6 +215,25 @@ arm_prelink_rela (struct prelink_info *i |
35 | write_le32 (dso, rela->r_offset, | 37 | write_le32 (dso, rela->r_offset, |
36 | (read_ule32 (dso, rela->r_offset) & 0xff000000) | val); | 38 | (read_ule32 (dso, rela->r_offset) & 0xff000000) | val); |
37 | break; | 39 | break; |
38 | + case R_ARM_TLS_DTPOFF32: | 40 | + case R_ARM_TLS_DTPOFF32: |
39 | + write_le32 (dso, rela->r_offset, value + rela->r_addend); | 41 | + if (dso->ehdr.e_type == ET_EXEC) |
42 | + write_le32 (dso, rela->r_offset, value + rela->r_addend); | ||
40 | + break; | 43 | + break; |
41 | + /* DTPMOD32 and TPOFF32 is impossible to predict unless prelink | 44 | + /* DTPMOD32 and TPOFF32 are impossible to predict unless prelink |
42 | + sets the rules. */ | 45 | + sets the rules. */ |
43 | + case R_ARM_TLS_DTPMOD32: | 46 | + case R_ARM_TLS_DTPMOD32: |
44 | + if (dso->ehdr.e_type == ET_EXEC) | 47 | + if (dso->ehdr.e_type == ET_EXEC) |
@@ -56,7 +59,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
56 | case R_ARM_COPY: | 59 | case R_ARM_COPY: |
57 | if (dso->ehdr.e_type == ET_EXEC) | 60 | if (dso->ehdr.e_type == ET_EXEC) |
58 | /* COPY relocs are handled specially in generic code. */ | 61 | /* COPY relocs are handled specially in generic code. */ |
59 | @@ -315,6 +351,7 @@ arm_prelink_conflict_rel (DSO *dso, stru | 62 | @@ -315,6 +354,7 @@ arm_prelink_conflict_rel (DSO *dso, stru |
60 | { | 63 | { |
61 | GElf_Addr value; | 64 | GElf_Addr value; |
62 | struct prelink_conflict *conflict; | 65 | struct prelink_conflict *conflict; |
@@ -64,7 +67,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
64 | GElf_Rela *ret; | 67 | GElf_Rela *ret; |
65 | 68 | ||
66 | if (GELF_R_TYPE (rel->r_info) == R_ARM_RELATIVE | 69 | if (GELF_R_TYPE (rel->r_info) == R_ARM_RELATIVE |
67 | @@ -324,8 +361,31 @@ arm_prelink_conflict_rel (DSO *dso, stru | 70 | @@ -324,8 +364,32 @@ arm_prelink_conflict_rel (DSO *dso, stru |
68 | conflict = prelink_conflict (info, GELF_R_SYM (rel->r_info), | 71 | conflict = prelink_conflict (info, GELF_R_SYM (rel->r_info), |
69 | GELF_R_TYPE (rel->r_info)); | 72 | GELF_R_TYPE (rel->r_info)); |
70 | if (conflict == NULL) | 73 | if (conflict == NULL) |
@@ -75,8 +78,9 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
75 | + return 0; | 78 | + return 0; |
76 | + switch (GELF_R_TYPE (rel->r_info)) | 79 | + switch (GELF_R_TYPE (rel->r_info)) |
77 | + { | 80 | + { |
78 | + /* Even local DTPMOD and TPOFF relocs need conflicts. */ | 81 | + /* Even local DTPMOD and {D,}TPOFF relocs need conflicts. */ |
79 | + case R_ARM_TLS_DTPMOD32: | 82 | + case R_ARM_TLS_DTPMOD32: |
83 | + case R_ARM_TLS_DTPOFF32: | ||
80 | + case R_ARM_TLS_TPOFF32: | 84 | + case R_ARM_TLS_TPOFF32: |
81 | + break; | 85 | + break; |
82 | + default: | 86 | + default: |
@@ -98,7 +102,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
98 | ret = prelink_conflict_add_rela (info); | 102 | ret = prelink_conflict_add_rela (info); |
99 | if (ret == NULL) | 103 | if (ret == NULL) |
100 | return 1; | 104 | return 1; |
101 | @@ -342,6 +402,33 @@ arm_prelink_conflict_rel (DSO *dso, stru | 105 | @@ -342,6 +406,33 @@ arm_prelink_conflict_rel (DSO *dso, stru |
102 | error (0, 0, "%s: R_ARM_%s relocs should not be present in prelinked REL sections", | 106 | error (0, 0, "%s: R_ARM_%s relocs should not be present in prelinked REL sections", |
103 | dso->filename, GELF_R_TYPE (rel->r_info) == R_ARM_ABS32 ? "ABS32" : "PC24"); | 107 | dso->filename, GELF_R_TYPE (rel->r_info) == R_ARM_ABS32 ? "ABS32" : "PC24"); |
104 | return 1; | 108 | return 1; |
@@ -121,7 +125,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
121 | + ret->r_addend = tls->modid; | 125 | + ret->r_addend = tls->modid; |
122 | + break; | 126 | + break; |
123 | + case R_ARM_TLS_DTPOFF32: | 127 | + case R_ARM_TLS_DTPOFF32: |
124 | + ret->r_addend = value; | 128 | + ret->r_addend = value + read_ule32 (dso, rel->r_offset); |
125 | + break; | 129 | + break; |
126 | + case R_ARM_TLS_TPOFF32: | 130 | + case R_ARM_TLS_TPOFF32: |
127 | + ret->r_addend = value + read_ule32 (dso, rel->r_offset) | 131 | + ret->r_addend = value + read_ule32 (dso, rel->r_offset) |
@@ -132,7 +136,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
132 | case R_ARM_COPY: | 136 | case R_ARM_COPY: |
133 | error (0, 0, "R_ARM_COPY should not be present in shared libraries"); | 137 | error (0, 0, "R_ARM_COPY should not be present in shared libraries"); |
134 | return 1; | 138 | return 1; |
135 | @@ -359,6 +446,7 @@ arm_prelink_conflict_rela (DSO *dso, str | 139 | @@ -359,6 +450,7 @@ arm_prelink_conflict_rela (DSO *dso, str |
136 | { | 140 | { |
137 | GElf_Addr value; | 141 | GElf_Addr value; |
138 | struct prelink_conflict *conflict; | 142 | struct prelink_conflict *conflict; |
@@ -140,7 +144,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
140 | GElf_Rela *ret; | 144 | GElf_Rela *ret; |
141 | Elf32_Sword val; | 145 | Elf32_Sword val; |
142 | 146 | ||
143 | @@ -369,8 +457,31 @@ arm_prelink_conflict_rela (DSO *dso, str | 147 | @@ -369,8 +461,32 @@ arm_prelink_conflict_rela (DSO *dso, str |
144 | conflict = prelink_conflict (info, GELF_R_SYM (rela->r_info), | 148 | conflict = prelink_conflict (info, GELF_R_SYM (rela->r_info), |
145 | GELF_R_TYPE (rela->r_info)); | 149 | GELF_R_TYPE (rela->r_info)); |
146 | if (conflict == NULL) | 150 | if (conflict == NULL) |
@@ -151,8 +155,9 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
151 | + return 0; | 155 | + return 0; |
152 | + switch (GELF_R_TYPE (rela->r_info)) | 156 | + switch (GELF_R_TYPE (rela->r_info)) |
153 | + { | 157 | + { |
154 | + /* Even local DTPMOD and TPOFF relocs need conflicts. */ | 158 | + /* Even local DTPMOD and {D,}TPOFF relocs need conflicts. */ |
155 | + case R_ARM_TLS_DTPMOD32: | 159 | + case R_ARM_TLS_DTPMOD32: |
160 | + case R_ARM_TLS_DTPOFF32: | ||
156 | + case R_ARM_TLS_TPOFF32: | 161 | + case R_ARM_TLS_TPOFF32: |
157 | + break; | 162 | + break; |
158 | + default: | 163 | + default: |
@@ -174,7 +179,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
174 | ret = prelink_conflict_add_rela (info); | 179 | ret = prelink_conflict_add_rela (info); |
175 | if (ret == NULL) | 180 | if (ret == NULL) |
176 | return 1; | 181 | return 1; |
177 | @@ -398,6 +509,32 @@ arm_prelink_conflict_rela (DSO *dso, str | 182 | @@ -398,6 +514,32 @@ arm_prelink_conflict_rela (DSO *dso, str |
178 | case R_ARM_COPY: | 183 | case R_ARM_COPY: |
179 | error (0, 0, "R_ARM_COPY should not be present in shared libraries"); | 184 | error (0, 0, "R_ARM_COPY should not be present in shared libraries"); |
180 | return 1; | 185 | return 1; |
@@ -197,7 +202,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
197 | + ret->r_addend = tls->modid; | 202 | + ret->r_addend = tls->modid; |
198 | + break; | 203 | + break; |
199 | + case R_ARM_TLS_DTPOFF32: | 204 | + case R_ARM_TLS_DTPOFF32: |
200 | + ret->r_addend += value; | 205 | + ret->r_addend = value + rela->r_addend; |
201 | + break; | 206 | + break; |
202 | + case R_ARM_TLS_TPOFF32: | 207 | + case R_ARM_TLS_TPOFF32: |
203 | + ret->r_addend = value + rela->r_addend + tls->offset; | 208 | + ret->r_addend = value + rela->r_addend + tls->offset; |
@@ -207,68 +212,70 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
207 | default: | 212 | default: |
208 | error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, | 213 | error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, |
209 | (int) GELF_R_TYPE (rela->r_info)); | 214 | (int) GELF_R_TYPE (rela->r_info)); |
210 | @@ -418,6 +555,7 @@ arm_rel_to_rela (DSO *dso, GElf_Rel *rel | 215 | @@ -418,6 +560,8 @@ arm_rel_to_rela (DSO *dso, GElf_Rel *rel |
211 | abort (); | 216 | abort (); |
212 | case R_ARM_RELATIVE: | 217 | case R_ARM_RELATIVE: |
213 | case R_ARM_ABS32: | 218 | case R_ARM_ABS32: |
214 | + case R_ARM_TLS_TPOFF32: | 219 | + case R_ARM_TLS_TPOFF32: |
220 | + case R_ARM_TLS_DTPOFF32: | ||
215 | rela->r_addend = (Elf32_Sword) read_ule32 (dso, rel->r_offset); | 221 | rela->r_addend = (Elf32_Sword) read_ule32 (dso, rel->r_offset); |
216 | break; | 222 | break; |
217 | case R_ARM_PC24: | 223 | case R_ARM_PC24: |
218 | @@ -426,6 +564,8 @@ arm_rel_to_rela (DSO *dso, GElf_Rel *rel | 224 | @@ -426,6 +570,7 @@ arm_rel_to_rela (DSO *dso, GElf_Rel *rel |
219 | break; | 225 | break; |
220 | case R_ARM_COPY: | 226 | case R_ARM_COPY: |
221 | case R_ARM_GLOB_DAT: | 227 | case R_ARM_GLOB_DAT: |
222 | + case R_ARM_TLS_DTPOFF32: | ||
223 | + case R_ARM_TLS_DTPMOD32: | 228 | + case R_ARM_TLS_DTPMOD32: |
224 | rela->r_addend = 0; | 229 | rela->r_addend = 0; |
225 | break; | 230 | break; |
226 | } | 231 | } |
227 | @@ -445,6 +585,7 @@ arm_rela_to_rel (DSO *dso, GElf_Rela *re | 232 | @@ -445,6 +590,8 @@ arm_rela_to_rel (DSO *dso, GElf_Rela *re |
228 | abort (); | 233 | abort (); |
229 | case R_ARM_RELATIVE: | 234 | case R_ARM_RELATIVE: |
230 | case R_ARM_ABS32: | 235 | case R_ARM_ABS32: |
231 | + case R_ARM_TLS_TPOFF32: | 236 | + case R_ARM_TLS_TPOFF32: |
237 | + case R_ARM_TLS_DTPOFF32: | ||
232 | write_le32 (dso, rela->r_offset, rela->r_addend); | 238 | write_le32 (dso, rela->r_offset, rela->r_addend); |
233 | break; | 239 | break; |
234 | case R_ARM_PC24: | 240 | case R_ARM_PC24: |
235 | @@ -453,6 +594,8 @@ arm_rela_to_rel (DSO *dso, GElf_Rela *re | 241 | @@ -453,6 +600,7 @@ arm_rela_to_rel (DSO *dso, GElf_Rela *re |
236 | | ((rela->r_addend >> 2) & 0xffffff)); | 242 | | ((rela->r_addend >> 2) & 0xffffff)); |
237 | break; | 243 | break; |
238 | case R_ARM_GLOB_DAT: | 244 | case R_ARM_GLOB_DAT: |
239 | + case R_ARM_TLS_DTPMOD32: | 245 | + case R_ARM_TLS_DTPMOD32: |
240 | + case R_ARM_TLS_DTPOFF32: | ||
241 | write_le32 (dso, rela->r_offset, 0); | 246 | write_le32 (dso, rela->r_offset, 0); |
242 | break; | 247 | break; |
243 | } | 248 | } |
244 | @@ -488,6 +631,13 @@ arm_need_rel_to_rela (DSO *dso, int firs | 249 | @@ -488,6 +636,15 @@ arm_need_rel_to_rela (DSO *dso, int firs |
245 | /* FALLTHROUGH */ | 250 | /* FALLTHROUGH */ |
246 | case R_ARM_PC24: | 251 | case R_ARM_PC24: |
247 | return 1; | 252 | return 1; |
253 | + case R_ARM_TLS_DTPOFF32: | ||
248 | + case R_ARM_TLS_TPOFF32: | 254 | + case R_ARM_TLS_TPOFF32: |
249 | + /* In shared libraries TPOFF is changed always into | 255 | + /* In shared libraries {D,}TPOFF32 is changed always into |
250 | + conflicts, for executables we need to preserve | 256 | + conflicts, for executables we need to preserve |
251 | + original addend. */ | 257 | + original addend. */ |
252 | + if (dso->ehdr.e_type == ET_EXEC) | 258 | + if (dso->ehdr.e_type == ET_EXEC) { |
253 | + return 1; | 259 | + return 1; |
260 | + } | ||
254 | + break; | 261 | + break; |
255 | } | 262 | } |
256 | } | 263 | } |
257 | } | 264 | } |
258 | @@ -612,6 +762,12 @@ arm_undo_prelink_rel (DSO *dso, GElf_Rel | 265 | @@ -612,6 +769,12 @@ arm_undo_prelink_rel (DSO *dso, GElf_Rel |
259 | return 0; | 266 | return 0; |
260 | error (0, 0, "%s: R_ARM_COPY reloc in shared library?", dso->filename); | 267 | error (0, 0, "%s: R_ARM_COPY reloc in shared library?", dso->filename); |
261 | return 1; | 268 | return 1; |
262 | + case R_ARM_TLS_DTPMOD32: | 269 | + case R_ARM_TLS_DTPMOD32: |
263 | + case R_ARM_TLS_DTPOFF32: | ||
264 | + write_le32 (dso, rel->r_offset, 0); | 270 | + write_le32 (dso, rel->r_offset, 0); |
265 | + break; | 271 | + break; |
272 | + case R_ARM_TLS_DTPOFF32: | ||
266 | + case R_ARM_TLS_TPOFF32: | 273 | + case R_ARM_TLS_TPOFF32: |
267 | + break; | 274 | + break; |
268 | default: | 275 | default: |
269 | error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, | 276 | error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, |
270 | (int) GELF_R_TYPE (rel->r_info)); | 277 | (int) GELF_R_TYPE (rel->r_info)); |
271 | @@ -634,6 +790,10 @@ arm_reloc_class (int reloc_type) | 278 | @@ -634,6 +797,10 @@ arm_reloc_class (int reloc_type) |
272 | { | 279 | { |
273 | case R_ARM_COPY: return RTYPE_CLASS_COPY; | 280 | case R_ARM_COPY: return RTYPE_CLASS_COPY; |
274 | case R_ARM_JUMP_SLOT: return RTYPE_CLASS_PLT; | 281 | case R_ARM_JUMP_SLOT: return RTYPE_CLASS_PLT; |
@@ -279,7 +286,7 @@ Index: prelink-0.0.20061027/src/arch-arm.c | |||
279 | default: return RTYPE_CLASS_VALID; | 286 | default: return RTYPE_CLASS_VALID; |
280 | } | 287 | } |
281 | } | 288 | } |
282 | @@ -646,7 +806,7 @@ PL_ARCH = { | 289 | @@ -646,7 +813,7 @@ PL_ARCH = { |
283 | .R_JMP_SLOT = R_ARM_JUMP_SLOT, | 290 | .R_JMP_SLOT = R_ARM_JUMP_SLOT, |
284 | .R_COPY = R_ARM_COPY, | 291 | .R_COPY = R_ARM_COPY, |
285 | .R_RELATIVE = R_ARM_RELATIVE, | 292 | .R_RELATIVE = R_ARM_RELATIVE, |
diff --git a/meta/packages/prelink/prelink_20061027.bb b/meta/packages/prelink/prelink_20061027.bb index e00b9fd7d7..e93f1f2515 100644 --- a/meta/packages/prelink/prelink_20061027.bb +++ b/meta/packages/prelink/prelink_20061027.bb | |||
@@ -4,7 +4,7 @@ DESCRIPTION = " The prelink package contains a utility which modifies ELF shared | |||
4 | and executables, so that far fewer relocations need to be resolved at \ | 4 | and executables, so that far fewer relocations need to be resolved at \ |
5 | runtime and thus programs come up faster." | 5 | runtime and thus programs come up faster." |
6 | LICENSE = "GPL" | 6 | LICENSE = "GPL" |
7 | PR = "r3" | 7 | PR = "r5" |
8 | 8 | ||
9 | SRC_URI = "${DEBIAN_MIRROR}/main/p/prelink/prelink_0.0.${PV}.orig.tar.gz \ | 9 | SRC_URI = "${DEBIAN_MIRROR}/main/p/prelink/prelink_0.0.${PV}.orig.tar.gz \ |
10 | file://prelink.conf \ | 10 | file://prelink.conf \ |