summaryrefslogtreecommitdiffstats
path: root/meta/packages/prelink/prelink-20061027/arm_eabi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/prelink/prelink-20061027/arm_eabi.patch')
-rw-r--r--meta/packages/prelink/prelink-20061027/arm_eabi.patch286
1 files changed, 286 insertions, 0 deletions
diff --git a/meta/packages/prelink/prelink-20061027/arm_eabi.patch b/meta/packages/prelink/prelink-20061027/arm_eabi.patch
new file mode 100644
index 0000000000..b234af9b3f
--- /dev/null
+++ b/meta/packages/prelink/prelink-20061027/arm_eabi.patch
@@ -0,0 +1,286 @@
1Index: prelink-0.0.20050901/src/arch-arm.c
2===================================================================
3--- prelink-0.0.20050901.orig/src/arch-arm.c 2004-09-30 17:07:57.000000000 +0100
4+++ prelink-0.0.20050901/src/arch-arm.c 2006-04-07 14:41:25.000000000 +0100
5@@ -145,6 +145,24 @@
6 error (0, 0, "%s: R_ARM_PC24 relocs with non-zero addend should not be present in prelinked REL sections",
7 dso->filename);
8 return 1;
9+ case R_ARM_TLS_DTPOFF32:
10+ write_le32 (dso, rel->r_offset, value);
11+ break;
12+ /* DTPMOD32 and TPOFF32 is impossible to predict unless prelink
13+ sets the rules. Also for TPOFF{32,} there is REL->RELA problem. */
14+ case R_ARM_TLS_DTPMOD32:
15+ if (dso->ehdr.e_type == ET_EXEC)
16+ {
17+ error (0, 0, "%s: R_ARM_TLS_DTPMOD32 reloc in executable?",
18+ dso->filename);
19+ return 1;
20+ }
21+ break;
22+ case R_ARM_TLS_TPOFF32:
23+ if (dso->ehdr.e_type == ET_EXEC)
24+ error (0, 0, "%s: R_ARM_TLS_TPOFF32 relocs should not be present in prelinked ET_EXEC REL sections",
25+ dso->filename);
26+ break;
27 case R_ARM_COPY:
28 if (dso->ehdr.e_type == ET_EXEC)
29 /* COPY relocs are handled specially in generic code. */
30@@ -195,6 +213,24 @@
31 write_le32 (dso, rela->r_offset,
32 (read_ule32 (dso, rela->r_offset) & 0xff000000) | val);
33 break;
34+ case R_ARM_TLS_DTPOFF32:
35+ write_le32 (dso, rela->r_offset, value + rela->r_addend);
36+ break;
37+ /* DTPMOD32 and TPOFF32 is impossible to predict unless prelink
38+ sets the rules. */
39+ case R_ARM_TLS_DTPMOD32:
40+ if (dso->ehdr.e_type == ET_EXEC)
41+ {
42+ error (0, 0, "%s: R_ARM_TLS_DTPMOD32 reloc in executable?",
43+ dso->filename);
44+ return 1;
45+ }
46+ break;
47+ case R_ARM_TLS_TPOFF32:
48+ if (dso->ehdr.e_type == ET_EXEC && info->resolvetls)
49+ write_le32 (dso, rela->r_offset,
50+ -(value + rela->r_addend - info->resolvetls->offset));
51+ break;
52 case R_ARM_COPY:
53 if (dso->ehdr.e_type == ET_EXEC)
54 /* COPY relocs are handled specially in generic code. */
55@@ -315,6 +351,7 @@
56 {
57 GElf_Addr value;
58 struct prelink_conflict *conflict;
59+ struct prelink_tls *tls;
60 GElf_Rela *ret;
61
62 if (GELF_R_TYPE (rel->r_info) == R_ARM_RELATIVE
63@@ -324,8 +361,31 @@
64 conflict = prelink_conflict (info, GELF_R_SYM (rel->r_info),
65 GELF_R_TYPE (rel->r_info));
66 if (conflict == NULL)
67- return 0;
68- value = conflict_lookup_value (conflict);
69+ {
70+ if (info->curtls == NULL)
71+ return 0;
72+ switch (GELF_R_TYPE (rel->r_info))
73+ {
74+ /* Even local DTPMOD and TPOFF relocs need conflicts. */
75+ case R_ARM_TLS_DTPMOD32:
76+ case R_ARM_TLS_TPOFF32:
77+ break;
78+ default:
79+ return 0;
80+ }
81+ value = 0;
82+ }
83+ else
84+ {
85+ /* DTPOFF32 wants to see only real conflicts, not lookups
86+ with reloc_class RTYPE_CLASS_TLS. */
87+ if (GELF_R_TYPE (rel->r_info) == R_ARM_TLS_DTPOFF32
88+ && conflict->lookup.tls == conflict->conflict.tls
89+ && conflict->lookupval == conflict->conflictval)
90+ return 0;
91+
92+ value = conflict_lookup_value (conflict);
93+ }
94 ret = prelink_conflict_add_rela (info);
95 if (ret == NULL)
96 return 1;
97@@ -342,6 +402,33 @@
98 error (0, 0, "%s: R_ARM_%s relocs should not be present in prelinked REL sections",
99 dso->filename, GELF_R_TYPE (rel->r_info) == R_ARM_ABS32 ? "ABS32" : "PC24");
100 return 1;
101+ case R_ARM_TLS_DTPMOD32:
102+ case R_ARM_TLS_DTPOFF32:
103+ case R_ARM_TLS_TPOFF32:
104+ if (conflict != NULL
105+ && (conflict->reloc_class != RTYPE_CLASS_TLS
106+ || conflict->lookup.tls == NULL))
107+ {
108+ error (0, 0, "%s: R_ARM_TLS not resolving to STT_TLS symbol",
109+ dso->filename);
110+ return 1;
111+ }
112+ tls = conflict ? conflict->lookup.tls : info->curtls;
113+ ret->r_info = GELF_R_INFO (0, R_ARM_ABS32);
114+ switch (GELF_R_TYPE (rel->r_info))
115+ {
116+ case R_ARM_TLS_DTPMOD32:
117+ ret->r_addend = tls->modid;
118+ break;
119+ case R_ARM_TLS_DTPOFF32:
120+ ret->r_addend = value;
121+ break;
122+ case R_ARM_TLS_TPOFF32:
123+ ret->r_addend = -(value + read_ule32 (dso, rel->r_offset)
124+ - tls->offset);
125+ break;
126+ }
127+ break;
128 case R_ARM_COPY:
129 error (0, 0, "R_ARM_COPY should not be present in shared libraries");
130 return 1;
131@@ -359,6 +446,7 @@
132 {
133 GElf_Addr value;
134 struct prelink_conflict *conflict;
135+ struct prelink_tls *tls;
136 GElf_Rela *ret;
137 Elf32_Sword val;
138
139@@ -369,8 +457,31 @@
140 conflict = prelink_conflict (info, GELF_R_SYM (rela->r_info),
141 GELF_R_TYPE (rela->r_info));
142 if (conflict == NULL)
143- return 0;
144- value = conflict_lookup_value (conflict);
145+ {
146+ if (info->curtls == NULL)
147+ return 0;
148+ switch (GELF_R_TYPE (rela->r_info))
149+ {
150+ /* Even local DTPMOD and TPOFF relocs need conflicts. */
151+ case R_ARM_TLS_DTPMOD32:
152+ case R_ARM_TLS_TPOFF32:
153+ break;
154+ default:
155+ return 0;
156+ }
157+ value = 0;
158+ }
159+ else
160+ {
161+ /* DTPOFF32 wants to see only real conflicts, not lookups
162+ with reloc_class RTYPE_CLASS_TLS. */
163+ if (GELF_R_TYPE (rela->r_info) == R_ARM_TLS_DTPOFF32
164+ && conflict->lookup.tls == conflict->conflict.tls
165+ && conflict->lookupval == conflict->conflictval)
166+ return 0;
167+
168+ value = conflict_lookup_value (conflict);
169+ }
170 ret = prelink_conflict_add_rela (info);
171 if (ret == NULL)
172 return 1;
173@@ -398,6 +509,32 @@
174 case R_ARM_COPY:
175 error (0, 0, "R_ARM_COPY should not be present in shared libraries");
176 return 1;
177+ case R_ARM_TLS_DTPMOD32:
178+ case R_ARM_TLS_DTPOFF32:
179+ case R_ARM_TLS_TPOFF32:
180+ if (conflict != NULL
181+ && (conflict->reloc_class != RTYPE_CLASS_TLS
182+ || conflict->lookup.tls == NULL))
183+ {
184+ error (0, 0, "%s: R_386_TLS not resolving to STT_TLS symbol",
185+ dso->filename);
186+ return 1;
187+ }
188+ tls = conflict ? conflict->lookup.tls : info->curtls;
189+ ret->r_info = GELF_R_INFO (0, R_ARM_ABS32);
190+ switch (GELF_R_TYPE (rela->r_info))
191+ {
192+ case R_ARM_TLS_DTPMOD32:
193+ ret->r_addend = tls->modid;
194+ break;
195+ case R_ARM_TLS_DTPOFF32:
196+ ret->r_addend += value;
197+ break;
198+ case R_ARM_TLS_TPOFF32:
199+ ret->r_addend = -(value + rela->r_addend - tls->offset);
200+ break;
201+ }
202+ break;
203 default:
204 error (0, 0, "%s: Unknown arm relocation type %d", dso->filename,
205 (int) GELF_R_TYPE (rela->r_info));
206@@ -418,6 +555,7 @@
207 abort ();
208 case R_ARM_RELATIVE:
209 case R_ARM_ABS32:
210+ case R_ARM_TLS_TPOFF32:
211 rela->r_addend = (Elf32_Sword) read_ule32 (dso, rel->r_offset);
212 break;
213 case R_ARM_PC24:
214@@ -426,6 +564,8 @@
215 break;
216 case R_ARM_COPY:
217 case R_ARM_GLOB_DAT:
218+ case R_ARM_TLS_DTPOFF32:
219+ case R_ARM_TLS_DTPMOD32:
220 rela->r_addend = 0;
221 break;
222 }
223@@ -445,6 +585,7 @@
224 abort ();
225 case R_ARM_RELATIVE:
226 case R_ARM_ABS32:
227+ case R_ARM_TLS_TPOFF32:
228 write_le32 (dso, rela->r_offset, rela->r_addend);
229 break;
230 case R_ARM_PC24:
231@@ -453,6 +594,8 @@
232 | ((rela->r_addend >> 2) & 0xffffff));
233 break;
234 case R_ARM_GLOB_DAT:
235+ case R_ARM_TLS_DTPMOD32:
236+ case R_ARM_TLS_DTPOFF32:
237 write_le32 (dso, rela->r_offset, 0);
238 break;
239 }
240@@ -488,6 +631,13 @@
241 /* FALLTHROUGH */
242 case R_ARM_PC24:
243 return 1;
244+ case R_ARM_TLS_TPOFF32:
245+ /* In shared libraries TPOFF is changed always into
246+ conflicts, for executables we need to preserve
247+ original addend. */
248+ if (dso->ehdr.e_type == ET_EXEC)
249+ return 1;
250+ break;
251 }
252 }
253 }
254@@ -612,6 +762,12 @@
255 return 0;
256 error (0, 0, "%s: R_ARM_COPY reloc in shared library?", dso->filename);
257 return 1;
258+ case R_ARM_TLS_DTPMOD32:
259+ case R_ARM_TLS_DTPOFF32:
260+ write_le32 (dso, rel->r_offset, 0);
261+ break;
262+ case R_ARM_TLS_TPOFF32:
263+ break;
264 default:
265 error (0, 0, "%s: Unknown arm relocation type %d", dso->filename,
266 (int) GELF_R_TYPE (rel->r_info));
267@@ -634,6 +790,10 @@
268 {
269 case R_ARM_COPY: return RTYPE_CLASS_COPY;
270 case R_ARM_JUMP_SLOT: return RTYPE_CLASS_PLT;
271+ case R_ARM_TLS_DTPMOD32:
272+ case R_ARM_TLS_DTPOFF32:
273+ case R_ARM_TLS_TPOFF32:
274+ return RTYPE_CLASS_TLS;
275 default: return RTYPE_CLASS_VALID;
276 }
277 }
278@@ -646,7 +806,7 @@
279 .R_JMP_SLOT = R_ARM_JUMP_SLOT,
280 .R_COPY = R_ARM_COPY,
281 .R_RELATIVE = R_ARM_RELATIVE,
282- .dynamic_linker = "/lib/ld-linux.so.2",
283+ .dynamic_linker = "/lib/ld-linux.so.3",
284 .adjust_dyn = arm_adjust_dyn,
285 .adjust_rel = arm_adjust_rel,
286 .adjust_rela = arm_adjust_rela,