diff options
author | Khem Raj <raj.khem@gmail.com> | 2012-09-13 14:59:10 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-14 09:50:30 +0100 |
commit | 97bb9c5b6776a8cf04125d9293e22d85d78ccc3b (patch) | |
tree | a66608be38c66f67694ad1f0027425c8e7d5612d /meta | |
parent | 268177e4e64525a3655094b5a835aee62acea622 (diff) | |
download | poky-97bb9c5b6776a8cf04125d9293e22d85d78ccc3b.tar.gz |
binutils-2.22: Backport PR fixes from 2.22 branch
These are fixes mainly cherrypicks for mips/ppc/x86
mainly fixing PRs in ld and gold
(From OE-Core rev: f098cfc24bae8e0685bcae53ea4fdc3326ddc6c4)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
15 files changed, 6281 insertions, 1 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.22.inc b/meta/recipes-devtools/binutils/binutils-2.22.inc index 821cc555d0..42dc6b78b5 100644 --- a/meta/recipes-devtools/binutils/binutils-2.22.inc +++ b/meta/recipes-devtools/binutils/binutils-2.22.inc | |||
@@ -1,4 +1,4 @@ | |||
1 | PR = "r15" | 1 | PR = "r16" |
2 | 2 | ||
3 | LIC_FILES_CHKSUM="\ | 3 | LIC_FILES_CHKSUM="\ |
4 | file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\ | 4 | file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\ |
@@ -32,6 +32,20 @@ SRC_URI = "\ | |||
32 | file://mips64-default-ld-emulation.patch \ | 32 | file://mips64-default-ld-emulation.patch \ |
33 | file://0001-PR-ld-13470.patch \ | 33 | file://0001-PR-ld-13470.patch \ |
34 | file://rpath-sysroot.patch \ | 34 | file://rpath-sysroot.patch \ |
35 | file://0006-mips-dis.c-print_insn_micromips-Rename-local-variabl.patch \ | ||
36 | file://0019-PR-ld-13468.patch \ | ||
37 | file://0028-Backport-from-mainline.patch \ | ||
38 | file://0035-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch \ | ||
39 | file://0036-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch \ | ||
40 | file://0037-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch \ | ||
41 | file://0038-Copy-from-mainline-to-binutils-2.22-branch.patch \ | ||
42 | file://0039-emulparams-elf32bmip.sh-OTHER_SECTIONS-Put-.mdebug.-.patch \ | ||
43 | file://0052-gas.patch \ | ||
44 | file://0055-Remove-ABI_64_P-check-on-R_X86_64_PCXX.patch \ | ||
45 | file://0078-PR-binutils-13622.patch \ | ||
46 | file://0144-timer.cc-include-unistd.h.patch \ | ||
47 | file://0166-2012-04-27-Doug-Kwan-dougkwan-google.com.patch \ | ||
48 | file://0182-PR-ld-13991.patch \ | ||
35 | " | 49 | " |
36 | 50 | ||
37 | SRC_URI[md5sum] = "ee0f10756c84979622b992a4a61ea3f5" | 51 | SRC_URI[md5sum] = "ee0f10756c84979622b992a4a61ea3f5" |
diff --git a/meta/recipes-devtools/binutils/binutils/0006-mips-dis.c-print_insn_micromips-Rename-local-variabl.patch b/meta/recipes-devtools/binutils/binutils/0006-mips-dis.c-print_insn_micromips-Rename-local-variabl.patch new file mode 100644 index 0000000000..1baf1e839a --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0006-mips-dis.c-print_insn_micromips-Rename-local-variabl.patch | |||
@@ -0,0 +1,634 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From f72b2c498bc98f42048a3bf7f7d7891db9cabcfc Mon Sep 17 00:00:00 2001 | ||
4 | From: Pierre Muller <muller@ics.u-strasbg.fr> | ||
5 | Date: Fri, 25 Nov 2011 16:57:32 +0000 | ||
6 | Subject: [PATCH 006/262] * mips-dis.c (print_insn_micromips): Rename | ||
7 | local variable iprintf to infprintf to | ||
8 | avoid shadow warning. | ||
9 | |||
10 | --- | ||
11 | opcodes/ChangeLog | 5 ++ | ||
12 | opcodes/mips-dis.c | 188 ++++++++++++++++++++++++++-------------------------- | ||
13 | 2 files changed, 99 insertions(+), 94 deletions(-) | ||
14 | |||
15 | 2011-11-25 Pierre Muller <muller@ics.u-strasbg.fr> | ||
16 | |||
17 | * mips-dis.c (print_insn_micromips): Rename local variable iprintf | ||
18 | to infprintf to avoid shadow warning. | ||
19 | |||
20 | diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c | ||
21 | index 4e18d8a..72285de 100644 | ||
22 | --- a/opcodes/mips-dis.c | ||
23 | +++ b/opcodes/mips-dis.c | ||
24 | @@ -2260,7 +2260,7 @@ print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info) | ||
25 | static int | ||
26 | print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
27 | { | ||
28 | - const fprintf_ftype iprintf = info->fprintf_func; | ||
29 | + const fprintf_ftype infprintf = info->fprintf_func; | ||
30 | const struct mips_opcode *op, *opend; | ||
31 | unsigned int lsb, msbd, msb; | ||
32 | void *is = info->stream; | ||
33 | @@ -2307,7 +2307,7 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
34 | status = (*info->read_memory_func) (memaddr + 2, buffer, 2, info); | ||
35 | if (status != 0) | ||
36 | { | ||
37 | - iprintf (is, "micromips 0x%x", higher); | ||
38 | + infprintf (is, "micromips 0x%x", higher); | ||
39 | (*info->memory_error_func) (status, memaddr + 2, info); | ||
40 | return -1; | ||
41 | } | ||
42 | @@ -2320,7 +2320,7 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
43 | status = (*info->read_memory_func) (memaddr + 4, buffer, 2, info); | ||
44 | if (status != 0) | ||
45 | { | ||
46 | - iprintf (is, "micromips 0x%x", higher); | ||
47 | + infprintf (is, "micromips 0x%x", higher); | ||
48 | (*info->memory_error_func) (status, memaddr + 4, info); | ||
49 | return -1; | ||
50 | } | ||
51 | @@ -2328,7 +2328,7 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
52 | insn = bfd_getb16 (buffer); | ||
53 | else | ||
54 | insn = bfd_getl16 (buffer); | ||
55 | - iprintf (is, "0x%x%04x (48-bit insn)", higher, insn); | ||
56 | + infprintf (is, "0x%x%04x (48-bit insn)", higher, insn); | ||
57 | |||
58 | info->insn_type = dis_noninsn; | ||
59 | return 6; | ||
60 | @@ -2341,7 +2341,7 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
61 | status = (*info->read_memory_func) (memaddr + 2, buffer, 2, info); | ||
62 | if (status != 0) | ||
63 | { | ||
64 | - iprintf (is, "micromips 0x%x", higher); | ||
65 | + infprintf (is, "micromips 0x%x", higher); | ||
66 | (*info->memory_error_func) (status, memaddr + 2, info); | ||
67 | return -1; | ||
68 | } | ||
69 | @@ -2371,9 +2371,9 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
70 | { | ||
71 | const char *s; | ||
72 | |||
73 | - iprintf (is, "%s", op->name); | ||
74 | + infprintf (is, "%s", op->name); | ||
75 | if (op->args[0] != '\0') | ||
76 | - iprintf (is, "\t"); | ||
77 | + infprintf (is, "\t"); | ||
78 | |||
79 | for (s = op->args; *s != '\0'; s++) | ||
80 | { | ||
81 | @@ -2382,37 +2382,37 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
82 | case ',': | ||
83 | case '(': | ||
84 | case ')': | ||
85 | - iprintf (is, "%c", *s); | ||
86 | + infprintf (is, "%c", *s); | ||
87 | break; | ||
88 | |||
89 | case '.': | ||
90 | delta = GET_OP (insn, OFFSET10); | ||
91 | if (delta & 0x200) | ||
92 | delta |= ~0x3ff; | ||
93 | - iprintf (is, "%d", delta); | ||
94 | + infprintf (is, "%d", delta); | ||
95 | break; | ||
96 | |||
97 | case '1': | ||
98 | - iprintf (is, "0x%lx", GET_OP (insn, STYPE)); | ||
99 | + infprintf (is, "0x%lx", GET_OP (insn, STYPE)); | ||
100 | break; | ||
101 | |||
102 | case '<': | ||
103 | - iprintf (is, "0x%lx", GET_OP (insn, SHAMT)); | ||
104 | + infprintf (is, "0x%lx", GET_OP (insn, SHAMT)); | ||
105 | break; | ||
106 | |||
107 | case '\\': | ||
108 | - iprintf (is, "0x%lx", GET_OP (insn, 3BITPOS)); | ||
109 | + infprintf (is, "0x%lx", GET_OP (insn, 3BITPOS)); | ||
110 | break; | ||
111 | |||
112 | case '|': | ||
113 | - iprintf (is, "0x%lx", GET_OP (insn, TRAP)); | ||
114 | + infprintf (is, "0x%lx", GET_OP (insn, TRAP)); | ||
115 | break; | ||
116 | |||
117 | case '~': | ||
118 | delta = GET_OP (insn, OFFSET12); | ||
119 | if (delta & 0x800) | ||
120 | delta |= ~0x7ff; | ||
121 | - iprintf (is, "%d", delta); | ||
122 | + infprintf (is, "%d", delta); | ||
123 | break; | ||
124 | |||
125 | case 'a': | ||
126 | @@ -2433,34 +2433,34 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
127 | case 'r': | ||
128 | case 's': | ||
129 | case 'v': | ||
130 | - iprintf (is, "%s", mips_gpr_names[GET_OP (insn, RS)]); | ||
131 | + infprintf (is, "%s", mips_gpr_names[GET_OP (insn, RS)]); | ||
132 | break; | ||
133 | |||
134 | case 'c': | ||
135 | - iprintf (is, "0x%lx", GET_OP (insn, CODE)); | ||
136 | + infprintf (is, "0x%lx", GET_OP (insn, CODE)); | ||
137 | break; | ||
138 | |||
139 | case 'd': | ||
140 | - iprintf (is, "%s", mips_gpr_names[GET_OP (insn, RD)]); | ||
141 | + infprintf (is, "%s", mips_gpr_names[GET_OP (insn, RD)]); | ||
142 | break; | ||
143 | |||
144 | case 'h': | ||
145 | - iprintf (is, "0x%lx", GET_OP (insn, PREFX)); | ||
146 | + infprintf (is, "0x%lx", GET_OP (insn, PREFX)); | ||
147 | break; | ||
148 | |||
149 | case 'i': | ||
150 | case 'u': | ||
151 | - iprintf (is, "0x%lx", GET_OP (insn, IMMEDIATE)); | ||
152 | + infprintf (is, "0x%lx", GET_OP (insn, IMMEDIATE)); | ||
153 | break; | ||
154 | |||
155 | case 'j': /* Same as i, but sign-extended. */ | ||
156 | case 'o': | ||
157 | delta = (GET_OP (insn, DELTA) ^ 0x8000) - 0x8000; | ||
158 | - iprintf (is, "%d", delta); | ||
159 | + infprintf (is, "%d", delta); | ||
160 | break; | ||
161 | |||
162 | case 'k': | ||
163 | - iprintf (is, "0x%x", GET_OP (insn, CACHE)); | ||
164 | + infprintf (is, "0x%x", GET_OP (insn, CACHE)); | ||
165 | break; | ||
166 | |||
167 | case 'n': | ||
168 | @@ -2472,26 +2472,26 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
169 | if (s_reg_encode != 0) | ||
170 | { | ||
171 | if (s_reg_encode == 1) | ||
172 | - iprintf (is, "%s", mips_gpr_names[16]); | ||
173 | + infprintf (is, "%s", mips_gpr_names[16]); | ||
174 | else if (s_reg_encode < 9) | ||
175 | - iprintf (is, "%s-%s", | ||
176 | + infprintf (is, "%s-%s", | ||
177 | mips_gpr_names[16], | ||
178 | mips_gpr_names[15 + s_reg_encode]); | ||
179 | else if (s_reg_encode == 9) | ||
180 | - iprintf (is, "%s-%s,%s", | ||
181 | + infprintf (is, "%s-%s,%s", | ||
182 | mips_gpr_names[16], | ||
183 | mips_gpr_names[23], | ||
184 | mips_gpr_names[30]); | ||
185 | else | ||
186 | - iprintf (is, "UNKNOWN"); | ||
187 | + infprintf (is, "UNKNOWN"); | ||
188 | } | ||
189 | |||
190 | if (immed & 0x10) /* For ra. */ | ||
191 | { | ||
192 | if (s_reg_encode == 0) | ||
193 | - iprintf (is, "%s", mips_gpr_names[31]); | ||
194 | + infprintf (is, "%s", mips_gpr_names[31]); | ||
195 | else | ||
196 | - iprintf (is, ",%s", mips_gpr_names[31]); | ||
197 | + infprintf (is, ",%s", mips_gpr_names[31]); | ||
198 | } | ||
199 | break; | ||
200 | } | ||
201 | @@ -2504,32 +2504,32 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
202 | break; | ||
203 | |||
204 | case 'q': | ||
205 | - iprintf (is, "0x%lx", GET_OP (insn, CODE2)); | ||
206 | + infprintf (is, "0x%lx", GET_OP (insn, CODE2)); | ||
207 | break; | ||
208 | |||
209 | case 't': | ||
210 | case 'w': | ||
211 | - iprintf (is, "%s", mips_gpr_names[GET_OP (insn, RT)]); | ||
212 | + infprintf (is, "%s", mips_gpr_names[GET_OP (insn, RT)]); | ||
213 | break; | ||
214 | |||
215 | case 'y': | ||
216 | - iprintf (is, "%s", mips_gpr_names[GET_OP (insn, RS3)]); | ||
217 | + infprintf (is, "%s", mips_gpr_names[GET_OP (insn, RS3)]); | ||
218 | break; | ||
219 | |||
220 | case 'z': | ||
221 | - iprintf (is, "%s", mips_gpr_names[0]); | ||
222 | + infprintf (is, "%s", mips_gpr_names[0]); | ||
223 | break; | ||
224 | |||
225 | case 'B': | ||
226 | - iprintf (is, "0x%lx", GET_OP (insn, CODE10)); | ||
227 | + infprintf (is, "0x%lx", GET_OP (insn, CODE10)); | ||
228 | break; | ||
229 | |||
230 | case 'C': | ||
231 | - iprintf (is, "0x%lx", GET_OP (insn, COPZ)); | ||
232 | + infprintf (is, "0x%lx", GET_OP (insn, COPZ)); | ||
233 | break; | ||
234 | |||
235 | case 'D': | ||
236 | - iprintf (is, "%s", mips_fpr_names[GET_OP (insn, FD)]); | ||
237 | + infprintf (is, "%s", mips_fpr_names[GET_OP (insn, FD)]); | ||
238 | break; | ||
239 | |||
240 | case 'E': | ||
241 | @@ -2540,7 +2540,7 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
242 | 'T' format. Therefore, until we gain understanding of | ||
243 | cp2 register names, we can simply print the register | ||
244 | numbers. */ | ||
245 | - iprintf (is, "$%ld", GET_OP (insn, RT)); | ||
246 | + infprintf (is, "$%ld", GET_OP (insn, RT)); | ||
247 | break; | ||
248 | |||
249 | case 'G': | ||
250 | @@ -2559,44 +2559,44 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
251 | case 0x000002fc: /* mtc0 */ | ||
252 | case 0x580000fc: /* dmfc0 */ | ||
253 | case 0x580002fc: /* dmtc0 */ | ||
254 | - iprintf (is, "%s", mips_cp0_names[GET_OP (insn, RS)]); | ||
255 | + infprintf (is, "%s", mips_cp0_names[GET_OP (insn, RS)]); | ||
256 | break; | ||
257 | default: | ||
258 | - iprintf (is, "$%ld", GET_OP (insn, RS)); | ||
259 | + infprintf (is, "$%ld", GET_OP (insn, RS)); | ||
260 | break; | ||
261 | } | ||
262 | break; | ||
263 | |||
264 | case 'H': | ||
265 | - iprintf (is, "%ld", GET_OP (insn, SEL)); | ||
266 | + infprintf (is, "%ld", GET_OP (insn, SEL)); | ||
267 | break; | ||
268 | |||
269 | case 'K': | ||
270 | - iprintf (is, "%s", mips_hwr_names[GET_OP (insn, RS)]); | ||
271 | + infprintf (is, "%s", mips_hwr_names[GET_OP (insn, RS)]); | ||
272 | break; | ||
273 | |||
274 | case 'M': | ||
275 | - iprintf (is, "$fcc%ld", GET_OP (insn, CCC)); | ||
276 | + infprintf (is, "$fcc%ld", GET_OP (insn, CCC)); | ||
277 | break; | ||
278 | |||
279 | case 'N': | ||
280 | - iprintf (is, | ||
281 | + infprintf (is, | ||
282 | (op->pinfo & (FP_D | FP_S)) != 0 | ||
283 | ? "$fcc%ld" : "$cc%ld", | ||
284 | GET_OP (insn, BCC)); | ||
285 | break; | ||
286 | |||
287 | case 'R': | ||
288 | - iprintf (is, "%s", mips_fpr_names[GET_OP (insn, FR)]); | ||
289 | + infprintf (is, "%s", mips_fpr_names[GET_OP (insn, FR)]); | ||
290 | break; | ||
291 | |||
292 | case 'S': | ||
293 | case 'V': | ||
294 | - iprintf (is, "%s", mips_fpr_names[GET_OP (insn, FS)]); | ||
295 | + infprintf (is, "%s", mips_fpr_names[GET_OP (insn, FS)]); | ||
296 | break; | ||
297 | |||
298 | case 'T': | ||
299 | - iprintf (is, "%s", mips_fpr_names[GET_OP (insn, FT)]); | ||
300 | + infprintf (is, "%s", mips_fpr_names[GET_OP (insn, FT)]); | ||
301 | break; | ||
302 | |||
303 | case '+': | ||
304 | @@ -2606,18 +2606,18 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
305 | { | ||
306 | case 'A': | ||
307 | lsb = GET_OP (insn, EXTLSB); | ||
308 | - iprintf (is, "0x%x", lsb); | ||
309 | + infprintf (is, "0x%x", lsb); | ||
310 | break; | ||
311 | |||
312 | case 'B': | ||
313 | msb = GET_OP (insn, INSMSB); | ||
314 | - iprintf (is, "0x%x", msb - lsb + 1); | ||
315 | + infprintf (is, "0x%x", msb - lsb + 1); | ||
316 | break; | ||
317 | |||
318 | case 'C': | ||
319 | case 'H': | ||
320 | msbd = GET_OP (insn, EXTMSBD); | ||
321 | - iprintf (is, "0x%x", msbd + 1); | ||
322 | + infprintf (is, "0x%x", msbd + 1); | ||
323 | break; | ||
324 | |||
325 | case 'D': | ||
326 | @@ -2637,30 +2637,30 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
327 | mips_cp0sel_names_len, | ||
328 | cp0reg, sel); | ||
329 | if (n != NULL) | ||
330 | - iprintf (is, "%s", n->name); | ||
331 | + infprintf (is, "%s", n->name); | ||
332 | else | ||
333 | - iprintf (is, "$%d,%d", cp0reg, sel); | ||
334 | + infprintf (is, "$%d,%d", cp0reg, sel); | ||
335 | break; | ||
336 | } | ||
337 | |||
338 | case 'E': | ||
339 | lsb = GET_OP (insn, EXTLSB) + 32; | ||
340 | - iprintf (is, "0x%x", lsb); | ||
341 | + infprintf (is, "0x%x", lsb); | ||
342 | break; | ||
343 | |||
344 | case 'F': | ||
345 | msb = GET_OP (insn, INSMSB) + 32; | ||
346 | - iprintf (is, "0x%x", msb - lsb + 1); | ||
347 | + infprintf (is, "0x%x", msb - lsb + 1); | ||
348 | break; | ||
349 | |||
350 | case 'G': | ||
351 | msbd = GET_OP (insn, EXTMSBD) + 32; | ||
352 | - iprintf (is, "0x%x", msbd + 1); | ||
353 | + infprintf (is, "0x%x", msbd + 1); | ||
354 | break; | ||
355 | |||
356 | default: | ||
357 | /* xgettext:c-format */ | ||
358 | - iprintf (is, | ||
359 | + infprintf (is, | ||
360 | _("# internal disassembler error, " | ||
361 | "unrecognized modifier (+%c)"), | ||
362 | *s); | ||
363 | @@ -2674,111 +2674,111 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
364 | switch (*s) | ||
365 | { | ||
366 | case 'a': /* global pointer. */ | ||
367 | - iprintf (is, "%s", mips_gpr_names[28]); | ||
368 | + infprintf (is, "%s", mips_gpr_names[28]); | ||
369 | break; | ||
370 | |||
371 | case 'b': | ||
372 | regno = micromips_to_32_reg_b_map[GET_OP (insn, MB)]; | ||
373 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
374 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
375 | break; | ||
376 | |||
377 | case 'c': | ||
378 | regno = micromips_to_32_reg_c_map[GET_OP (insn, MC)]; | ||
379 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
380 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
381 | break; | ||
382 | |||
383 | case 'd': | ||
384 | regno = micromips_to_32_reg_d_map[GET_OP (insn, MD)]; | ||
385 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
386 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
387 | break; | ||
388 | |||
389 | case 'e': | ||
390 | regno = micromips_to_32_reg_e_map[GET_OP (insn, ME)]; | ||
391 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
392 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
393 | break; | ||
394 | |||
395 | case 'f': | ||
396 | /* Save lastregno for "mt" to print out later. */ | ||
397 | lastregno = micromips_to_32_reg_f_map[GET_OP (insn, MF)]; | ||
398 | - iprintf (is, "%s", mips_gpr_names[lastregno]); | ||
399 | + infprintf (is, "%s", mips_gpr_names[lastregno]); | ||
400 | break; | ||
401 | |||
402 | case 'g': | ||
403 | regno = micromips_to_32_reg_g_map[GET_OP (insn, MG)]; | ||
404 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
405 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
406 | break; | ||
407 | |||
408 | case 'h': | ||
409 | regno = micromips_to_32_reg_h_map[GET_OP (insn, MH)]; | ||
410 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
411 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
412 | break; | ||
413 | |||
414 | case 'i': | ||
415 | regno = micromips_to_32_reg_i_map[GET_OP (insn, MI)]; | ||
416 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
417 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
418 | break; | ||
419 | |||
420 | case 'j': | ||
421 | - iprintf (is, "%s", mips_gpr_names[GET_OP (insn, MJ)]); | ||
422 | + infprintf (is, "%s", mips_gpr_names[GET_OP (insn, MJ)]); | ||
423 | break; | ||
424 | |||
425 | case 'l': | ||
426 | regno = micromips_to_32_reg_l_map[GET_OP (insn, ML)]; | ||
427 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
428 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
429 | break; | ||
430 | |||
431 | case 'm': | ||
432 | regno = micromips_to_32_reg_m_map[GET_OP (insn, MM)]; | ||
433 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
434 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
435 | break; | ||
436 | |||
437 | case 'n': | ||
438 | regno = micromips_to_32_reg_n_map[GET_OP (insn, MN)]; | ||
439 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
440 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
441 | break; | ||
442 | |||
443 | case 'p': | ||
444 | /* Save lastregno for "mt" to print out later. */ | ||
445 | lastregno = GET_OP (insn, MP); | ||
446 | - iprintf (is, "%s", mips_gpr_names[lastregno]); | ||
447 | + infprintf (is, "%s", mips_gpr_names[lastregno]); | ||
448 | break; | ||
449 | |||
450 | case 'q': | ||
451 | regno = micromips_to_32_reg_q_map[GET_OP (insn, MQ)]; | ||
452 | - iprintf (is, "%s", mips_gpr_names[regno]); | ||
453 | + infprintf (is, "%s", mips_gpr_names[regno]); | ||
454 | break; | ||
455 | |||
456 | case 'r': /* program counter. */ | ||
457 | - iprintf (is, "$pc"); | ||
458 | + infprintf (is, "$pc"); | ||
459 | break; | ||
460 | |||
461 | case 's': /* stack pointer. */ | ||
462 | lastregno = 29; | ||
463 | - iprintf (is, "%s", mips_gpr_names[29]); | ||
464 | + infprintf (is, "%s", mips_gpr_names[29]); | ||
465 | break; | ||
466 | |||
467 | case 't': | ||
468 | - iprintf (is, "%s", mips_gpr_names[lastregno]); | ||
469 | + infprintf (is, "%s", mips_gpr_names[lastregno]); | ||
470 | break; | ||
471 | |||
472 | case 'z': /* $0. */ | ||
473 | - iprintf (is, "%s", mips_gpr_names[0]); | ||
474 | + infprintf (is, "%s", mips_gpr_names[0]); | ||
475 | break; | ||
476 | |||
477 | case 'A': | ||
478 | /* Sign-extend the immediate. */ | ||
479 | immed = ((GET_OP (insn, IMMA) ^ 0x40) - 0x40) << 2; | ||
480 | - iprintf (is, "%d", immed); | ||
481 | + infprintf (is, "%d", immed); | ||
482 | break; | ||
483 | |||
484 | case 'B': | ||
485 | immed = micromips_imm_b_map[GET_OP (insn, IMMB)]; | ||
486 | - iprintf (is, "%d", immed); | ||
487 | + infprintf (is, "%d", immed); | ||
488 | break; | ||
489 | |||
490 | case 'C': | ||
491 | immed = micromips_imm_c_map[GET_OP (insn, IMMC)]; | ||
492 | - iprintf (is, "0x%lx", immed); | ||
493 | + infprintf (is, "0x%lx", immed); | ||
494 | break; | ||
495 | |||
496 | case 'D': | ||
497 | @@ -2797,50 +2797,50 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
498 | |||
499 | case 'F': | ||
500 | immed = GET_OP (insn, IMMF); | ||
501 | - iprintf (is, "0x%x", immed); | ||
502 | + infprintf (is, "0x%x", immed); | ||
503 | break; | ||
504 | |||
505 | case 'G': | ||
506 | immed = (insn >> MICROMIPSOP_SH_IMMG) + 1; | ||
507 | immed = (immed & MICROMIPSOP_MASK_IMMG) - 1; | ||
508 | - iprintf (is, "%d", immed); | ||
509 | + infprintf (is, "%d", immed); | ||
510 | break; | ||
511 | |||
512 | case 'H': | ||
513 | immed = GET_OP (insn, IMMH) << 1; | ||
514 | - iprintf (is, "%d", immed); | ||
515 | + infprintf (is, "%d", immed); | ||
516 | break; | ||
517 | |||
518 | case 'I': | ||
519 | immed = (insn >> MICROMIPSOP_SH_IMMI) + 1; | ||
520 | immed = (immed & MICROMIPSOP_MASK_IMMI) - 1; | ||
521 | - iprintf (is, "%d", immed); | ||
522 | + infprintf (is, "%d", immed); | ||
523 | break; | ||
524 | |||
525 | case 'J': | ||
526 | immed = GET_OP (insn, IMMJ) << 2; | ||
527 | - iprintf (is, "%d", immed); | ||
528 | + infprintf (is, "%d", immed); | ||
529 | break; | ||
530 | |||
531 | case 'L': | ||
532 | immed = GET_OP (insn, IMML); | ||
533 | - iprintf (is, "%d", immed); | ||
534 | + infprintf (is, "%d", immed); | ||
535 | break; | ||
536 | |||
537 | case 'M': | ||
538 | immed = (insn >> MICROMIPSOP_SH_IMMM) - 1; | ||
539 | immed = (immed & MICROMIPSOP_MASK_IMMM) + 1; | ||
540 | - iprintf (is, "%d", immed); | ||
541 | + infprintf (is, "%d", immed); | ||
542 | break; | ||
543 | |||
544 | case 'N': | ||
545 | immed = GET_OP (insn, IMMN); | ||
546 | if (immed == 0) | ||
547 | - iprintf (is, "%s,%s", | ||
548 | + infprintf (is, "%s,%s", | ||
549 | mips_gpr_names[16], | ||
550 | mips_gpr_names[31]); | ||
551 | else | ||
552 | - iprintf (is, "%s-%s,%s", | ||
553 | + infprintf (is, "%s-%s,%s", | ||
554 | mips_gpr_names[16], | ||
555 | mips_gpr_names[16 + immed], | ||
556 | mips_gpr_names[31]); | ||
557 | @@ -2848,35 +2848,35 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
558 | |||
559 | case 'O': | ||
560 | immed = GET_OP (insn, IMMO); | ||
561 | - iprintf (is, "0x%x", immed); | ||
562 | + infprintf (is, "0x%x", immed); | ||
563 | break; | ||
564 | |||
565 | case 'P': | ||
566 | immed = GET_OP (insn, IMMP) << 2; | ||
567 | - iprintf (is, "%d", immed); | ||
568 | + infprintf (is, "%d", immed); | ||
569 | break; | ||
570 | |||
571 | case 'Q': | ||
572 | /* Sign-extend the immediate. */ | ||
573 | immed = (GET_OP (insn, IMMQ) ^ 0x400000) - 0x400000; | ||
574 | immed <<= 2; | ||
575 | - iprintf (is, "%d", immed); | ||
576 | + infprintf (is, "%d", immed); | ||
577 | break; | ||
578 | |||
579 | case 'U': | ||
580 | immed = GET_OP (insn, IMMU) << 2; | ||
581 | - iprintf (is, "%d", immed); | ||
582 | + infprintf (is, "%d", immed); | ||
583 | break; | ||
584 | |||
585 | case 'W': | ||
586 | immed = GET_OP (insn, IMMW) << 2; | ||
587 | - iprintf (is, "%d", immed); | ||
588 | + infprintf (is, "%d", immed); | ||
589 | break; | ||
590 | |||
591 | case 'X': | ||
592 | /* Sign-extend the immediate. */ | ||
593 | immed = (GET_OP (insn, IMMX) ^ 0x8) - 0x8; | ||
594 | - iprintf (is, "%d", immed); | ||
595 | + infprintf (is, "%d", immed); | ||
596 | break; | ||
597 | |||
598 | case 'Y': | ||
599 | @@ -2885,12 +2885,12 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
600 | if (immed >= -2 && immed <= 1) | ||
601 | immed ^= 0x100; | ||
602 | immed = immed << 2; | ||
603 | - iprintf (is, "%d", immed); | ||
604 | + infprintf (is, "%d", immed); | ||
605 | break; | ||
606 | |||
607 | default: | ||
608 | /* xgettext:c-format */ | ||
609 | - iprintf (is, | ||
610 | + infprintf (is, | ||
611 | _("# internal disassembler error, " | ||
612 | "unrecognized modifier (m%c)"), | ||
613 | *s); | ||
614 | @@ -2900,7 +2900,7 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
615 | |||
616 | default: | ||
617 | /* xgettext:c-format */ | ||
618 | - iprintf (is, | ||
619 | + infprintf (is, | ||
620 | _("# internal disassembler error, " | ||
621 | "unrecognized modifier (%c)"), | ||
622 | *s); | ||
623 | @@ -2937,7 +2937,7 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) | ||
624 | } | ||
625 | #undef GET_OP | ||
626 | |||
627 | - iprintf (is, "0x%x", insn); | ||
628 | + infprintf (is, "0x%x", insn); | ||
629 | info->insn_type = dis_noninsn; | ||
630 | |||
631 | return length; | ||
632 | -- | ||
633 | 1.7.9.5 | ||
634 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0019-PR-ld-13468.patch b/meta/recipes-devtools/binutils/binutils/0019-PR-ld-13468.patch new file mode 100644 index 0000000000..79d9f48453 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0019-PR-ld-13468.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From 4c362e4511c4046e230fc9e330bf086753f04338 Mon Sep 17 00:00:00 2001 | ||
4 | From: Alan Modra <amodra@bigpond.net.au> | ||
5 | Date: Sat, 3 Dec 2011 10:29:17 +0000 | ||
6 | Subject: [PATCH 019/262] PR ld/13468 * elflink.c | ||
7 | (bfd_elf_final_link): Don't segfault when checking | ||
8 | for DT_TEXTREL and .dynamic does not exist. | ||
9 | |||
10 | --- | ||
11 | bfd/ChangeLog | 6 ++++++ | ||
12 | bfd/elflink.c | 9 +++------ | ||
13 | 2 files changed, 9 insertions(+), 6 deletions(-) | ||
14 | |||
15 | 2011-12-03 Alan Modra <amodra@gmail.com> | ||
16 | |||
17 | PR ld/13468 | ||
18 | * elflink.c (bfd_elf_final_link): Don't segfault when checking | ||
19 | for DT_TEXTREL and .dynamic does not exist. | ||
20 | |||
21 | diff --git a/bfd/elflink.c b/bfd/elflink.c | ||
22 | index fc4266b..8556cec 100644 | ||
23 | --- a/bfd/elflink.c | ||
24 | +++ b/bfd/elflink.c | ||
25 | @@ -11188,15 +11188,12 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) | ||
26 | goto error_return; | ||
27 | |||
28 | /* Check for DT_TEXTREL (late, in case the backend removes it). */ | ||
29 | - if ((info->warn_shared_textrel && info->shared) | ||
30 | - || info->error_textrel) | ||
31 | + if (((info->warn_shared_textrel && info->shared) | ||
32 | + || info->error_textrel) | ||
33 | + && (o = bfd_get_section_by_name (dynobj, ".dynamic")) != NULL) | ||
34 | { | ||
35 | bfd_byte *dyncon, *dynconend; | ||
36 | |||
37 | - /* Fix up .dynamic entries. */ | ||
38 | - o = bfd_get_section_by_name (dynobj, ".dynamic"); | ||
39 | - BFD_ASSERT (o != NULL); | ||
40 | - | ||
41 | dyncon = o->contents; | ||
42 | dynconend = o->contents + o->size; | ||
43 | for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn) | ||
44 | -- | ||
45 | 1.7.9.5 | ||
46 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0028-Backport-from-mainline.patch b/meta/recipes-devtools/binutils/binutils/0028-Backport-from-mainline.patch new file mode 100644 index 0000000000..2b86b6bf3b --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0028-Backport-from-mainline.patch | |||
@@ -0,0 +1,139 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From fbd07e4e15de7a81a2de7f9583fa3240302e2867 Mon Sep 17 00:00:00 2001 | ||
4 | From: David Daney <ddaney@avtrex.com> | ||
5 | Date: Sun, 11 Dec 2011 02:28:10 +0000 | ||
6 | Subject: [PATCH 028/262] Backport from mainline: | ||
7 | |||
8 | 2011-12-10 David Daney <david.daney@cavium.com> | ||
9 | |||
10 | * elfxx-mips.c (mips_elf_link_hash_table.rld_value): Remove. | ||
11 | (mips_elf_link_hash_table.rld_symbol): New field; | ||
12 | (MIPS_ELF_RLD_MAP_SIZE): New macro. | ||
13 | (_bfd_mips_elf_add_symbol_hook): Remember __rld_obj_head symbol | ||
14 | in rld_symbol. | ||
15 | (_bfd_mips_elf_create_dynamic_sections): Remember __rld_map symbol | ||
16 | in rld_symbol. | ||
17 | (_bfd_mips_elf_size_dynamic_sections): Set correct size for .rld_map. | ||
18 | (_bfd_mips_elf_finish_dynamic_symbol): Remove .rld_map handling. | ||
19 | (_bfd_mips_elf_finish_dynamic_sections): Use rld_symbol to | ||
20 | calculate DT_MIPS_RLD_MAP value. | ||
21 | (_bfd_mips_elf_link_hash_table_create): Initialize rld_symbol, | ||
22 | quit initializing rld_value. | ||
23 | |||
24 | diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c | ||
25 | index 33a454d..6b908ad 100644 | ||
26 | --- a/bfd/elfxx-mips.c | ||
27 | +++ b/bfd/elfxx-mips.c | ||
28 | @@ -436,8 +436,8 @@ struct mips_elf_link_hash_table | ||
29 | entry is set to the address of __rld_obj_head as in IRIX5. */ | ||
30 | bfd_boolean use_rld_obj_head; | ||
31 | |||
32 | - /* This is the value of the __rld_map or __rld_obj_head symbol. */ | ||
33 | - bfd_vma rld_value; | ||
34 | + /* The __rld_map or __rld_obj_head symbol. */ | ||
35 | + struct elf_link_hash_entry *rld_symbol; | ||
36 | |||
37 | /* This is set if we see any mips16 stub sections. */ | ||
38 | bfd_boolean mips16_stubs_seen; | ||
39 | @@ -768,6 +768,10 @@ static bfd *reldyn_sorting_bfd; | ||
40 | #define MIPS_ELF_GOT_SIZE(abfd) \ | ||
41 | (get_elf_backend_data (abfd)->s->arch_size / 8) | ||
42 | |||
43 | +/* The size of the .rld_map section. */ | ||
44 | +#define MIPS_ELF_RLD_MAP_SIZE(abfd) \ | ||
45 | + (get_elf_backend_data (abfd)->s->arch_size / 8) | ||
46 | + | ||
47 | /* The size of a symbol-table entry. */ | ||
48 | #define MIPS_ELF_SYM_SIZE(abfd) \ | ||
49 | (get_elf_backend_data (abfd)->s->sizeof_sym) | ||
50 | @@ -7081,6 +7085,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, | ||
51 | return FALSE; | ||
52 | |||
53 | mips_elf_hash_table (info)->use_rld_obj_head = TRUE; | ||
54 | + mips_elf_hash_table (info)->rld_symbol = h; | ||
55 | } | ||
56 | |||
57 | /* If this is a mips16 text symbol, add 1 to the value to make it | ||
58 | @@ -7266,6 +7271,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) | ||
59 | |||
60 | if (! bfd_elf_link_record_dynamic_symbol (info, h)) | ||
61 | return FALSE; | ||
62 | + mips_elf_hash_table (info)->rld_symbol = h; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | @@ -9027,7 +9033,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, | ||
67 | { | ||
68 | /* We add a room for __rld_map. It will be filled in by the | ||
69 | rtld to contain a pointer to the _r_debug structure. */ | ||
70 | - s->size += 4; | ||
71 | + s->size += MIPS_ELF_RLD_MAP_SIZE (output_bfd); | ||
72 | } | ||
73 | else if (SGI_COMPAT (output_bfd) | ||
74 | && CONST_STRNEQ (name, ".compact_rel")) | ||
75 | @@ -10030,31 +10036,6 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, | ||
76 | if (IRIX_COMPAT (output_bfd) == ict_irix6) | ||
77 | mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym); | ||
78 | |||
79 | - if (! info->shared) | ||
80 | - { | ||
81 | - if (! mips_elf_hash_table (info)->use_rld_obj_head | ||
82 | - && (strcmp (name, "__rld_map") == 0 | ||
83 | - || strcmp (name, "__RLD_MAP") == 0)) | ||
84 | - { | ||
85 | - asection *s = bfd_get_section_by_name (dynobj, ".rld_map"); | ||
86 | - BFD_ASSERT (s != NULL); | ||
87 | - sym->st_value = s->output_section->vma + s->output_offset; | ||
88 | - bfd_put_32 (output_bfd, 0, s->contents); | ||
89 | - if (mips_elf_hash_table (info)->rld_value == 0) | ||
90 | - mips_elf_hash_table (info)->rld_value = sym->st_value; | ||
91 | - } | ||
92 | - else if (mips_elf_hash_table (info)->use_rld_obj_head | ||
93 | - && strcmp (name, "__rld_obj_head") == 0) | ||
94 | - { | ||
95 | - /* IRIX6 does not use a .rld_map section. */ | ||
96 | - if (IRIX_COMPAT (output_bfd) == ict_irix5 | ||
97 | - || IRIX_COMPAT (output_bfd) == ict_none) | ||
98 | - BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map") | ||
99 | - != NULL); | ||
100 | - mips_elf_hash_table (info)->rld_value = sym->st_value; | ||
101 | - } | ||
102 | - } | ||
103 | - | ||
104 | /* Keep dynamic MIPS16 symbols odd. This allows the dynamic linker to | ||
105 | treat MIPS16 symbols like any other. */ | ||
106 | if (ELF_ST_IS_MIPS16 (sym->st_other)) | ||
107 | @@ -10517,7 +10498,19 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, | ||
108 | break; | ||
109 | |||
110 | case DT_MIPS_RLD_MAP: | ||
111 | - dyn.d_un.d_ptr = mips_elf_hash_table (info)->rld_value; | ||
112 | + { | ||
113 | + struct elf_link_hash_entry *h; | ||
114 | + h = mips_elf_hash_table (info)->rld_symbol; | ||
115 | + if (!h) | ||
116 | + { | ||
117 | + dyn_to_skip = MIPS_ELF_DYN_SIZE (dynobj); | ||
118 | + swap_out_p = FALSE; | ||
119 | + break; | ||
120 | + } | ||
121 | + s = h->root.u.def.section; | ||
122 | + dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset | ||
123 | + + h->root.u.def.value); | ||
124 | + } | ||
125 | break; | ||
126 | |||
127 | case DT_MIPS_OPTIONS: | ||
128 | @@ -12794,7 +12787,7 @@ _bfd_mips_elf_link_hash_table_create (bfd *abfd) | ||
129 | ret->procedure_count = 0; | ||
130 | ret->compact_rel_size = 0; | ||
131 | ret->use_rld_obj_head = FALSE; | ||
132 | - ret->rld_value = 0; | ||
133 | + ret->rld_symbol = NULL; | ||
134 | ret->mips16_stubs_seen = FALSE; | ||
135 | ret->use_plts_and_copy_relocs = FALSE; | ||
136 | ret->is_vxworks = FALSE; | ||
137 | -- | ||
138 | 1.7.9.5 | ||
139 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0035-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch b/meta/recipes-devtools/binutils/binutils/0035-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch new file mode 100644 index 0000000000..a83a5979f6 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0035-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From 97beee82f0e45e65308083a7e4cfaab57623733c Mon Sep 17 00:00:00 2001 | ||
4 | From: cltang <cltang> | ||
5 | Date: Mon, 19 Dec 2011 10:34:15 +0000 | ||
6 | Subject: [PATCH 035/262] 2011-12-19 Chung-Lin Tang | ||
7 | <cltang@codesourcery.com> | ||
8 | |||
9 | Backport from mainline: | ||
10 | |||
11 | 2011-12-13 Chung-Lin Tang <cltang@codesourcery.com> | ||
12 | |||
13 | * elfxx-mips.c (mips_elf_calculate_relocation): Correct | ||
14 | R_MIPS16_HI16/R_MIPS16_LO16 handling of two cleared lower bits, | ||
15 | update comments. | ||
16 | |||
17 | diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c | ||
18 | index 6b908ad..3939183 100644 | ||
19 | --- a/bfd/elfxx-mips.c | ||
20 | +++ b/bfd/elfxx-mips.c | ||
21 | @@ -5531,10 +5531,11 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, | ||
22 | 12: addu $v0,$v1 | ||
23 | 14: move $gp,$v0 | ||
24 | So the offsets of hi and lo relocs are the same, but the | ||
25 | - $pc is four higher than $t9 would be, so reduce | ||
26 | - both reloc addends by 4. */ | ||
27 | + base $pc is that used by the ADDIUPC instruction at $t9 + 4. | ||
28 | + ADDIUPC clears the low two bits of the instruction address, | ||
29 | + so the base is ($t9 + 4) & ~3. */ | ||
30 | if (r_type == R_MIPS16_HI16) | ||
31 | - value = mips_elf_high (addend + gp - p - 4); | ||
32 | + value = mips_elf_high (addend + gp - ((p + 4) & ~(bfd_vma) 0x3)); | ||
33 | /* The microMIPS .cpload sequence uses the same assembly | ||
34 | instructions as the traditional psABI version, but the | ||
35 | incoming $t9 has the low bit set. */ | ||
36 | @@ -5557,7 +5558,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, | ||
37 | /* See the comment for R_MIPS16_HI16 above for the reason | ||
38 | for this conditional. */ | ||
39 | if (r_type == R_MIPS16_LO16) | ||
40 | - value = addend + gp - p; | ||
41 | + value = addend + gp - (p & ~(bfd_vma) 0x3); | ||
42 | else if (r_type == R_MICROMIPS_LO16 | ||
43 | || r_type == R_MICROMIPS_HI0_LO16) | ||
44 | value = addend + gp - p + 3; | ||
45 | -- | ||
46 | 1.7.9.5 | ||
47 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0036-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch b/meta/recipes-devtools/binutils/binutils/0036-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch new file mode 100644 index 0000000000..9017c250de --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0036-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch | |||
@@ -0,0 +1,214 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From 26e802720ccd055d70addadbc39f4119716f8573 Mon Sep 17 00:00:00 2001 | ||
4 | From: cltang <cltang> | ||
5 | Date: Mon, 19 Dec 2011 10:39:27 +0000 | ||
6 | Subject: [PATCH 036/262] 2011-12-19 Chung-Lin Tang | ||
7 | <cltang@codesourcery.com> | ||
8 | |||
9 | Backport from mainline: | ||
10 | |||
11 | 2011-12-19 Chung-Lin Tang <cltang@codesourcery.com> | ||
12 | Catherine Moore <clm@codesourcery.com> | ||
13 | Sandra Loosemore <sandra@codesourcery.com> | ||
14 | Richard Sandiford <rdsandiford@googlemail.com> | ||
15 | |||
16 | * elfxx-mips.c (mips_elf_local_pic_function_p): Return true when | ||
17 | H is a MIPS16 function with a kept 32-bit stub. Update comments. | ||
18 | (mips_elf_get_la25_target): New function. | ||
19 | (mips_elf_add_la25_intro): Change to use mips_elf_get_la25_target(). | ||
20 | (mips_elf_add_la25_stub): Move compute of use_trampoline_p down, | ||
21 | change to use mips_elf_get_la25_target(). | ||
22 | (mips_elf_relocation_needs_la25_stub): Add target_is_16_bit_code_p | ||
23 | parameter, add switch case for R_MIPS16_26. | ||
24 | (mips_elf_calculate_relocation): Redirect relocation to point to the | ||
25 | LA25 stub if it exists, instead of the MIPS16 stub. Update arguments | ||
26 | of call to mips_elf_relocation_needs_la25_stub(), don't use la25 stub | ||
27 | for mips16->mips16 calls. | ||
28 | (_bfd_mips_elf_check_relocs): Update arguments of call to | ||
29 | mips_elf_relocation_needs_la25_stub(). | ||
30 | (mips_elf_create_la25_stub): Change to use mips_elf_get_la25_target(). | ||
31 | |||
32 | diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c | ||
33 | index 3939183..9f3833b 100644 | ||
34 | --- a/bfd/elfxx-mips.c | ||
35 | +++ b/bfd/elfxx-mips.c | ||
36 | @@ -1575,9 +1575,10 @@ _bfd_mips_elf_init_stubs (struct bfd_link_info *info, | ||
37 | } | ||
38 | |||
39 | /* Return true if H is a locally-defined PIC function, in the sense | ||
40 | - that it might need $25 to be valid on entry. Note that MIPS16 | ||
41 | - functions never need $25 to be valid on entry; they set up $gp | ||
42 | - using PC-relative instructions instead. */ | ||
43 | + that it or its fn_stub might need $25 to be valid on entry. | ||
44 | + Note that MIPS16 functions set up $gp using PC-relative instructions, | ||
45 | + so they themselves never need $25 to be valid. Only non-MIPS16 | ||
46 | + entry points are of interest here. */ | ||
47 | |||
48 | static bfd_boolean | ||
49 | mips_elf_local_pic_function_p (struct mips_elf_link_hash_entry *h) | ||
50 | @@ -1586,11 +1587,32 @@ mips_elf_local_pic_function_p (struct mips_elf_link_hash_entry *h) | ||
51 | || h->root.root.type == bfd_link_hash_defweak) | ||
52 | && h->root.def_regular | ||
53 | && !bfd_is_abs_section (h->root.root.u.def.section) | ||
54 | - && !ELF_ST_IS_MIPS16 (h->root.other) | ||
55 | + && (!ELF_ST_IS_MIPS16 (h->root.other) | ||
56 | + || (h->fn_stub && h->need_fn_stub)) | ||
57 | && (PIC_OBJECT_P (h->root.root.u.def.section->owner) | ||
58 | || ELF_ST_IS_MIPS_PIC (h->root.other))); | ||
59 | } | ||
60 | |||
61 | +/* Set *SEC to the input section that contains the target of STUB. | ||
62 | + Return the offset of the target from the start of that section. */ | ||
63 | + | ||
64 | +static bfd_vma | ||
65 | +mips_elf_get_la25_target (struct mips_elf_la25_stub *stub, | ||
66 | + asection **sec) | ||
67 | +{ | ||
68 | + if (ELF_ST_IS_MIPS16 (stub->h->root.other)) | ||
69 | + { | ||
70 | + BFD_ASSERT (stub->h->need_fn_stub); | ||
71 | + *sec = stub->h->fn_stub; | ||
72 | + return 0; | ||
73 | + } | ||
74 | + else | ||
75 | + { | ||
76 | + *sec = stub->h->root.root.u.def.section; | ||
77 | + return stub->h->root.root.u.def.value; | ||
78 | + } | ||
79 | +} | ||
80 | + | ||
81 | /* STUB describes an la25 stub that we have decided to implement | ||
82 | by inserting an LUI/ADDIU pair before the target function. | ||
83 | Create the section and redirect the function symbol to it. */ | ||
84 | @@ -1615,7 +1637,7 @@ mips_elf_add_la25_intro (struct mips_elf_la25_stub *stub, | ||
85 | sprintf (name, ".text.stub.%d", (int) htab_elements (htab->la25_stubs)); | ||
86 | |||
87 | /* Create the section. */ | ||
88 | - input_section = stub->h->root.root.u.def.section; | ||
89 | + mips_elf_get_la25_target (stub, &input_section); | ||
90 | s = htab->add_stub_section (name, input_section, | ||
91 | input_section->output_section); | ||
92 | if (s == NULL) | ||
93 | @@ -1689,12 +1711,6 @@ mips_elf_add_la25_stub (struct bfd_link_info *info, | ||
94 | bfd_vma value; | ||
95 | void **slot; | ||
96 | |||
97 | - /* Prefer to use LUI/ADDIU stubs if the function is at the beginning | ||
98 | - of the section and if we would need no more than 2 nops. */ | ||
99 | - s = h->root.root.u.def.section; | ||
100 | - value = h->root.root.u.def.value; | ||
101 | - use_trampoline_p = (value != 0 || s->alignment_power > 4); | ||
102 | - | ||
103 | /* Describe the stub we want. */ | ||
104 | search.stub_section = NULL; | ||
105 | search.offset = 0; | ||
106 | @@ -1724,6 +1740,11 @@ mips_elf_add_la25_stub (struct bfd_link_info *info, | ||
107 | *stub = search; | ||
108 | *slot = stub; | ||
109 | |||
110 | + /* Prefer to use LUI/ADDIU stubs if the function is at the beginning | ||
111 | + of the section and if we would need no more than 2 nops. */ | ||
112 | + value = mips_elf_get_la25_target (stub, &s); | ||
113 | + use_trampoline_p = (value != 0 || s->alignment_power > 4); | ||
114 | + | ||
115 | h->la25_stub = stub; | ||
116 | return (use_trampoline_p | ||
117 | ? mips_elf_add_la25_trampoline (stub, info) | ||
118 | @@ -4911,7 +4932,8 @@ is_gott_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h) | ||
119 | stub. */ | ||
120 | |||
121 | static bfd_boolean | ||
122 | -mips_elf_relocation_needs_la25_stub (bfd *input_bfd, int r_type) | ||
123 | +mips_elf_relocation_needs_la25_stub (bfd *input_bfd, int r_type, | ||
124 | + bfd_boolean target_is_16_bit_code_p) | ||
125 | { | ||
126 | /* We specifically ignore branches and jumps from EF_PIC objects, | ||
127 | where the onus is on the compiler or programmer to perform any | ||
128 | @@ -4925,7 +4947,6 @@ mips_elf_relocation_needs_la25_stub (bfd *input_bfd, int r_type) | ||
129 | { | ||
130 | case R_MIPS_26: | ||
131 | case R_MIPS_PC16: | ||
132 | - case R_MIPS16_26: | ||
133 | case R_MICROMIPS_26_S1: | ||
134 | case R_MICROMIPS_PC7_S1: | ||
135 | case R_MICROMIPS_PC10_S1: | ||
136 | @@ -4933,6 +4954,9 @@ mips_elf_relocation_needs_la25_stub (bfd *input_bfd, int r_type) | ||
137 | case R_MICROMIPS_PC23_S2: | ||
138 | return TRUE; | ||
139 | |||
140 | + case R_MIPS16_26: | ||
141 | + return !target_is_16_bit_code_p; | ||
142 | + | ||
143 | default: | ||
144 | return FALSE; | ||
145 | } | ||
146 | @@ -5193,14 +5217,28 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, | ||
147 | have already noticed that we were going to need the | ||
148 | stub. */ | ||
149 | if (local_p) | ||
150 | - sec = elf_tdata (input_bfd)->local_stubs[r_symndx]; | ||
151 | + { | ||
152 | + sec = elf_tdata (input_bfd)->local_stubs[r_symndx]; | ||
153 | + value = 0; | ||
154 | + } | ||
155 | else | ||
156 | { | ||
157 | BFD_ASSERT (h->need_fn_stub); | ||
158 | - sec = h->fn_stub; | ||
159 | + if (h->la25_stub) | ||
160 | + { | ||
161 | + /* If a LA25 header for the stub itself exists, point to the | ||
162 | + prepended LUI/ADDIU sequence. */ | ||
163 | + sec = h->la25_stub->stub_section; | ||
164 | + value = h->la25_stub->offset; | ||
165 | + } | ||
166 | + else | ||
167 | + { | ||
168 | + sec = h->fn_stub; | ||
169 | + value = 0; | ||
170 | + } | ||
171 | } | ||
172 | |||
173 | - symbol = sec->output_section->vma + sec->output_offset; | ||
174 | + symbol = sec->output_section->vma + sec->output_offset + value; | ||
175 | /* The target is 16-bit, but the stub isn't. */ | ||
176 | target_is_16_bit_code_p = FALSE; | ||
177 | } | ||
178 | @@ -5250,7 +5288,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, | ||
179 | /* If this is a direct call to a PIC function, redirect to the | ||
180 | non-PIC stub. */ | ||
181 | else if (h != NULL && h->la25_stub | ||
182 | - && mips_elf_relocation_needs_la25_stub (input_bfd, r_type)) | ||
183 | + && mips_elf_relocation_needs_la25_stub (input_bfd, r_type, | ||
184 | + target_is_16_bit_code_p)) | ||
185 | symbol = (h->la25_stub->stub_section->output_section->vma | ||
186 | + h->la25_stub->stub_section->output_offset | ||
187 | + h->la25_stub->offset); | ||
188 | @@ -7925,7 +7964,9 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
189 | return FALSE; | ||
190 | } | ||
191 | |||
192 | - if (h != NULL && mips_elf_relocation_needs_la25_stub (abfd, r_type)) | ||
193 | + if (h != NULL | ||
194 | + && mips_elf_relocation_needs_la25_stub (abfd, r_type, | ||
195 | + ELF_ST_IS_MIPS16 (h->other))) | ||
196 | ((struct mips_elf_link_hash_entry *) h)->has_nonpic_branches = TRUE; | ||
197 | |||
198 | switch (r_type) | ||
199 | @@ -9622,9 +9663,9 @@ mips_elf_create_la25_stub (void **slot, void *data) | ||
200 | offset = stub->offset; | ||
201 | |||
202 | /* Work out the target address. */ | ||
203 | - target = (stub->h->root.root.u.def.section->output_section->vma | ||
204 | - + stub->h->root.root.u.def.section->output_offset | ||
205 | - + stub->h->root.root.u.def.value); | ||
206 | + target = mips_elf_get_la25_target (stub, &s); | ||
207 | + target += s->output_section->vma + s->output_offset; | ||
208 | + | ||
209 | target_high = ((target + 0x8000) >> 16) & 0xffff; | ||
210 | target_low = (target & 0xffff); | ||
211 | |||
212 | -- | ||
213 | 1.7.9.5 | ||
214 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0037-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch b/meta/recipes-devtools/binutils/binutils/0037-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch new file mode 100644 index 0000000000..4b0caafb48 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0037-2011-12-19-Chung-Lin-Tang-cltang-codesourcery.com.patch | |||
@@ -0,0 +1,1068 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From 7e2b7154b03e4c77233171eec5cba8d113e04fea Mon Sep 17 00:00:00 2001 | ||
4 | From: cltang <cltang> | ||
5 | Date: Mon, 19 Dec 2011 10:49:24 +0000 | ||
6 | Subject: [PATCH 037/262] 2011-12-19 Chung-Lin Tang | ||
7 | <cltang@codesourcery.com> | ||
8 | |||
9 | Backport from mainline: | ||
10 | |||
11 | 2011-12-19 Chung-Lin Tang <cltang@codesourcery.com> | ||
12 | |||
13 | gas/ | ||
14 | * config/tc-mips.c (mips_pseudo_table): Add tprelword/tpreldword | ||
15 | entries. | ||
16 | (mips16_percent_op): Add MIPS16 TLS relocation ops. | ||
17 | (md_apply_fix): Add BFD_RELOC_MIPS16_TLS_* switch cases. | ||
18 | (s_tls_rel_directive): Rename from s_dtprel_internal(). Abstract out | ||
19 | directive string and reloc type as function parameters. Update | ||
20 | comments. | ||
21 | (s_dtprelword,s_dtpreldword): Change to use s_tls_rel_directive(). | ||
22 | (s_tprelword,s_tpreldword): New functions. | ||
23 | |||
24 | include/ | ||
25 | * elf/mips.h (elf_mips_reloc_type): Add R_MIPS16_TLS_* entries. | ||
26 | |||
27 | bfd/ | ||
28 | * reloc.c (BFD_RELOC_MIPS16_TLS_GD,BFD_RELOC_MIPS16_TLS_LDM, | ||
29 | BFD_RELOC_MIPS16_TLS_DTPREL_HI16,BFD_RELOC_MIPS16_TLS_DTPREL_LO16, | ||
30 | BFD_RELOC_MIPS16_TLS_GOTTPREL,BFD_RELOC_MIPS16_TLS_TPREL_HI16, | ||
31 | BFD_RELOC_MIPS16_TLS_TPREL_LO16): New relocations for MIPS16 TLS. | ||
32 | * bfd-in2.h (bfd_reloc_code_real): Regenerate. | ||
33 | * libbfd.h (bfd_reloc_code_real_names): Regenerate. | ||
34 | * elf32-mips.c (elf_mips16_howto_table_rel): Add R_MIPS16_TLS_* | ||
35 | entries. | ||
36 | (mips16_reloc_map): Add BFD_RELOC_MIPS16_TLS_* to R_MIPS16_TLS_* | ||
37 | mappings. | ||
38 | * elfn32-mips.c (elf_mips16_howto_table_rel, | ||
39 | elf_mips16_howto_table_rela): Add R_MIPS16_TLS_* entries. | ||
40 | (mips16_reloc_map): Add BFD_RELOC_MIPS16_TLS_* to R_MIPS16_TLS_* | ||
41 | mappings. | ||
42 | * elf64-mips.c (mips16_elf64_howto_table_rel, | ||
43 | mips16_elf64_howto_table_rela): Add R_MIPS16_TLS_* entries. | ||
44 | (mips16_reloc_map): Add BFD_RELOC_MIPS16_TLS_* to R_MIPS16_TLS_* | ||
45 | mappings. | ||
46 | * elfxx-mips.c (TLS_RELOC_P,mips16_reloc_p, | ||
47 | _bfd_mips_elf_check_relocs): Add cases for R_MIPS16_TLS_* relocations. | ||
48 | (tls_gd_reloc_p): Add R_MIPS16_TLS_GD case. | ||
49 | (tls_ldm_reloc_p): Add R_MIPS16_TLS_LDM case. | ||
50 | (tls_gottprel_reloc_p): Add R_MIPS16_TLS_GOTTPREL case. | ||
51 | (mips_elf_calculate_relocation): Add cases for R_MIPS16_TLS_*, | ||
52 | R_MIPS_TLS_DTPREL32/64, and R_MIPS_TLS_TPREL32/64 relocations. | ||
53 | --- | ||
54 | bfd/ChangeLog | 32 ++++++++ | ||
55 | bfd/bfd-in2.h | 9 +++ | ||
56 | bfd/elf32-mips.c | 114 ++++++++++++++++++++++++++ | ||
57 | bfd/elf64-mips.c | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
58 | bfd/elfn32-mips.c | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
59 | bfd/elfxx-mips.c | 48 +++++++++-- | ||
60 | bfd/libbfd.h | 7 ++ | ||
61 | bfd/reloc.c | 17 ++++ | ||
62 | gas/ChangeLog | 16 ++++ | ||
63 | gas/config/tc-mips.c | 62 ++++++++++---- | ||
64 | include/ChangeLog | 8 ++ | ||
65 | include/elf/mips.h | 9 ++- | ||
66 | 12 files changed, 739 insertions(+), 21 deletions(-) | ||
67 | |||
68 | diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h | ||
69 | index 22fcdf6..cd90740 100644 | ||
70 | --- a/bfd/bfd-in2.h | ||
71 | +++ b/bfd/bfd-in2.h | ||
72 | @@ -2780,6 +2780,15 @@ to compensate for the borrow when the low bits are added. */ | ||
73 | /* MIPS16 low 16 bits. */ | ||
74 | BFD_RELOC_MIPS16_LO16, | ||
75 | |||
76 | +/* MIPS16 TLS relocations */ | ||
77 | + BFD_RELOC_MIPS16_TLS_GD, | ||
78 | + BFD_RELOC_MIPS16_TLS_LDM, | ||
79 | + BFD_RELOC_MIPS16_TLS_DTPREL_HI16, | ||
80 | + BFD_RELOC_MIPS16_TLS_DTPREL_LO16, | ||
81 | + BFD_RELOC_MIPS16_TLS_GOTTPREL, | ||
82 | + BFD_RELOC_MIPS16_TLS_TPREL_HI16, | ||
83 | + BFD_RELOC_MIPS16_TLS_TPREL_LO16, | ||
84 | + | ||
85 | /* Relocation against a MIPS literal section. */ | ||
86 | BFD_RELOC_MIPS_LITERAL, | ||
87 | BFD_RELOC_MICROMIPS_LITERAL, | ||
88 | diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c | ||
89 | index fd3d4ba..61e8b45 100644 | ||
90 | --- a/bfd/elf32-mips.c | ||
91 | +++ b/bfd/elf32-mips.c | ||
92 | @@ -830,6 +830,111 @@ static reloc_howto_type elf_mips16_howto_table_rel[] = | ||
93 | 0x0000ffff, /* src_mask */ | ||
94 | 0x0000ffff, /* dst_mask */ | ||
95 | FALSE), /* pcrel_offset */ | ||
96 | + | ||
97 | + /* MIPS16 TLS general dynamic variable reference. */ | ||
98 | + HOWTO (R_MIPS16_TLS_GD, /* type */ | ||
99 | + 0, /* rightshift */ | ||
100 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
101 | + 16, /* bitsize */ | ||
102 | + FALSE, /* pc_relative */ | ||
103 | + 0, /* bitpos */ | ||
104 | + complain_overflow_signed, /* complain_on_overflow */ | ||
105 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
106 | + "R_MIPS16_TLS_GD", /* name */ | ||
107 | + TRUE, /* partial_inplace */ | ||
108 | + 0x0000ffff, /* src_mask */ | ||
109 | + 0x0000ffff, /* dst_mask */ | ||
110 | + FALSE), /* pcrel_offset */ | ||
111 | + | ||
112 | + /* MIPS16 TLS local dynamic variable reference. */ | ||
113 | + HOWTO (R_MIPS16_TLS_LDM, /* type */ | ||
114 | + 0, /* rightshift */ | ||
115 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
116 | + 16, /* bitsize */ | ||
117 | + FALSE, /* pc_relative */ | ||
118 | + 0, /* bitpos */ | ||
119 | + complain_overflow_signed, /* complain_on_overflow */ | ||
120 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
121 | + "R_MIPS16_TLS_LDM", /* name */ | ||
122 | + TRUE, /* partial_inplace */ | ||
123 | + 0x0000ffff, /* src_mask */ | ||
124 | + 0x0000ffff, /* dst_mask */ | ||
125 | + FALSE), /* pcrel_offset */ | ||
126 | + | ||
127 | + /* MIPS16 TLS local dynamic offset. */ | ||
128 | + HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ | ||
129 | + 0, /* rightshift */ | ||
130 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
131 | + 16, /* bitsize */ | ||
132 | + FALSE, /* pc_relative */ | ||
133 | + 0, /* bitpos */ | ||
134 | + complain_overflow_signed, /* complain_on_overflow */ | ||
135 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
136 | + "R_MIPS16_TLS_DTPREL_HI16", /* name */ | ||
137 | + TRUE, /* partial_inplace */ | ||
138 | + 0x0000ffff, /* src_mask */ | ||
139 | + 0x0000ffff, /* dst_mask */ | ||
140 | + FALSE), /* pcrel_offset */ | ||
141 | + | ||
142 | + /* MIPS16 TLS local dynamic offset. */ | ||
143 | + HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ | ||
144 | + 0, /* rightshift */ | ||
145 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
146 | + 16, /* bitsize */ | ||
147 | + FALSE, /* pc_relative */ | ||
148 | + 0, /* bitpos */ | ||
149 | + complain_overflow_signed, /* complain_on_overflow */ | ||
150 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
151 | + "R_MIPS16_TLS_DTPREL_LO16", /* name */ | ||
152 | + TRUE, /* partial_inplace */ | ||
153 | + 0x0000ffff, /* src_mask */ | ||
154 | + 0x0000ffff, /* dst_mask */ | ||
155 | + FALSE), /* pcrel_offset */ | ||
156 | + | ||
157 | + /* MIPS16 TLS thread pointer offset. */ | ||
158 | + HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ | ||
159 | + 0, /* rightshift */ | ||
160 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
161 | + 16, /* bitsize */ | ||
162 | + FALSE, /* pc_relative */ | ||
163 | + 0, /* bitpos */ | ||
164 | + complain_overflow_signed, /* complain_on_overflow */ | ||
165 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
166 | + "R_MIPS16_TLS_GOTTPREL", /* name */ | ||
167 | + TRUE, /* partial_inplace */ | ||
168 | + 0x0000ffff, /* src_mask */ | ||
169 | + 0x0000ffff, /* dst_mask */ | ||
170 | + FALSE), /* pcrel_offset */ | ||
171 | + | ||
172 | + /* MIPS16 TLS thread pointer offset. */ | ||
173 | + HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ | ||
174 | + 0, /* rightshift */ | ||
175 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
176 | + 16, /* bitsize */ | ||
177 | + FALSE, /* pc_relative */ | ||
178 | + 0, /* bitpos */ | ||
179 | + complain_overflow_signed, /* complain_on_overflow */ | ||
180 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
181 | + "R_MIPS16_TLS_TPREL_HI16", /* name */ | ||
182 | + TRUE, /* partial_inplace */ | ||
183 | + 0x0000ffff, /* src_mask */ | ||
184 | + 0x0000ffff, /* dst_mask */ | ||
185 | + FALSE), /* pcrel_offset */ | ||
186 | + | ||
187 | + /* MIPS16 TLS thread pointer offset. */ | ||
188 | + HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ | ||
189 | + 0, /* rightshift */ | ||
190 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
191 | + 16, /* bitsize */ | ||
192 | + FALSE, /* pc_relative */ | ||
193 | + 0, /* bitpos */ | ||
194 | + complain_overflow_signed, /* complain_on_overflow */ | ||
195 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
196 | + "R_MIPS16_TLS_TPREL_LO16", /* name */ | ||
197 | + TRUE, /* partial_inplace */ | ||
198 | + 0x0000ffff, /* src_mask */ | ||
199 | + 0x0000ffff, /* dst_mask */ | ||
200 | + FALSE), /* pcrel_offset */ | ||
201 | }; | ||
202 | |||
203 | static reloc_howto_type elf_micromips_howto_table_rel[] = | ||
204 | @@ -1796,6 +1901,15 @@ static const struct elf_reloc_map mips16_reloc_map[] = | ||
205 | { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min }, | ||
206 | { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, | ||
207 | { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, | ||
208 | + { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min }, | ||
209 | + { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min }, | ||
210 | + { BFD_RELOC_MIPS16_TLS_DTPREL_HI16, | ||
211 | + R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min }, | ||
212 | + { BFD_RELOC_MIPS16_TLS_DTPREL_LO16, | ||
213 | + R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min }, | ||
214 | + { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min }, | ||
215 | + { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min }, | ||
216 | + { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min } | ||
217 | }; | ||
218 | |||
219 | static const struct elf_reloc_map micromips_reloc_map[] = | ||
220 | diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c | ||
221 | index 3feb1bb..bdd0c19 100644 | ||
222 | --- a/bfd/elf64-mips.c | ||
223 | +++ b/bfd/elf64-mips.c | ||
224 | @@ -1590,6 +1590,111 @@ static reloc_howto_type mips16_elf64_howto_table_rel[] = | ||
225 | 0x0000ffff, /* src_mask */ | ||
226 | 0x0000ffff, /* dst_mask */ | ||
227 | FALSE), /* pcrel_offset */ | ||
228 | + | ||
229 | + /* MIPS16 TLS general dynamic variable reference. */ | ||
230 | + HOWTO (R_MIPS16_TLS_GD, /* type */ | ||
231 | + 0, /* rightshift */ | ||
232 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
233 | + 16, /* bitsize */ | ||
234 | + FALSE, /* pc_relative */ | ||
235 | + 0, /* bitpos */ | ||
236 | + complain_overflow_signed, /* complain_on_overflow */ | ||
237 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
238 | + "R_MIPS16_TLS_GD", /* name */ | ||
239 | + TRUE, /* partial_inplace */ | ||
240 | + 0x0000ffff, /* src_mask */ | ||
241 | + 0x0000ffff, /* dst_mask */ | ||
242 | + FALSE), /* pcrel_offset */ | ||
243 | + | ||
244 | + /* MIPS16 TLS local dynamic variable reference. */ | ||
245 | + HOWTO (R_MIPS16_TLS_LDM, /* type */ | ||
246 | + 0, /* rightshift */ | ||
247 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
248 | + 16, /* bitsize */ | ||
249 | + FALSE, /* pc_relative */ | ||
250 | + 0, /* bitpos */ | ||
251 | + complain_overflow_signed, /* complain_on_overflow */ | ||
252 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
253 | + "R_MIPS16_TLS_LDM", /* name */ | ||
254 | + TRUE, /* partial_inplace */ | ||
255 | + 0x0000ffff, /* src_mask */ | ||
256 | + 0x0000ffff, /* dst_mask */ | ||
257 | + FALSE), /* pcrel_offset */ | ||
258 | + | ||
259 | + /* MIPS16 TLS local dynamic offset. */ | ||
260 | + HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ | ||
261 | + 0, /* rightshift */ | ||
262 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
263 | + 16, /* bitsize */ | ||
264 | + FALSE, /* pc_relative */ | ||
265 | + 0, /* bitpos */ | ||
266 | + complain_overflow_signed, /* complain_on_overflow */ | ||
267 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
268 | + "R_MIPS16_TLS_DTPREL_HI16", /* name */ | ||
269 | + TRUE, /* partial_inplace */ | ||
270 | + 0x0000ffff, /* src_mask */ | ||
271 | + 0x0000ffff, /* dst_mask */ | ||
272 | + FALSE), /* pcrel_offset */ | ||
273 | + | ||
274 | + /* MIPS16 TLS local dynamic offset. */ | ||
275 | + HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ | ||
276 | + 0, /* rightshift */ | ||
277 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
278 | + 16, /* bitsize */ | ||
279 | + FALSE, /* pc_relative */ | ||
280 | + 0, /* bitpos */ | ||
281 | + complain_overflow_signed, /* complain_on_overflow */ | ||
282 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
283 | + "R_MIPS16_TLS_DTPREL_LO16", /* name */ | ||
284 | + TRUE, /* partial_inplace */ | ||
285 | + 0x0000ffff, /* src_mask */ | ||
286 | + 0x0000ffff, /* dst_mask */ | ||
287 | + FALSE), /* pcrel_offset */ | ||
288 | + | ||
289 | + /* MIPS16 TLS thread pointer offset. */ | ||
290 | + HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ | ||
291 | + 0, /* rightshift */ | ||
292 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
293 | + 16, /* bitsize */ | ||
294 | + FALSE, /* pc_relative */ | ||
295 | + 0, /* bitpos */ | ||
296 | + complain_overflow_signed, /* complain_on_overflow */ | ||
297 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
298 | + "R_MIPS16_TLS_GOTTPREL", /* name */ | ||
299 | + TRUE, /* partial_inplace */ | ||
300 | + 0x0000ffff, /* src_mask */ | ||
301 | + 0x0000ffff, /* dst_mask */ | ||
302 | + FALSE), /* pcrel_offset */ | ||
303 | + | ||
304 | + /* MIPS16 TLS thread pointer offset. */ | ||
305 | + HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ | ||
306 | + 0, /* rightshift */ | ||
307 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
308 | + 16, /* bitsize */ | ||
309 | + FALSE, /* pc_relative */ | ||
310 | + 0, /* bitpos */ | ||
311 | + complain_overflow_signed, /* complain_on_overflow */ | ||
312 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
313 | + "R_MIPS16_TLS_TPREL_HI16", /* name */ | ||
314 | + TRUE, /* partial_inplace */ | ||
315 | + 0x0000ffff, /* src_mask */ | ||
316 | + 0x0000ffff, /* dst_mask */ | ||
317 | + FALSE), /* pcrel_offset */ | ||
318 | + | ||
319 | + /* MIPS16 TLS thread pointer offset. */ | ||
320 | + HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ | ||
321 | + 0, /* rightshift */ | ||
322 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
323 | + 16, /* bitsize */ | ||
324 | + FALSE, /* pc_relative */ | ||
325 | + 0, /* bitpos */ | ||
326 | + complain_overflow_signed, /* complain_on_overflow */ | ||
327 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
328 | + "R_MIPS16_TLS_TPREL_LO16", /* name */ | ||
329 | + TRUE, /* partial_inplace */ | ||
330 | + 0x0000ffff, /* src_mask */ | ||
331 | + 0x0000ffff, /* dst_mask */ | ||
332 | + FALSE), /* pcrel_offset */ | ||
333 | }; | ||
334 | |||
335 | static reloc_howto_type mips16_elf64_howto_table_rela[] = | ||
336 | @@ -1686,6 +1791,111 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = | ||
337 | 0x0000ffff, /* src_mask */ | ||
338 | 0x0000ffff, /* dst_mask */ | ||
339 | FALSE), /* pcrel_offset */ | ||
340 | + | ||
341 | + /* MIPS16 TLS general dynamic variable reference. */ | ||
342 | + HOWTO (R_MIPS16_TLS_GD, /* type */ | ||
343 | + 0, /* rightshift */ | ||
344 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
345 | + 16, /* bitsize */ | ||
346 | + FALSE, /* pc_relative */ | ||
347 | + 0, /* bitpos */ | ||
348 | + complain_overflow_signed, /* complain_on_overflow */ | ||
349 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
350 | + "R_MIPS16_TLS_GD", /* name */ | ||
351 | + FALSE, /* partial_inplace */ | ||
352 | + 0x0000ffff, /* src_mask */ | ||
353 | + 0x0000ffff, /* dst_mask */ | ||
354 | + FALSE), /* pcrel_offset */ | ||
355 | + | ||
356 | + /* MIPS16 TLS local dynamic variable reference. */ | ||
357 | + HOWTO (R_MIPS16_TLS_LDM, /* type */ | ||
358 | + 0, /* rightshift */ | ||
359 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
360 | + 16, /* bitsize */ | ||
361 | + FALSE, /* pc_relative */ | ||
362 | + 0, /* bitpos */ | ||
363 | + complain_overflow_signed, /* complain_on_overflow */ | ||
364 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
365 | + "R_MIPS16_TLS_LDM", /* name */ | ||
366 | + FALSE, /* partial_inplace */ | ||
367 | + 0x0000ffff, /* src_mask */ | ||
368 | + 0x0000ffff, /* dst_mask */ | ||
369 | + FALSE), /* pcrel_offset */ | ||
370 | + | ||
371 | + /* MIPS16 TLS local dynamic offset. */ | ||
372 | + HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ | ||
373 | + 0, /* rightshift */ | ||
374 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
375 | + 16, /* bitsize */ | ||
376 | + FALSE, /* pc_relative */ | ||
377 | + 0, /* bitpos */ | ||
378 | + complain_overflow_signed, /* complain_on_overflow */ | ||
379 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
380 | + "R_MIPS16_TLS_DTPREL_HI16", /* name */ | ||
381 | + FALSE, /* partial_inplace */ | ||
382 | + 0x0000ffff, /* src_mask */ | ||
383 | + 0x0000ffff, /* dst_mask */ | ||
384 | + FALSE), /* pcrel_offset */ | ||
385 | + | ||
386 | + /* MIPS16 TLS local dynamic offset. */ | ||
387 | + HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ | ||
388 | + 0, /* rightshift */ | ||
389 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
390 | + 16, /* bitsize */ | ||
391 | + FALSE, /* pc_relative */ | ||
392 | + 0, /* bitpos */ | ||
393 | + complain_overflow_signed, /* complain_on_overflow */ | ||
394 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
395 | + "R_MIPS16_TLS_DTPREL_LO16", /* name */ | ||
396 | + FALSE, /* partial_inplace */ | ||
397 | + 0x0000ffff, /* src_mask */ | ||
398 | + 0x0000ffff, /* dst_mask */ | ||
399 | + FALSE), /* pcrel_offset */ | ||
400 | + | ||
401 | + /* MIPS16 TLS thread pointer offset. */ | ||
402 | + HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ | ||
403 | + 0, /* rightshift */ | ||
404 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
405 | + 16, /* bitsize */ | ||
406 | + FALSE, /* pc_relative */ | ||
407 | + 0, /* bitpos */ | ||
408 | + complain_overflow_signed, /* complain_on_overflow */ | ||
409 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
410 | + "R_MIPS16_TLS_GOTTPREL", /* name */ | ||
411 | + FALSE, /* partial_inplace */ | ||
412 | + 0x0000ffff, /* src_mask */ | ||
413 | + 0x0000ffff, /* dst_mask */ | ||
414 | + FALSE), /* pcrel_offset */ | ||
415 | + | ||
416 | + /* MIPS16 TLS thread pointer offset. */ | ||
417 | + HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ | ||
418 | + 0, /* rightshift */ | ||
419 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
420 | + 16, /* bitsize */ | ||
421 | + FALSE, /* pc_relative */ | ||
422 | + 0, /* bitpos */ | ||
423 | + complain_overflow_signed, /* complain_on_overflow */ | ||
424 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
425 | + "R_MIPS16_TLS_TPREL_HI16", /* name */ | ||
426 | + FALSE, /* partial_inplace */ | ||
427 | + 0x0000ffff, /* src_mask */ | ||
428 | + 0x0000ffff, /* dst_mask */ | ||
429 | + FALSE), /* pcrel_offset */ | ||
430 | + | ||
431 | + /* MIPS16 TLS thread pointer offset. */ | ||
432 | + HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ | ||
433 | + 0, /* rightshift */ | ||
434 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
435 | + 16, /* bitsize */ | ||
436 | + FALSE, /* pc_relative */ | ||
437 | + 0, /* bitpos */ | ||
438 | + complain_overflow_signed, /* complain_on_overflow */ | ||
439 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
440 | + "R_MIPS16_TLS_TPREL_LO16", /* name */ | ||
441 | + FALSE, /* partial_inplace */ | ||
442 | + 0x0000ffff, /* src_mask */ | ||
443 | + 0x0000ffff, /* dst_mask */ | ||
444 | + FALSE), /* pcrel_offset */ | ||
445 | }; | ||
446 | |||
447 | static reloc_howto_type micromips_elf64_howto_table_rel[] = | ||
448 | @@ -2908,6 +3118,15 @@ static const struct elf_reloc_map mips16_reloc_map[] = | ||
449 | { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min }, | ||
450 | { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, | ||
451 | { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, | ||
452 | + { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min }, | ||
453 | + { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min }, | ||
454 | + { BFD_RELOC_MIPS16_TLS_DTPREL_HI16, | ||
455 | + R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min }, | ||
456 | + { BFD_RELOC_MIPS16_TLS_DTPREL_LO16, | ||
457 | + R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min }, | ||
458 | + { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min }, | ||
459 | + { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min }, | ||
460 | + { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min } | ||
461 | }; | ||
462 | |||
463 | static const struct elf_reloc_map micromips_reloc_map[] = | ||
464 | diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c | ||
465 | index 00ec8b0..2189566 100644 | ||
466 | --- a/bfd/elfn32-mips.c | ||
467 | +++ b/bfd/elfn32-mips.c | ||
468 | @@ -1555,6 +1555,111 @@ static reloc_howto_type elf_mips16_howto_table_rel[] = | ||
469 | 0x0000ffff, /* src_mask */ | ||
470 | 0x0000ffff, /* dst_mask */ | ||
471 | FALSE), /* pcrel_offset */ | ||
472 | + | ||
473 | + /* MIPS16 TLS general dynamic variable reference. */ | ||
474 | + HOWTO (R_MIPS16_TLS_GD, /* type */ | ||
475 | + 0, /* rightshift */ | ||
476 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
477 | + 16, /* bitsize */ | ||
478 | + FALSE, /* pc_relative */ | ||
479 | + 0, /* bitpos */ | ||
480 | + complain_overflow_signed, /* complain_on_overflow */ | ||
481 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
482 | + "R_MIPS16_TLS_GD", /* name */ | ||
483 | + TRUE, /* partial_inplace */ | ||
484 | + 0x0000ffff, /* src_mask */ | ||
485 | + 0x0000ffff, /* dst_mask */ | ||
486 | + FALSE), /* pcrel_offset */ | ||
487 | + | ||
488 | + /* MIPS16 TLS local dynamic variable reference. */ | ||
489 | + HOWTO (R_MIPS16_TLS_LDM, /* type */ | ||
490 | + 0, /* rightshift */ | ||
491 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
492 | + 16, /* bitsize */ | ||
493 | + FALSE, /* pc_relative */ | ||
494 | + 0, /* bitpos */ | ||
495 | + complain_overflow_signed, /* complain_on_overflow */ | ||
496 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
497 | + "R_MIPS16_TLS_LDM", /* name */ | ||
498 | + TRUE, /* partial_inplace */ | ||
499 | + 0x0000ffff, /* src_mask */ | ||
500 | + 0x0000ffff, /* dst_mask */ | ||
501 | + FALSE), /* pcrel_offset */ | ||
502 | + | ||
503 | + /* MIPS16 TLS local dynamic offset. */ | ||
504 | + HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ | ||
505 | + 0, /* rightshift */ | ||
506 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
507 | + 16, /* bitsize */ | ||
508 | + FALSE, /* pc_relative */ | ||
509 | + 0, /* bitpos */ | ||
510 | + complain_overflow_signed, /* complain_on_overflow */ | ||
511 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
512 | + "R_MIPS16_TLS_DTPREL_HI16", /* name */ | ||
513 | + TRUE, /* partial_inplace */ | ||
514 | + 0x0000ffff, /* src_mask */ | ||
515 | + 0x0000ffff, /* dst_mask */ | ||
516 | + FALSE), /* pcrel_offset */ | ||
517 | + | ||
518 | + /* MIPS16 TLS local dynamic offset. */ | ||
519 | + HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ | ||
520 | + 0, /* rightshift */ | ||
521 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
522 | + 16, /* bitsize */ | ||
523 | + FALSE, /* pc_relative */ | ||
524 | + 0, /* bitpos */ | ||
525 | + complain_overflow_signed, /* complain_on_overflow */ | ||
526 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
527 | + "R_MIPS16_TLS_DTPREL_LO16", /* name */ | ||
528 | + TRUE, /* partial_inplace */ | ||
529 | + 0x0000ffff, /* src_mask */ | ||
530 | + 0x0000ffff, /* dst_mask */ | ||
531 | + FALSE), /* pcrel_offset */ | ||
532 | + | ||
533 | + /* MIPS16 TLS thread pointer offset. */ | ||
534 | + HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ | ||
535 | + 0, /* rightshift */ | ||
536 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
537 | + 16, /* bitsize */ | ||
538 | + FALSE, /* pc_relative */ | ||
539 | + 0, /* bitpos */ | ||
540 | + complain_overflow_signed, /* complain_on_overflow */ | ||
541 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
542 | + "R_MIPS16_TLS_GOTTPREL", /* name */ | ||
543 | + TRUE, /* partial_inplace */ | ||
544 | + 0x0000ffff, /* src_mask */ | ||
545 | + 0x0000ffff, /* dst_mask */ | ||
546 | + FALSE), /* pcrel_offset */ | ||
547 | + | ||
548 | + /* MIPS16 TLS thread pointer offset. */ | ||
549 | + HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ | ||
550 | + 0, /* rightshift */ | ||
551 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
552 | + 16, /* bitsize */ | ||
553 | + FALSE, /* pc_relative */ | ||
554 | + 0, /* bitpos */ | ||
555 | + complain_overflow_signed, /* complain_on_overflow */ | ||
556 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
557 | + "R_MIPS16_TLS_TPREL_HI16", /* name */ | ||
558 | + TRUE, /* partial_inplace */ | ||
559 | + 0x0000ffff, /* src_mask */ | ||
560 | + 0x0000ffff, /* dst_mask */ | ||
561 | + FALSE), /* pcrel_offset */ | ||
562 | + | ||
563 | + /* MIPS16 TLS thread pointer offset. */ | ||
564 | + HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ | ||
565 | + 0, /* rightshift */ | ||
566 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
567 | + 16, /* bitsize */ | ||
568 | + FALSE, /* pc_relative */ | ||
569 | + 0, /* bitpos */ | ||
570 | + complain_overflow_signed, /* complain_on_overflow */ | ||
571 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
572 | + "R_MIPS16_TLS_TPREL_LO16", /* name */ | ||
573 | + TRUE, /* partial_inplace */ | ||
574 | + 0x0000ffff, /* src_mask */ | ||
575 | + 0x0000ffff, /* dst_mask */ | ||
576 | + FALSE), /* pcrel_offset */ | ||
577 | }; | ||
578 | |||
579 | static reloc_howto_type elf_mips16_howto_table_rela[] = | ||
580 | @@ -1651,6 +1756,111 @@ static reloc_howto_type elf_mips16_howto_table_rela[] = | ||
581 | 0x0000ffff, /* src_mask */ | ||
582 | 0x0000ffff, /* dst_mask */ | ||
583 | FALSE), /* pcrel_offset */ | ||
584 | + | ||
585 | + /* MIPS16 TLS general dynamic variable reference. */ | ||
586 | + HOWTO (R_MIPS16_TLS_GD, /* type */ | ||
587 | + 0, /* rightshift */ | ||
588 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
589 | + 16, /* bitsize */ | ||
590 | + FALSE, /* pc_relative */ | ||
591 | + 0, /* bitpos */ | ||
592 | + complain_overflow_signed, /* complain_on_overflow */ | ||
593 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
594 | + "R_MIPS16_TLS_GD", /* name */ | ||
595 | + FALSE, /* partial_inplace */ | ||
596 | + 0x0000ffff, /* src_mask */ | ||
597 | + 0x0000ffff, /* dst_mask */ | ||
598 | + FALSE), /* pcrel_offset */ | ||
599 | + | ||
600 | + /* MIPS16 TLS local dynamic variable reference. */ | ||
601 | + HOWTO (R_MIPS16_TLS_LDM, /* type */ | ||
602 | + 0, /* rightshift */ | ||
603 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
604 | + 16, /* bitsize */ | ||
605 | + FALSE, /* pc_relative */ | ||
606 | + 0, /* bitpos */ | ||
607 | + complain_overflow_signed, /* complain_on_overflow */ | ||
608 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
609 | + "R_MIPS16_TLS_LDM", /* name */ | ||
610 | + FALSE, /* partial_inplace */ | ||
611 | + 0x0000ffff, /* src_mask */ | ||
612 | + 0x0000ffff, /* dst_mask */ | ||
613 | + FALSE), /* pcrel_offset */ | ||
614 | + | ||
615 | + /* MIPS16 TLS local dynamic offset. */ | ||
616 | + HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ | ||
617 | + 0, /* rightshift */ | ||
618 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
619 | + 16, /* bitsize */ | ||
620 | + FALSE, /* pc_relative */ | ||
621 | + 0, /* bitpos */ | ||
622 | + complain_overflow_signed, /* complain_on_overflow */ | ||
623 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
624 | + "R_MIPS16_TLS_DTPREL_HI16", /* name */ | ||
625 | + FALSE, /* partial_inplace */ | ||
626 | + 0x0000ffff, /* src_mask */ | ||
627 | + 0x0000ffff, /* dst_mask */ | ||
628 | + FALSE), /* pcrel_offset */ | ||
629 | + | ||
630 | + /* MIPS16 TLS local dynamic offset. */ | ||
631 | + HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ | ||
632 | + 0, /* rightshift */ | ||
633 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
634 | + 16, /* bitsize */ | ||
635 | + FALSE, /* pc_relative */ | ||
636 | + 0, /* bitpos */ | ||
637 | + complain_overflow_signed, /* complain_on_overflow */ | ||
638 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
639 | + "R_MIPS16_TLS_DTPREL_LO16", /* name */ | ||
640 | + FALSE, /* partial_inplace */ | ||
641 | + 0x0000ffff, /* src_mask */ | ||
642 | + 0x0000ffff, /* dst_mask */ | ||
643 | + FALSE), /* pcrel_offset */ | ||
644 | + | ||
645 | + /* MIPS16 TLS thread pointer offset. */ | ||
646 | + HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ | ||
647 | + 0, /* rightshift */ | ||
648 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
649 | + 16, /* bitsize */ | ||
650 | + FALSE, /* pc_relative */ | ||
651 | + 0, /* bitpos */ | ||
652 | + complain_overflow_signed, /* complain_on_overflow */ | ||
653 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
654 | + "R_MIPS16_TLS_GOTTPREL", /* name */ | ||
655 | + FALSE, /* partial_inplace */ | ||
656 | + 0x0000ffff, /* src_mask */ | ||
657 | + 0x0000ffff, /* dst_mask */ | ||
658 | + FALSE), /* pcrel_offset */ | ||
659 | + | ||
660 | + /* MIPS16 TLS thread pointer offset. */ | ||
661 | + HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ | ||
662 | + 0, /* rightshift */ | ||
663 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
664 | + 16, /* bitsize */ | ||
665 | + FALSE, /* pc_relative */ | ||
666 | + 0, /* bitpos */ | ||
667 | + complain_overflow_signed, /* complain_on_overflow */ | ||
668 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
669 | + "R_MIPS16_TLS_TPREL_HI16", /* name */ | ||
670 | + FALSE, /* partial_inplace */ | ||
671 | + 0x0000ffff, /* src_mask */ | ||
672 | + 0x0000ffff, /* dst_mask */ | ||
673 | + FALSE), /* pcrel_offset */ | ||
674 | + | ||
675 | + /* MIPS16 TLS thread pointer offset. */ | ||
676 | + HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ | ||
677 | + 0, /* rightshift */ | ||
678 | + 2, /* size (0 = byte, 1 = short, 2 = long) */ | ||
679 | + 16, /* bitsize */ | ||
680 | + FALSE, /* pc_relative */ | ||
681 | + 0, /* bitpos */ | ||
682 | + complain_overflow_signed, /* complain_on_overflow */ | ||
683 | + _bfd_mips_elf_generic_reloc, /* special_function */ | ||
684 | + "R_MIPS16_TLS_TPREL_LO16", /* name */ | ||
685 | + FALSE, /* partial_inplace */ | ||
686 | + 0x0000ffff, /* src_mask */ | ||
687 | + 0x0000ffff, /* dst_mask */ | ||
688 | + FALSE), /* pcrel_offset */ | ||
689 | }; | ||
690 | |||
691 | static reloc_howto_type elf_micromips_howto_table_rel[] = | ||
692 | @@ -2724,6 +2934,15 @@ static const struct elf_reloc_map mips16_reloc_map[] = | ||
693 | { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min }, | ||
694 | { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, | ||
695 | { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, | ||
696 | + { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min }, | ||
697 | + { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min }, | ||
698 | + { BFD_RELOC_MIPS16_TLS_DTPREL_HI16, | ||
699 | + R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min }, | ||
700 | + { BFD_RELOC_MIPS16_TLS_DTPREL_LO16, | ||
701 | + R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min }, | ||
702 | + { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min }, | ||
703 | + { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min }, | ||
704 | + { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min } | ||
705 | }; | ||
706 | |||
707 | static const struct elf_reloc_map micromips_reloc_map[] = | ||
708 | diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c | ||
709 | index 9f3833b..fa906cd 100644 | ||
710 | --- a/bfd/elfxx-mips.c | ||
711 | +++ b/bfd/elfxx-mips.c | ||
712 | @@ -529,6 +529,13 @@ struct mips_htab_traverse_info | ||
713 | || r_type == R_MIPS_TLS_TPREL64 \ | ||
714 | || r_type == R_MIPS_TLS_TPREL_HI16 \ | ||
715 | || r_type == R_MIPS_TLS_TPREL_LO16 \ | ||
716 | + || r_type == R_MIPS16_TLS_GD \ | ||
717 | + || r_type == R_MIPS16_TLS_LDM \ | ||
718 | + || r_type == R_MIPS16_TLS_DTPREL_HI16 \ | ||
719 | + || r_type == R_MIPS16_TLS_DTPREL_LO16 \ | ||
720 | + || r_type == R_MIPS16_TLS_GOTTPREL \ | ||
721 | + || r_type == R_MIPS16_TLS_TPREL_HI16 \ | ||
722 | + || r_type == R_MIPS16_TLS_TPREL_LO16 \ | ||
723 | || r_type == R_MICROMIPS_TLS_GD \ | ||
724 | || r_type == R_MICROMIPS_TLS_LDM \ | ||
725 | || r_type == R_MICROMIPS_TLS_DTPREL_HI16 \ | ||
726 | @@ -1885,6 +1892,13 @@ mips16_reloc_p (int r_type) | ||
727 | case R_MIPS16_CALL16: | ||
728 | case R_MIPS16_HI16: | ||
729 | case R_MIPS16_LO16: | ||
730 | + case R_MIPS16_TLS_GD: | ||
731 | + case R_MIPS16_TLS_LDM: | ||
732 | + case R_MIPS16_TLS_DTPREL_HI16: | ||
733 | + case R_MIPS16_TLS_DTPREL_LO16: | ||
734 | + case R_MIPS16_TLS_GOTTPREL: | ||
735 | + case R_MIPS16_TLS_TPREL_HI16: | ||
736 | + case R_MIPS16_TLS_TPREL_LO16: | ||
737 | return TRUE; | ||
738 | |||
739 | default: | ||
740 | @@ -2012,19 +2026,25 @@ micromips_branch_reloc_p (int r_type) | ||
741 | static inline bfd_boolean | ||
742 | tls_gd_reloc_p (unsigned int r_type) | ||
743 | { | ||
744 | - return r_type == R_MIPS_TLS_GD || r_type == R_MICROMIPS_TLS_GD; | ||
745 | + return (r_type == R_MIPS_TLS_GD | ||
746 | + || r_type == R_MIPS16_TLS_GD | ||
747 | + || r_type == R_MICROMIPS_TLS_GD); | ||
748 | } | ||
749 | |||
750 | static inline bfd_boolean | ||
751 | tls_ldm_reloc_p (unsigned int r_type) | ||
752 | { | ||
753 | - return r_type == R_MIPS_TLS_LDM || r_type == R_MICROMIPS_TLS_LDM; | ||
754 | + return (r_type == R_MIPS_TLS_LDM | ||
755 | + || r_type == R_MIPS16_TLS_LDM | ||
756 | + || r_type == R_MICROMIPS_TLS_LDM); | ||
757 | } | ||
758 | |||
759 | static inline bfd_boolean | ||
760 | tls_gottprel_reloc_p (unsigned int r_type) | ||
761 | { | ||
762 | - return r_type == R_MIPS_TLS_GOTTPREL || r_type == R_MICROMIPS_TLS_GOTTPREL; | ||
763 | + return (r_type == R_MIPS_TLS_GOTTPREL | ||
764 | + || r_type == R_MIPS16_TLS_GOTTPREL | ||
765 | + || r_type == R_MICROMIPS_TLS_GOTTPREL); | ||
766 | } | ||
767 | |||
768 | void | ||
769 | @@ -5361,6 +5381,9 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, | ||
770 | case R_MIPS_TLS_GD: | ||
771 | case R_MIPS_TLS_GOTTPREL: | ||
772 | case R_MIPS_TLS_LDM: | ||
773 | + case R_MIPS16_TLS_GD: | ||
774 | + case R_MIPS16_TLS_GOTTPREL: | ||
775 | + case R_MIPS16_TLS_LDM: | ||
776 | case R_MICROMIPS_TLS_GD: | ||
777 | case R_MICROMIPS_TLS_GOTTPREL: | ||
778 | case R_MICROMIPS_TLS_LDM: | ||
779 | @@ -5530,6 +5553,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, | ||
780 | break; | ||
781 | |||
782 | case R_MIPS_TLS_DTPREL_HI16: | ||
783 | + case R_MIPS16_TLS_DTPREL_HI16: | ||
784 | case R_MICROMIPS_TLS_DTPREL_HI16: | ||
785 | value = (mips_elf_high (addend + symbol - dtprel_base (info)) | ||
786 | & howto->dst_mask); | ||
787 | @@ -5538,17 +5562,22 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, | ||
788 | case R_MIPS_TLS_DTPREL_LO16: | ||
789 | case R_MIPS_TLS_DTPREL32: | ||
790 | case R_MIPS_TLS_DTPREL64: | ||
791 | + case R_MIPS16_TLS_DTPREL_LO16: | ||
792 | case R_MICROMIPS_TLS_DTPREL_LO16: | ||
793 | value = (symbol + addend - dtprel_base (info)) & howto->dst_mask; | ||
794 | break; | ||
795 | |||
796 | case R_MIPS_TLS_TPREL_HI16: | ||
797 | + case R_MIPS16_TLS_TPREL_HI16: | ||
798 | case R_MICROMIPS_TLS_TPREL_HI16: | ||
799 | value = (mips_elf_high (addend + symbol - tprel_base (info)) | ||
800 | & howto->dst_mask); | ||
801 | break; | ||
802 | |||
803 | case R_MIPS_TLS_TPREL_LO16: | ||
804 | + case R_MIPS_TLS_TPREL32: | ||
805 | + case R_MIPS_TLS_TPREL64: | ||
806 | + case R_MIPS16_TLS_TPREL_LO16: | ||
807 | case R_MICROMIPS_TLS_TPREL_LO16: | ||
808 | value = (symbol + addend - tprel_base (info)) & howto->dst_mask; | ||
809 | break; | ||
810 | @@ -5681,6 +5710,9 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, | ||
811 | case R_MIPS_TLS_GOTTPREL: | ||
812 | case R_MIPS_TLS_LDM: | ||
813 | case R_MIPS_GOT_DISP: | ||
814 | + case R_MIPS16_TLS_GD: | ||
815 | + case R_MIPS16_TLS_GOTTPREL: | ||
816 | + case R_MIPS16_TLS_LDM: | ||
817 | case R_MICROMIPS_TLS_GD: | ||
818 | case R_MICROMIPS_TLS_GOTTPREL: | ||
819 | case R_MICROMIPS_TLS_LDM: | ||
820 | @@ -7813,8 +7845,6 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
821 | can_make_dynamic_p = FALSE; | ||
822 | switch (r_type) | ||
823 | { | ||
824 | - case R_MIPS16_GOT16: | ||
825 | - case R_MIPS16_CALL16: | ||
826 | case R_MIPS_GOT16: | ||
827 | case R_MIPS_CALL16: | ||
828 | case R_MIPS_CALL_HI16: | ||
829 | @@ -7827,6 +7857,11 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
830 | case R_MIPS_TLS_GOTTPREL: | ||
831 | case R_MIPS_TLS_GD: | ||
832 | case R_MIPS_TLS_LDM: | ||
833 | + case R_MIPS16_GOT16: | ||
834 | + case R_MIPS16_CALL16: | ||
835 | + case R_MIPS16_TLS_GOTTPREL: | ||
836 | + case R_MIPS16_TLS_GD: | ||
837 | + case R_MIPS16_TLS_LDM: | ||
838 | case R_MICROMIPS_GOT16: | ||
839 | case R_MICROMIPS_CALL16: | ||
840 | case R_MICROMIPS_CALL_HI16: | ||
841 | @@ -8063,12 +8098,14 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
842 | break; | ||
843 | |||
844 | case R_MIPS_TLS_GOTTPREL: | ||
845 | + case R_MIPS16_TLS_GOTTPREL: | ||
846 | case R_MICROMIPS_TLS_GOTTPREL: | ||
847 | if (info->shared) | ||
848 | info->flags |= DF_STATIC_TLS; | ||
849 | /* Fall through */ | ||
850 | |||
851 | case R_MIPS_TLS_LDM: | ||
852 | + case R_MIPS16_TLS_LDM: | ||
853 | case R_MICROMIPS_TLS_LDM: | ||
854 | if (tls_ldm_reloc_p (r_type)) | ||
855 | { | ||
856 | @@ -8078,6 +8115,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
857 | /* Fall through */ | ||
858 | |||
859 | case R_MIPS_TLS_GD: | ||
860 | + case R_MIPS16_TLS_GD: | ||
861 | case R_MICROMIPS_TLS_GD: | ||
862 | /* This symbol requires a global offset table entry, or two | ||
863 | for TLS GD relocations. */ | ||
864 | diff --git a/bfd/libbfd.h b/bfd/libbfd.h | ||
865 | index 200a6fa..0395ec2 100644 | ||
866 | --- a/bfd/libbfd.h | ||
867 | +++ b/bfd/libbfd.h | ||
868 | @@ -1086,6 +1086,13 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", | ||
869 | "BFD_RELOC_MIPS16_HI16", | ||
870 | "BFD_RELOC_MIPS16_HI16_S", | ||
871 | "BFD_RELOC_MIPS16_LO16", | ||
872 | + "BFD_RELOC_MIPS16_TLS_GD", | ||
873 | + "BFD_RELOC_MIPS16_TLS_LDM", | ||
874 | + "BFD_RELOC_MIPS16_TLS_DTPREL_HI16", | ||
875 | + "BFD_RELOC_MIPS16_TLS_DTPREL_LO16", | ||
876 | + "BFD_RELOC_MIPS16_TLS_GOTTPREL", | ||
877 | + "BFD_RELOC_MIPS16_TLS_TPREL_HI16", | ||
878 | + "BFD_RELOC_MIPS16_TLS_TPREL_LO16", | ||
879 | "BFD_RELOC_MIPS_LITERAL", | ||
880 | "BFD_RELOC_MICROMIPS_LITERAL", | ||
881 | "BFD_RELOC_MICROMIPS_7_PCREL_S1", | ||
882 | diff --git a/bfd/reloc.c b/bfd/reloc.c | ||
883 | index 6ac7148..ef55cc3 100644 | ||
884 | --- a/bfd/reloc.c | ||
885 | +++ b/bfd/reloc.c | ||
886 | @@ -2247,6 +2247,23 @@ ENUMDOC | ||
887 | MIPS16 low 16 bits. | ||
888 | |||
889 | ENUM | ||
890 | + BFD_RELOC_MIPS16_TLS_GD | ||
891 | +ENUMX | ||
892 | + BFD_RELOC_MIPS16_TLS_LDM | ||
893 | +ENUMX | ||
894 | + BFD_RELOC_MIPS16_TLS_DTPREL_HI16 | ||
895 | +ENUMX | ||
896 | + BFD_RELOC_MIPS16_TLS_DTPREL_LO16 | ||
897 | +ENUMX | ||
898 | + BFD_RELOC_MIPS16_TLS_GOTTPREL | ||
899 | +ENUMX | ||
900 | + BFD_RELOC_MIPS16_TLS_TPREL_HI16 | ||
901 | +ENUMX | ||
902 | + BFD_RELOC_MIPS16_TLS_TPREL_LO16 | ||
903 | +ENUMDOC | ||
904 | + MIPS16 TLS relocations | ||
905 | + | ||
906 | +ENUM | ||
907 | BFD_RELOC_MIPS_LITERAL | ||
908 | ENUMX | ||
909 | BFD_RELOC_MICROMIPS_LITERAL | ||
910 | diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c | ||
911 | index 0e4c66e..0fb3a6e 100644 | ||
912 | --- a/gas/config/tc-mips.c | ||
913 | +++ b/gas/config/tc-mips.c | ||
914 | @@ -1352,6 +1352,8 @@ static void s_cprestore (int); | ||
915 | static void s_cpreturn (int); | ||
916 | static void s_dtprelword (int); | ||
917 | static void s_dtpreldword (int); | ||
918 | +static void s_tprelword (int); | ||
919 | +static void s_tpreldword (int); | ||
920 | static void s_gpvalue (int); | ||
921 | static void s_gpword (int); | ||
922 | static void s_gpdword (int); | ||
923 | @@ -1431,6 +1433,8 @@ static const pseudo_typeS mips_pseudo_table[] = | ||
924 | {"cpreturn", s_cpreturn, 0}, | ||
925 | {"dtprelword", s_dtprelword, 0}, | ||
926 | {"dtpreldword", s_dtpreldword, 0}, | ||
927 | + {"tprelword", s_tprelword, 0}, | ||
928 | + {"tpreldword", s_tpreldword, 0}, | ||
929 | {"gpvalue", s_gpvalue, 0}, | ||
930 | {"gpword", s_gpword, 0}, | ||
931 | {"gpdword", s_gpdword, 0}, | ||
932 | @@ -14040,7 +14044,14 @@ static const struct percent_op_match mips16_percent_op[] = | ||
933 | {"%gprel", BFD_RELOC_MIPS16_GPREL}, | ||
934 | {"%got", BFD_RELOC_MIPS16_GOT16}, | ||
935 | {"%call16", BFD_RELOC_MIPS16_CALL16}, | ||
936 | - {"%hi", BFD_RELOC_MIPS16_HI16_S} | ||
937 | + {"%hi", BFD_RELOC_MIPS16_HI16_S}, | ||
938 | + {"%tlsgd", BFD_RELOC_MIPS16_TLS_GD}, | ||
939 | + {"%tlsldm", BFD_RELOC_MIPS16_TLS_LDM}, | ||
940 | + {"%dtprel_hi", BFD_RELOC_MIPS16_TLS_DTPREL_HI16}, | ||
941 | + {"%dtprel_lo", BFD_RELOC_MIPS16_TLS_DTPREL_LO16}, | ||
942 | + {"%tprel_hi", BFD_RELOC_MIPS16_TLS_TPREL_HI16}, | ||
943 | + {"%tprel_lo", BFD_RELOC_MIPS16_TLS_TPREL_LO16}, | ||
944 | + {"%gottprel", BFD_RELOC_MIPS16_TLS_GOTTPREL} | ||
945 | }; | ||
946 | |||
947 | |||
948 | @@ -15369,6 +15380,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) | ||
949 | case BFD_RELOC_MIPS_TLS_DTPREL_HI16: | ||
950 | case BFD_RELOC_MIPS_TLS_DTPREL_LO16: | ||
951 | case BFD_RELOC_MIPS_TLS_GOTTPREL: | ||
952 | + case BFD_RELOC_MIPS_TLS_TPREL32: | ||
953 | + case BFD_RELOC_MIPS_TLS_TPREL64: | ||
954 | case BFD_RELOC_MIPS_TLS_TPREL_HI16: | ||
955 | case BFD_RELOC_MIPS_TLS_TPREL_LO16: | ||
956 | case BFD_RELOC_MICROMIPS_TLS_GD: | ||
957 | @@ -15378,6 +15391,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) | ||
958 | case BFD_RELOC_MICROMIPS_TLS_GOTTPREL: | ||
959 | case BFD_RELOC_MICROMIPS_TLS_TPREL_HI16: | ||
960 | case BFD_RELOC_MICROMIPS_TLS_TPREL_LO16: | ||
961 | + case BFD_RELOC_MIPS16_TLS_GD: | ||
962 | + case BFD_RELOC_MIPS16_TLS_LDM: | ||
963 | + case BFD_RELOC_MIPS16_TLS_DTPREL_HI16: | ||
964 | + case BFD_RELOC_MIPS16_TLS_DTPREL_LO16: | ||
965 | + case BFD_RELOC_MIPS16_TLS_GOTTPREL: | ||
966 | + case BFD_RELOC_MIPS16_TLS_TPREL_HI16: | ||
967 | + case BFD_RELOC_MIPS16_TLS_TPREL_LO16: | ||
968 | S_SET_THREAD_LOCAL (fixP->fx_addsy); | ||
969 | /* fall through */ | ||
970 | |||
971 | @@ -16547,12 +16567,14 @@ s_cpreturn (int ignore ATTRIBUTE_UNUSED) | ||
972 | demand_empty_rest_of_line (); | ||
973 | } | ||
974 | |||
975 | -/* Handle the .dtprelword and .dtpreldword pseudo-ops. They generate | ||
976 | - a 32-bit or 64-bit DTP-relative relocation (BYTES says which) for | ||
977 | - use in DWARF debug information. */ | ||
978 | +/* Handle a .dtprelword, .dtpreldword, .tprelword, or .tpreldword | ||
979 | + pseudo-op; DIRSTR says which. The pseudo-op generates a BYTES-size | ||
980 | + DTP- or TP-relative relocation of type RTYPE, for use in either DWARF | ||
981 | + debug information or MIPS16 TLS. */ | ||
982 | |||
983 | static void | ||
984 | -s_dtprel_internal (size_t bytes) | ||
985 | +s_tls_rel_directive (const size_t bytes, const char *dirstr, | ||
986 | + bfd_reloc_code_real_type rtype) | ||
987 | { | ||
988 | expressionS ex; | ||
989 | char *p; | ||
990 | @@ -16561,19 +16583,13 @@ s_dtprel_internal (size_t bytes) | ||
991 | |||
992 | if (ex.X_op != O_symbol) | ||
993 | { | ||
994 | - as_bad (_("Unsupported use of %s"), (bytes == 8 | ||
995 | - ? ".dtpreldword" | ||
996 | - : ".dtprelword")); | ||
997 | + as_bad (_("Unsupported use of %s"), dirstr); | ||
998 | ignore_rest_of_line (); | ||
999 | } | ||
1000 | |||
1001 | p = frag_more (bytes); | ||
1002 | md_number_to_chars (p, 0, bytes); | ||
1003 | - fix_new_exp (frag_now, p - frag_now->fr_literal, bytes, &ex, FALSE, | ||
1004 | - (bytes == 8 | ||
1005 | - ? BFD_RELOC_MIPS_TLS_DTPREL64 | ||
1006 | - : BFD_RELOC_MIPS_TLS_DTPREL32)); | ||
1007 | - | ||
1008 | + fix_new_exp (frag_now, p - frag_now->fr_literal, bytes, &ex, FALSE, rtype); | ||
1009 | demand_empty_rest_of_line (); | ||
1010 | } | ||
1011 | |||
1012 | @@ -16582,7 +16598,7 @@ s_dtprel_internal (size_t bytes) | ||
1013 | static void | ||
1014 | s_dtprelword (int ignore ATTRIBUTE_UNUSED) | ||
1015 | { | ||
1016 | - s_dtprel_internal (4); | ||
1017 | + s_tls_rel_directive (4, ".dtprelword", BFD_RELOC_MIPS_TLS_DTPREL32); | ||
1018 | } | ||
1019 | |||
1020 | /* Handle .dtpreldword. */ | ||
1021 | @@ -16590,7 +16606,23 @@ s_dtprelword (int ignore ATTRIBUTE_UNUSED) | ||
1022 | static void | ||
1023 | s_dtpreldword (int ignore ATTRIBUTE_UNUSED) | ||
1024 | { | ||
1025 | - s_dtprel_internal (8); | ||
1026 | + s_tls_rel_directive (8, ".dtpreldword", BFD_RELOC_MIPS_TLS_DTPREL64); | ||
1027 | +} | ||
1028 | + | ||
1029 | +/* Handle .tprelword. */ | ||
1030 | + | ||
1031 | +static void | ||
1032 | +s_tprelword (int ignore ATTRIBUTE_UNUSED) | ||
1033 | +{ | ||
1034 | + s_tls_rel_directive (4, ".tprelword", BFD_RELOC_MIPS_TLS_TPREL32); | ||
1035 | +} | ||
1036 | + | ||
1037 | +/* Handle .tpreldword. */ | ||
1038 | + | ||
1039 | +static void | ||
1040 | +s_tpreldword (int ignore ATTRIBUTE_UNUSED) | ||
1041 | +{ | ||
1042 | + s_tls_rel_directive (8, ".tpreldword", BFD_RELOC_MIPS_TLS_TPREL64); | ||
1043 | } | ||
1044 | |||
1045 | /* Handle the .gpvalue pseudo-op. This is used when generating NewABI PIC | ||
1046 | diff --git a/include/elf/mips.h b/include/elf/mips.h | ||
1047 | index db5fa54..c2c5922 100644 | ||
1048 | --- a/include/elf/mips.h | ||
1049 | +++ b/include/elf/mips.h | ||
1050 | @@ -98,7 +98,14 @@ START_RELOC_NUMBERS (elf_mips_reloc_type) | ||
1051 | RELOC_NUMBER (R_MIPS16_CALL16, 103) | ||
1052 | RELOC_NUMBER (R_MIPS16_HI16, 104) | ||
1053 | RELOC_NUMBER (R_MIPS16_LO16, 105) | ||
1054 | - FAKE_RELOC (R_MIPS16_max, 106) | ||
1055 | + RELOC_NUMBER (R_MIPS16_TLS_GD, 106) | ||
1056 | + RELOC_NUMBER (R_MIPS16_TLS_LDM, 107) | ||
1057 | + RELOC_NUMBER (R_MIPS16_TLS_DTPREL_HI16, 108) | ||
1058 | + RELOC_NUMBER (R_MIPS16_TLS_DTPREL_LO16, 109) | ||
1059 | + RELOC_NUMBER (R_MIPS16_TLS_GOTTPREL, 110) | ||
1060 | + RELOC_NUMBER (R_MIPS16_TLS_TPREL_HI16, 111) | ||
1061 | + RELOC_NUMBER (R_MIPS16_TLS_TPREL_LO16, 112) | ||
1062 | + FAKE_RELOC (R_MIPS16_max, 113) | ||
1063 | /* These relocations are specific to VxWorks. */ | ||
1064 | RELOC_NUMBER (R_MIPS_COPY, 126) | ||
1065 | RELOC_NUMBER (R_MIPS_JUMP_SLOT, 127) | ||
1066 | -- | ||
1067 | 1.7.9.5 | ||
1068 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0038-Copy-from-mainline-to-binutils-2.22-branch.patch b/meta/recipes-devtools/binutils/binutils/0038-Copy-from-mainline-to-binutils-2.22-branch.patch new file mode 100644 index 0000000000..453ef2211c --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0038-Copy-from-mainline-to-binutils-2.22-branch.patch | |||
@@ -0,0 +1,1944 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From 624da0376264205e399bc14fe2fa7b6fa659d0ee Mon Sep 17 00:00:00 2001 | ||
4 | From: Ian Lance Taylor <ian@airs.com> | ||
5 | Date: Mon, 19 Dec 2011 21:14:39 +0000 | ||
6 | Subject: [PATCH 038/262] Copy from mainline to binutils 2.22 branch: | ||
7 | |||
8 | 2011-12-17 Cary Coutant <ccoutant@google.com> | ||
9 | |||
10 | * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts. | ||
11 | * resolve.cc (Symbol_table::resolve): Likewise. | ||
12 | * i386.cc (Target_i386::do_code_fill): Use char constants for nop | ||
13 | arrays. | ||
14 | * x86_64.cc (Target_x86_64::do_code_fill): Likewise. | ||
15 | |||
16 | 2011-10-31 Cary Coutant <ccoutant@google.com> | ||
17 | |||
18 | PR gold/13023 | ||
19 | * expression.cc (Expression::eval_with_dot): Add | ||
20 | is_section_dot_assignment parameter. | ||
21 | (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is | ||
22 | absolute and assigning to dot within a section. | ||
23 | * script-sections.cc | ||
24 | (Output_section_element_assignment::set_section_addresses): Pass | ||
25 | dot_section to set_if_absolute. | ||
26 | (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE | ||
27 | as is_section_dot_assignment flag to eval_with_dot. | ||
28 | (Output_section_element_dot_assignment::set_section_addresses): | ||
29 | Likewise. | ||
30 | * script.cc (Symbol_assignment::set_if_absolute): Add dot_section | ||
31 | parameter. Also set value if relative to dot_section; set the | ||
32 | symbol's output_section. | ||
33 | * script.h (Expression::eval_with_dot): Add is_section_dot_assignment | ||
34 | parameter. Adjust all callers. | ||
35 | (Expression::eval_maybe_dot): Likewise. | ||
36 | (Symbol_assignment::set_if_absolute): Add dot_section parameter. | ||
37 | Adjust all callers. | ||
38 | * testsuite/script_test_2.t: Test assignment of an absolute value | ||
39 | to dot within an output section element. | ||
40 | |||
41 | 2011-10-31 Cary Coutant <ccoutant@google.com> | ||
42 | |||
43 | * options.h (class General_options): Add --[no-]gnu-unique options. | ||
44 | * symtab.cc (Symbol_table::sized_write_globals): Convert | ||
45 | STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique. | ||
46 | |||
47 | 2011-10-31 Cary Coutant <ccoutant@google.com> | ||
48 | |||
49 | PR gold/13359 | ||
50 | * i386.cc (Target_i386::Relocate::relocate_tls): Remove | ||
51 | unnecessary assertion. | ||
52 | * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise. | ||
53 | |||
54 | 2011-10-31 Sriraman Tallam <tmsriram@google.com> | ||
55 | |||
56 | * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to | ||
57 | gc_mark_symbol. | ||
58 | * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to | ||
59 | gc_mark_symbol. | ||
60 | Change to just keep the section associated with symbol. | ||
61 | (Symbol_table::add_from_relobj): Mark symbols as not garbage when | ||
62 | they are externally visible and --export-dynamic is turned on. | ||
63 | (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol. | ||
64 | |||
65 | 2011-10-19 Ian Lance Taylor <iant@google.com> | ||
66 | |||
67 | PR gold/13163 | ||
68 | * script-sections.cc | ||
69 | (Output_section_element_dot_assignment::needs_output_section): New | ||
70 | function. | ||
71 | |||
72 | 2011-10-19 Ian Lance Taylor <iant@google.com> | ||
73 | |||
74 | PR gold/13204 | ||
75 | * layout.cc (Layout::segment_precedes): Don't assert failure if a | ||
76 | --section-start option was seen. | ||
77 | * options.h (General_options::any_section_start): New function. | ||
78 | |||
79 | 2011-10-18 Cary Coutant <ccoutant@google.com> | ||
80 | |||
81 | * output.cc (posix_fallocate): Return 0 on success, errno on failure. | ||
82 | (Output_file::map_no_anonymous): Check for non-zero | ||
83 | return code from posix_fallocate. | ||
84 | |||
85 | 2011-10-17 Cary Coutant <ccoutant@google.com> | ||
86 | |||
87 | PR gold/13245 | ||
88 | * plugin.cc (is_visible_from_outside): Check for symbols | ||
89 | referenced from dynamic objects. | ||
90 | * resolve.cc (Symbol_table::resolve): Don't count references | ||
91 | from dynamic objects as references from real ELF files. | ||
92 | * testsuite/plugin_test_2.sh: Adjust expected result. | ||
93 | |||
94 | 2011-10-17 Cary Coutant <ccoutant@google.com> | ||
95 | |||
96 | * readsyms.cc (Read_symbols::run): Don't queue an unblocker | ||
97 | task for members of lib groups. | ||
98 | |||
99 | 2011-10-17 Cary Coutant <ccoutant@google.com> | ||
100 | |||
101 | PR gold/13288 | ||
102 | * fileread.cc (File_read::find_view): Add assert. | ||
103 | (File_read::make_view): Move bounds check (replace with assert)... | ||
104 | (File_read::find_or_make_view): ... to here. | ||
105 | |||
106 | 2011-10-12 Cary Coutant <ccoutant@google.com> | ||
107 | |||
108 | * output.cc (Output_file::open_base_file): Handle case where | ||
109 | ::read returns less than requested size. | ||
110 | |||
111 | 2011-10-10 Cary Coutant <ccoutant@google.com> | ||
112 | |||
113 | * incremental.cc (Sized_relobj_incr::Sized_relobj_incr): | ||
114 | Initialize defined_count_. | ||
115 | (Sized_relobj_incr::do_add_symbols): Count defined symbols. | ||
116 | (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite. | ||
117 | (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_. | ||
118 | (Sized_incr_dynobj::do_add_symbols): Count defined symbols. | ||
119 | (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite. | ||
120 | * incremental.h (Sized_relobj_incr::defined_count_): New data | ||
121 | member. | ||
122 | (Sized_incr_dynobj::defined_count_): New data member. | ||
123 | * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts): | ||
124 | Return zeroes instead of internal error. | ||
125 | |||
126 | 2011-10-10 Cary Coutant <ccoutant@google.com> | ||
127 | |||
128 | PR gold/13249 | ||
129 | * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag. | ||
130 | (Output_reloc::symbol_value): Return PLT offset if flag is set. | ||
131 | * output.h (class Output_reloc): Add use_plt_offset flag. | ||
132 | (Output_reloc::type_): Adjust size of bit field. | ||
133 | (Output_reloc::use_plt_offset_): New bit field. | ||
134 | (class Output_data_reloc): Adjust all calls to Output_reloc_type. | ||
135 | (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset | ||
136 | flag. Adjust all callers. | ||
137 | * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when | ||
138 | creating RELATIVE relocations. | ||
139 | |||
140 | 2011-10-03 Diego Novillo <dnovillo@google.com> | ||
141 | |||
142 | * options.cc (parse_uint): Fix dereference of RETVAL. | ||
143 | |||
144 | 2011-09-29 Cary Coutant <ccoutant@google.com> | ||
145 | |||
146 | * incremental.cc (Sized_incremental_binary::do_process_got_plt): | ||
147 | Check for NULL. | ||
148 | * symtab.cc (Symbol_table::add_from_relobj): Ignore version | ||
149 | symbols during incremental update. | ||
150 | (Symbol_table::add_from_dynobj): Likewise. | ||
151 | |||
152 | 2011-09-26 Cary Coutant <ccoutant@google.com> | ||
153 | |||
154 | * gold.cc (queue_initial_tasks): Move option checks ... | ||
155 | * options.cc (General_options::finalize): ... to here. Disable | ||
156 | some options; make others fatal. | ||
157 | |||
158 | 2011-09-23 Simon Baldwin <simonb@google.com> | ||
159 | |||
160 | * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags | ||
161 | configuration options. | ||
162 | * configure: Regenerate. | ||
163 | * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS. | ||
164 | * Makefile.in: Regenerate. | ||
165 | * testsuite/Makefile.in: Regenerate. | ||
166 | --- | ||
167 | gold/ChangeLog | 163 +++++++++++++++++++++++++++++++++++++++ | ||
168 | gold/dwarf_reader.cc | 8 +- | ||
169 | gold/expression.cc | 45 +++++++---- | ||
170 | gold/fileread.cc | 27 ++++--- | ||
171 | gold/gold.cc | 55 +++++-------- | ||
172 | gold/i386.cc | 87 +++++++++++---------- | ||
173 | gold/incremental.cc | 50 +++++++++--- | ||
174 | gold/incremental.h | 4 + | ||
175 | gold/layout.cc | 5 +- | ||
176 | gold/options.cc | 33 +++++++- | ||
177 | gold/options.h | 9 +++ | ||
178 | gold/output.cc | 78 ++++++++++++------- | ||
179 | gold/output.h | 64 +++++++++------ | ||
180 | gold/plugin.cc | 18 +++-- | ||
181 | gold/powerpc.cc | 4 +- | ||
182 | gold/readsyms.cc | 6 +- | ||
183 | gold/resolve.cc | 6 +- | ||
184 | gold/script-sections.cc | 47 +++++++---- | ||
185 | gold/script.cc | 17 ++-- | ||
186 | gold/script.h | 24 ++++-- | ||
187 | gold/sparc.cc | 4 +- | ||
188 | gold/symtab.cc | 65 +++++++++------- | ||
189 | gold/symtab.h | 5 +- | ||
190 | gold/testsuite/Makefile.in | 2 + | ||
191 | gold/testsuite/plugin_test_2.sh | 2 +- | ||
192 | gold/testsuite/script_test_2.t | 2 +- | ||
193 | gold/x86_64.cc | 99 ++++++++++++------------ | ||
194 | 27 files changed, 636 insertions(+), 293 deletions(-) | ||
195 | |||
196 | diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc | ||
197 | index 3dc33e4..2b47a28 100644 | ||
198 | --- a/gold/dwarf_reader.cc | ||
199 | +++ b/gold/dwarf_reader.cc | ||
200 | @@ -1,6 +1,6 @@ | ||
201 | // dwarf_reader.cc -- parse dwarf2/3 debug information | ||
202 | |||
203 | -// Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
204 | +// Copyright 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | ||
205 | // Written by Ian Lance Taylor <iant@google.com>. | ||
206 | |||
207 | // This file is part of gold. | ||
208 | @@ -491,8 +491,10 @@ Sized_dwarf_line_info<size, big_endian>::read_lines(unsigned const char* lineptr | ||
209 | && (shndx == -1U || lsm.shndx == -1U || shndx == lsm.shndx)) | ||
210 | { | ||
211 | Offset_to_lineno_entry entry | ||
212 | - = { lsm.address, this->current_header_index_, | ||
213 | - lsm.file_num, true, lsm.line_num }; | ||
214 | + = { static_cast<off_t>(lsm.address), | ||
215 | + this->current_header_index_, | ||
216 | + static_cast<unsigned int>(lsm.file_num), | ||
217 | + true, lsm.line_num }; | ||
218 | std::vector<Offset_to_lineno_entry>& | ||
219 | map(this->line_number_map_[lsm.shndx]); | ||
220 | // If we see two consecutive entries with the same | ||
221 | diff --git a/gold/expression.cc b/gold/expression.cc | ||
222 | index e527b5e..e31c151 100644 | ||
223 | --- a/gold/expression.cc | ||
224 | +++ b/gold/expression.cc | ||
225 | @@ -1,6 +1,6 @@ | ||
226 | // expression.cc -- expressions in linker scripts for gold | ||
227 | |||
228 | -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. | ||
229 | +// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | ||
230 | // Written by Ian Lance Taylor <iant@google.com>. | ||
231 | |||
232 | // This file is part of gold. | ||
233 | @@ -77,7 +77,7 @@ Expression::eval(const Symbol_table* symtab, const Layout* layout, | ||
234 | bool check_assertions) | ||
235 | { | ||
236 | return this->eval_maybe_dot(symtab, layout, check_assertions, | ||
237 | - false, 0, NULL, NULL, NULL); | ||
238 | + false, 0, NULL, NULL, NULL, false); | ||
239 | } | ||
240 | |||
241 | // Evaluate an expression which may refer to the dot symbol. | ||
242 | @@ -87,11 +87,13 @@ Expression::eval_with_dot(const Symbol_table* symtab, const Layout* layout, | ||
243 | bool check_assertions, uint64_t dot_value, | ||
244 | Output_section* dot_section, | ||
245 | Output_section** result_section_pointer, | ||
246 | - uint64_t* result_alignment_pointer) | ||
247 | + uint64_t* result_alignment_pointer, | ||
248 | + bool is_section_dot_assignment) | ||
249 | { | ||
250 | return this->eval_maybe_dot(symtab, layout, check_assertions, true, | ||
251 | dot_value, dot_section, result_section_pointer, | ||
252 | - result_alignment_pointer); | ||
253 | + result_alignment_pointer, | ||
254 | + is_section_dot_assignment); | ||
255 | } | ||
256 | |||
257 | // Evaluate an expression which may or may not refer to the dot | ||
258 | @@ -102,7 +104,8 @@ Expression::eval_maybe_dot(const Symbol_table* symtab, const Layout* layout, | ||
259 | bool check_assertions, bool is_dot_available, | ||
260 | uint64_t dot_value, Output_section* dot_section, | ||
261 | Output_section** result_section_pointer, | ||
262 | - uint64_t* result_alignment_pointer) | ||
263 | + uint64_t* result_alignment_pointer, | ||
264 | + bool is_section_dot_assignment) | ||
265 | { | ||
266 | Expression_eval_info eei; | ||
267 | eei.symtab = symtab; | ||
268 | @@ -113,14 +116,24 @@ Expression::eval_maybe_dot(const Symbol_table* symtab, const Layout* layout, | ||
269 | eei.dot_section = dot_section; | ||
270 | |||
271 | // We assume the value is absolute, and only set this to a section | ||
272 | - // if we find a section relative reference. | ||
273 | + // if we find a section-relative reference. | ||
274 | if (result_section_pointer != NULL) | ||
275 | *result_section_pointer = NULL; | ||
276 | eei.result_section_pointer = result_section_pointer; | ||
277 | |||
278 | eei.result_alignment_pointer = result_alignment_pointer; | ||
279 | |||
280 | - return this->value(&eei); | ||
281 | + uint64_t val = this->value(&eei); | ||
282 | + | ||
283 | + // If this is an assignment to dot within a section, and the value | ||
284 | + // is absolute, treat it as a section-relative offset. | ||
285 | + if (is_section_dot_assignment && *result_section_pointer == NULL) | ||
286 | + { | ||
287 | + gold_assert(dot_section != NULL); | ||
288 | + val += dot_section->address(); | ||
289 | + *result_section_pointer = dot_section; | ||
290 | + } | ||
291 | + return val; | ||
292 | } | ||
293 | |||
294 | // A number. | ||
295 | @@ -257,7 +270,8 @@ class Unary_expression : public Expression | ||
296 | eei->dot_value, | ||
297 | eei->dot_section, | ||
298 | arg_section_pointer, | ||
299 | - eei->result_alignment_pointer); | ||
300 | + eei->result_alignment_pointer, | ||
301 | + false); | ||
302 | } | ||
303 | |||
304 | void | ||
305 | @@ -336,7 +350,8 @@ class Binary_expression : public Expression | ||
306 | eei->dot_value, | ||
307 | eei->dot_section, | ||
308 | section_pointer, | ||
309 | - alignment_pointer); | ||
310 | + alignment_pointer, | ||
311 | + false); | ||
312 | } | ||
313 | |||
314 | uint64_t | ||
315 | @@ -350,7 +365,8 @@ class Binary_expression : public Expression | ||
316 | eei->dot_value, | ||
317 | eei->dot_section, | ||
318 | section_pointer, | ||
319 | - alignment_pointer); | ||
320 | + alignment_pointer, | ||
321 | + false); | ||
322 | } | ||
323 | |||
324 | void | ||
325 | @@ -500,7 +516,8 @@ class Trinary_expression : public Expression | ||
326 | eei->dot_value, | ||
327 | eei->dot_section, | ||
328 | section_pointer, | ||
329 | - NULL); | ||
330 | + NULL, | ||
331 | + false); | ||
332 | } | ||
333 | |||
334 | uint64_t | ||
335 | @@ -514,7 +531,8 @@ class Trinary_expression : public Expression | ||
336 | eei->dot_value, | ||
337 | eei->dot_section, | ||
338 | section_pointer, | ||
339 | - alignment_pointer); | ||
340 | + alignment_pointer, | ||
341 | + false); | ||
342 | } | ||
343 | |||
344 | uint64_t | ||
345 | @@ -528,7 +546,8 @@ class Trinary_expression : public Expression | ||
346 | eei->dot_value, | ||
347 | eei->dot_section, | ||
348 | section_pointer, | ||
349 | - alignment_pointer); | ||
350 | + alignment_pointer, | ||
351 | + false); | ||
352 | } | ||
353 | |||
354 | void | ||
355 | diff --git a/gold/fileread.cc b/gold/fileread.cc | ||
356 | index 80ddfbc..c5dc320 100644 | ||
357 | --- a/gold/fileread.cc | ||
358 | +++ b/gold/fileread.cc | ||
359 | @@ -329,6 +329,10 @@ inline File_read::View* | ||
360 | File_read::find_view(off_t start, section_size_type size, | ||
361 | unsigned int byteshift, File_read::View** vshifted) const | ||
362 | { | ||
363 | + gold_assert(start <= this->size_ | ||
364 | + && (static_cast<unsigned long long>(size) | ||
365 | + <= static_cast<unsigned long long>(this->size_ - start))); | ||
366 | + | ||
367 | if (vshifted != NULL) | ||
368 | *vshifted = NULL; | ||
369 | |||
370 | @@ -456,16 +460,9 @@ File_read::make_view(off_t start, section_size_type size, | ||
371 | unsigned int byteshift, bool cache) | ||
372 | { | ||
373 | gold_assert(size > 0); | ||
374 | - | ||
375 | - // Check that start and end of the view are within the file. | ||
376 | - if (start > this->size_ | ||
377 | - || (static_cast<unsigned long long>(size) | ||
378 | - > static_cast<unsigned long long>(this->size_ - start))) | ||
379 | - gold_fatal(_("%s: attempt to map %lld bytes at offset %lld exceeds " | ||
380 | - "size of file; the file may be corrupt"), | ||
381 | - this->filename().c_str(), | ||
382 | - static_cast<long long>(size), | ||
383 | - static_cast<long long>(start)); | ||
384 | + gold_assert(start <= this->size_ | ||
385 | + && (static_cast<unsigned long long>(size) | ||
386 | + <= static_cast<unsigned long long>(this->size_ - start))); | ||
387 | |||
388 | off_t poff = File_read::page_offset(start); | ||
389 | |||
390 | @@ -523,6 +520,16 @@ File_read::View* | ||
391 | File_read::find_or_make_view(off_t offset, off_t start, | ||
392 | section_size_type size, bool aligned, bool cache) | ||
393 | { | ||
394 | + // Check that start and end of the view are within the file. | ||
395 | + if (start > this->size_ | ||
396 | + || (static_cast<unsigned long long>(size) | ||
397 | + > static_cast<unsigned long long>(this->size_ - start))) | ||
398 | + gold_fatal(_("%s: attempt to map %lld bytes at offset %lld exceeds " | ||
399 | + "size of file; the file may be corrupt"), | ||
400 | + this->filename().c_str(), | ||
401 | + static_cast<long long>(size), | ||
402 | + static_cast<long long>(start)); | ||
403 | + | ||
404 | unsigned int byteshift; | ||
405 | if (offset == 0) | ||
406 | byteshift = 0; | ||
407 | diff --git a/gold/gold.cc b/gold/gold.cc | ||
408 | index 12f25b7..693ff79 100644 | ||
409 | --- a/gold/gold.cc | ||
410 | +++ b/gold/gold.cc | ||
411 | @@ -197,46 +197,29 @@ queue_initial_tasks(const General_options& options, | ||
412 | // For incremental links, the base output file. | ||
413 | Incremental_binary* ibase = NULL; | ||
414 | |||
415 | - if (parameters->incremental()) | ||
416 | - { | ||
417 | - if (options.relocatable()) | ||
418 | - gold_error(_("incremental linking is incompatible with -r")); | ||
419 | - if (options.emit_relocs()) | ||
420 | - gold_error(_("incremental linking is incompatible with --emit-relocs")); | ||
421 | - if (options.gc_sections()) | ||
422 | - gold_error(_("incremental linking is incompatible with --gc-sections")); | ||
423 | - if (options.icf_enabled()) | ||
424 | - gold_error(_("incremental linking is incompatible with --icf")); | ||
425 | - if (options.has_plugins()) | ||
426 | - gold_error(_("incremental linking is incompatible with --plugin")); | ||
427 | - if (strcmp(options.compress_debug_sections(), "none") != 0) | ||
428 | - gold_error(_("incremental linking is incompatible with " | ||
429 | - "--compress-debug-sections")); | ||
430 | - | ||
431 | - if (parameters->incremental_update()) | ||
432 | + if (parameters->incremental_update()) | ||
433 | + { | ||
434 | + Output_file* of = new Output_file(options.output_file_name()); | ||
435 | + if (of->open_base_file(options.incremental_base(), true)) | ||
436 | { | ||
437 | - Output_file* of = new Output_file(options.output_file_name()); | ||
438 | - if (of->open_base_file(options.incremental_base(), true)) | ||
439 | - { | ||
440 | - ibase = open_incremental_binary(of); | ||
441 | - if (ibase != NULL | ||
442 | - && ibase->check_inputs(cmdline, layout->incremental_inputs())) | ||
443 | - ibase->init_layout(layout); | ||
444 | - else | ||
445 | - { | ||
446 | - delete ibase; | ||
447 | - ibase = NULL; | ||
448 | - of->close(); | ||
449 | - } | ||
450 | - } | ||
451 | - if (ibase == NULL) | ||
452 | + ibase = open_incremental_binary(of); | ||
453 | + if (ibase != NULL | ||
454 | + && ibase->check_inputs(cmdline, layout->incremental_inputs())) | ||
455 | + ibase->init_layout(layout); | ||
456 | + else | ||
457 | { | ||
458 | - if (set_parameters_incremental_full()) | ||
459 | - gold_info(_("linking with --incremental-full")); | ||
460 | - else | ||
461 | - gold_fallback(_("restart link with --incremental-full")); | ||
462 | + delete ibase; | ||
463 | + ibase = NULL; | ||
464 | + of->close(); | ||
465 | } | ||
466 | } | ||
467 | + if (ibase == NULL) | ||
468 | + { | ||
469 | + if (set_parameters_incremental_full()) | ||
470 | + gold_info(_("linking with --incremental-full")); | ||
471 | + else | ||
472 | + gold_fallback(_("restart link with --incremental-full")); | ||
473 | + } | ||
474 | } | ||
475 | |||
476 | // Read the input files. We have to add the symbols to the symbol | ||
477 | diff --git a/gold/i386.cc b/gold/i386.cc | ||
478 | index 445bc68..efb6248 100644 | ||
479 | --- a/gold/i386.cc | ||
480 | +++ b/gold/i386.cc | ||
481 | @@ -2709,12 +2709,6 @@ Target_i386::Relocate::relocate_tls(const Relocate_info<32, false>* relinfo, | ||
482 | } | ||
483 | if (optimized_type == tls::TLSOPT_TO_IE) | ||
484 | { | ||
485 | - if (tls_segment == NULL) | ||
486 | - { | ||
487 | - gold_assert(parameters->errors()->error_count() > 0 | ||
488 | - || issue_undefined_symbol_error(gsym)); | ||
489 | - return; | ||
490 | - } | ||
491 | this->tls_gd_to_ie(relinfo, relnum, tls_segment, rel, r_type, | ||
492 | got_offset, view, view_size); | ||
493 | break; | ||
494 | @@ -3480,42 +3474,51 @@ Target_i386::do_code_fill(section_size_type length) const | ||
495 | } | ||
496 | |||
497 | // Nop sequences of various lengths. | ||
498 | - const char nop1[1] = { 0x90 }; // nop | ||
499 | - const char nop2[2] = { 0x66, 0x90 }; // xchg %ax %ax | ||
500 | - const char nop3[3] = { 0x8d, 0x76, 0x00 }; // leal 0(%esi),%esi | ||
501 | - const char nop4[4] = { 0x8d, 0x74, 0x26, 0x00}; // leal 0(%esi,1),%esi | ||
502 | - const char nop5[5] = { 0x90, 0x8d, 0x74, 0x26, // nop | ||
503 | - 0x00 }; // leal 0(%esi,1),%esi | ||
504 | - const char nop6[6] = { 0x8d, 0xb6, 0x00, 0x00, // leal 0L(%esi),%esi | ||
505 | - 0x00, 0x00 }; | ||
506 | - const char nop7[7] = { 0x8d, 0xb4, 0x26, 0x00, // leal 0L(%esi,1),%esi | ||
507 | - 0x00, 0x00, 0x00 }; | ||
508 | - const char nop8[8] = { 0x90, 0x8d, 0xb4, 0x26, // nop | ||
509 | - 0x00, 0x00, 0x00, 0x00 }; // leal 0L(%esi,1),%esi | ||
510 | - const char nop9[9] = { 0x89, 0xf6, 0x8d, 0xbc, // movl %esi,%esi | ||
511 | - 0x27, 0x00, 0x00, 0x00, // leal 0L(%edi,1),%edi | ||
512 | - 0x00 }; | ||
513 | - const char nop10[10] = { 0x8d, 0x76, 0x00, 0x8d, // leal 0(%esi),%esi | ||
514 | - 0xbc, 0x27, 0x00, 0x00, // leal 0L(%edi,1),%edi | ||
515 | - 0x00, 0x00 }; | ||
516 | - const char nop11[11] = { 0x8d, 0x74, 0x26, 0x00, // leal 0(%esi,1),%esi | ||
517 | - 0x8d, 0xbc, 0x27, 0x00, // leal 0L(%edi,1),%edi | ||
518 | - 0x00, 0x00, 0x00 }; | ||
519 | - const char nop12[12] = { 0x8d, 0xb6, 0x00, 0x00, // leal 0L(%esi),%esi | ||
520 | - 0x00, 0x00, 0x8d, 0xbf, // leal 0L(%edi),%edi | ||
521 | - 0x00, 0x00, 0x00, 0x00 }; | ||
522 | - const char nop13[13] = { 0x8d, 0xb6, 0x00, 0x00, // leal 0L(%esi),%esi | ||
523 | - 0x00, 0x00, 0x8d, 0xbc, // leal 0L(%edi,1),%edi | ||
524 | - 0x27, 0x00, 0x00, 0x00, | ||
525 | - 0x00 }; | ||
526 | - const char nop14[14] = { 0x8d, 0xb4, 0x26, 0x00, // leal 0L(%esi,1),%esi | ||
527 | - 0x00, 0x00, 0x00, 0x8d, // leal 0L(%edi,1),%edi | ||
528 | - 0xbc, 0x27, 0x00, 0x00, | ||
529 | - 0x00, 0x00 }; | ||
530 | - const char nop15[15] = { 0xeb, 0x0d, 0x90, 0x90, // jmp .+15 | ||
531 | - 0x90, 0x90, 0x90, 0x90, // nop,nop,nop,... | ||
532 | - 0x90, 0x90, 0x90, 0x90, | ||
533 | - 0x90, 0x90, 0x90 }; | ||
534 | + const char nop1[1] = { '\x90' }; // nop | ||
535 | + const char nop2[2] = { '\x66', '\x90' }; // xchg %ax %ax | ||
536 | + const char nop3[3] = { '\x8d', '\x76', '\x00' }; // leal 0(%esi),%esi | ||
537 | + const char nop4[4] = { '\x8d', '\x74', '\x26', // leal 0(%esi,1),%esi | ||
538 | + '\x00'}; | ||
539 | + const char nop5[5] = { '\x90', '\x8d', '\x74', // nop | ||
540 | + '\x26', '\x00' }; // leal 0(%esi,1),%esi | ||
541 | + const char nop6[6] = { '\x8d', '\xb6', '\x00', // leal 0L(%esi),%esi | ||
542 | + '\x00', '\x00', '\x00' }; | ||
543 | + const char nop7[7] = { '\x8d', '\xb4', '\x26', // leal 0L(%esi,1),%esi | ||
544 | + '\x00', '\x00', '\x00', | ||
545 | + '\x00' }; | ||
546 | + const char nop8[8] = { '\x90', '\x8d', '\xb4', // nop | ||
547 | + '\x26', '\x00', '\x00', // leal 0L(%esi,1),%esi | ||
548 | + '\x00', '\x00' }; | ||
549 | + const char nop9[9] = { '\x89', '\xf6', '\x8d', // movl %esi,%esi | ||
550 | + '\xbc', '\x27', '\x00', // leal 0L(%edi,1),%edi | ||
551 | + '\x00', '\x00', '\x00' }; | ||
552 | + const char nop10[10] = { '\x8d', '\x76', '\x00', // leal 0(%esi),%esi | ||
553 | + '\x8d', '\xbc', '\x27', // leal 0L(%edi,1),%edi | ||
554 | + '\x00', '\x00', '\x00', | ||
555 | + '\x00' }; | ||
556 | + const char nop11[11] = { '\x8d', '\x74', '\x26', // leal 0(%esi,1),%esi | ||
557 | + '\x00', '\x8d', '\xbc', // leal 0L(%edi,1),%edi | ||
558 | + '\x27', '\x00', '\x00', | ||
559 | + '\x00', '\x00' }; | ||
560 | + const char nop12[12] = { '\x8d', '\xb6', '\x00', // leal 0L(%esi),%esi | ||
561 | + '\x00', '\x00', '\x00', // leal 0L(%edi),%edi | ||
562 | + '\x8d', '\xbf', '\x00', | ||
563 | + '\x00', '\x00', '\x00' }; | ||
564 | + const char nop13[13] = { '\x8d', '\xb6', '\x00', // leal 0L(%esi),%esi | ||
565 | + '\x00', '\x00', '\x00', // leal 0L(%edi,1),%edi | ||
566 | + '\x8d', '\xbc', '\x27', | ||
567 | + '\x00', '\x00', '\x00', | ||
568 | + '\x00' }; | ||
569 | + const char nop14[14] = { '\x8d', '\xb4', '\x26', // leal 0L(%esi,1),%esi | ||
570 | + '\x00', '\x00', '\x00', // leal 0L(%edi,1),%edi | ||
571 | + '\x00', '\x8d', '\xbc', | ||
572 | + '\x27', '\x00', '\x00', | ||
573 | + '\x00', '\x00' }; | ||
574 | + const char nop15[15] = { '\xeb', '\x0d', '\x90', // jmp .+15 | ||
575 | + '\x90', '\x90', '\x90', // nop,nop,nop,... | ||
576 | + '\x90', '\x90', '\x90', | ||
577 | + '\x90', '\x90', '\x90', | ||
578 | + '\x90', '\x90', '\x90' }; | ||
579 | |||
580 | const char* nops[16] = { | ||
581 | NULL, | ||
582 | diff --git a/gold/incremental.cc b/gold/incremental.cc | ||
583 | index b422827..75e44c5 100644 | ||
584 | --- a/gold/incremental.cc | ||
585 | +++ b/gold/incremental.cc | ||
586 | @@ -685,7 +685,7 @@ Sized_incremental_binary<size, big_endian>::do_process_got_plt( | ||
587 | gold_assert(plt_desc >= first_global && plt_desc < symtab_count); | ||
588 | Symbol* sym = this->global_symbol(plt_desc - first_global); | ||
589 | // Add the PLT entry only if the symbol is still referenced. | ||
590 | - if (sym->in_reg()) | ||
591 | + if (sym != NULL && sym->in_reg()) | ||
592 | { | ||
593 | gold_debug(DEBUG_INCREMENTAL, | ||
594 | "PLT entry %d: %s", | ||
595 | @@ -1966,8 +1966,9 @@ Sized_relobj_incr<size, big_endian>::Sized_relobj_incr( | ||
596 | input_reader_(ibase->inputs_reader().input_file(input_file_index)), | ||
597 | local_symbol_count_(0), output_local_dynsym_count_(0), | ||
598 | local_symbol_index_(0), local_symbol_offset_(0), local_dynsym_offset_(0), | ||
599 | - symbols_(), incr_reloc_offset_(-1U), incr_reloc_count_(0), | ||
600 | - incr_reloc_output_index_(0), incr_relocs_(NULL), local_symbols_() | ||
601 | + symbols_(), defined_count_(0), incr_reloc_offset_(-1U), | ||
602 | + incr_reloc_count_(0), incr_reloc_output_index_(0), incr_relocs_(NULL), | ||
603 | + local_symbols_() | ||
604 | { | ||
605 | if (this->input_reader_.is_in_system_directory()) | ||
606 | this->set_is_in_system_directory(); | ||
607 | @@ -2120,6 +2121,9 @@ Sized_relobj_incr<size, big_endian>::do_add_symbols( | ||
608 | |||
609 | Symbol* res = symtab->add_from_incrobj(this, name, NULL, &sym); | ||
610 | |||
611 | + if (shndx != elfcpp::SHN_UNDEF) | ||
612 | + ++this->defined_count_; | ||
613 | + | ||
614 | // If this is a linker-defined symbol that hasn't yet been defined, | ||
615 | // define it now. | ||
616 | if (input_shndx == -1U && !res->is_defined()) | ||
617 | @@ -2283,9 +2287,21 @@ Sized_relobj_incr<size, big_endian>::do_initialize_xindex() | ||
618 | template<int size, bool big_endian> | ||
619 | void | ||
620 | Sized_relobj_incr<size, big_endian>::do_get_global_symbol_counts( | ||
621 | - const Symbol_table*, size_t*, size_t*) const | ||
622 | -{ | ||
623 | - gold_unreachable(); | ||
624 | + const Symbol_table*, | ||
625 | + size_t* defined, | ||
626 | + size_t* used) const | ||
627 | +{ | ||
628 | + *defined = this->defined_count_; | ||
629 | + size_t count = 0; | ||
630 | + for (typename Symbols::const_iterator p = this->symbols_.begin(); | ||
631 | + p != this->symbols_.end(); | ||
632 | + ++p) | ||
633 | + if (*p != NULL | ||
634 | + && (*p)->source() == Symbol::FROM_OBJECT | ||
635 | + && (*p)->object() == this | ||
636 | + && (*p)->is_defined()) | ||
637 | + ++count; | ||
638 | + *used = count; | ||
639 | } | ||
640 | |||
641 | // Read the relocs. | ||
642 | @@ -2579,7 +2595,7 @@ Sized_incr_dynobj<size, big_endian>::Sized_incr_dynobj( | ||
643 | : Dynobj(name, NULL), ibase_(ibase), | ||
644 | input_file_index_(input_file_index), | ||
645 | input_reader_(ibase->inputs_reader().input_file(input_file_index)), | ||
646 | - symbols_() | ||
647 | + symbols_(), defined_count_(0) | ||
648 | { | ||
649 | if (this->input_reader_.is_in_system_directory()) | ||
650 | this->set_is_in_system_directory(); | ||
651 | @@ -2677,6 +2693,7 @@ Sized_incr_dynobj<size, big_endian>::do_add_symbols( | ||
652 | // is meaningless, as long as it's not SHN_UNDEF. | ||
653 | shndx = 1; | ||
654 | v = gsym.get_st_value(); | ||
655 | + ++this->defined_count_; | ||
656 | } | ||
657 | |||
658 | osym.put_st_name(0); | ||
659 | @@ -2845,9 +2862,22 @@ Sized_incr_dynobj<size, big_endian>::do_initialize_xindex() | ||
660 | template<int size, bool big_endian> | ||
661 | void | ||
662 | Sized_incr_dynobj<size, big_endian>::do_get_global_symbol_counts( | ||
663 | - const Symbol_table*, size_t*, size_t*) const | ||
664 | -{ | ||
665 | - gold_unreachable(); | ||
666 | + const Symbol_table*, | ||
667 | + size_t* defined, | ||
668 | + size_t* used) const | ||
669 | +{ | ||
670 | + *defined = this->defined_count_; | ||
671 | + size_t count = 0; | ||
672 | + for (typename Symbols::const_iterator p = this->symbols_.begin(); | ||
673 | + p != this->symbols_.end(); | ||
674 | + ++p) | ||
675 | + if (*p != NULL | ||
676 | + && (*p)->source() == Symbol::FROM_OBJECT | ||
677 | + && (*p)->object() == this | ||
678 | + && (*p)->is_defined() | ||
679 | + && (*p)->dynsym_index() != -1U) | ||
680 | + ++count; | ||
681 | + *used = count; | ||
682 | } | ||
683 | |||
684 | // Allocate an incremental object of the appropriate size and endianness. | ||
685 | diff --git a/gold/incremental.h b/gold/incremental.h | ||
686 | index e6732df..56fc52b 100644 | ||
687 | --- a/gold/incremental.h | ||
688 | +++ b/gold/incremental.h | ||
689 | @@ -1996,6 +1996,8 @@ class Sized_relobj_incr : public Sized_relobj<size, big_endian> | ||
690 | unsigned int local_dynsym_offset_; | ||
691 | // The entries in the symbol table for the external symbols. | ||
692 | Symbols symbols_; | ||
693 | + // Number of symbols defined in object file itself. | ||
694 | + size_t defined_count_; | ||
695 | // The offset of the first incremental relocation for this object. | ||
696 | unsigned int incr_reloc_offset_; | ||
697 | // The number of incremental relocations for this object. | ||
698 | @@ -2127,6 +2129,8 @@ class Sized_incr_dynobj : public Dynobj | ||
699 | Input_entry_reader input_reader_; | ||
700 | // The entries in the symbol table for the external symbols. | ||
701 | Symbols symbols_; | ||
702 | + // Number of symbols defined in object file itself. | ||
703 | + size_t defined_count_; | ||
704 | }; | ||
705 | |||
706 | // Allocate an incremental object of the appropriate size and endianness. | ||
707 | diff --git a/gold/layout.cc b/gold/layout.cc | ||
708 | index 1c32bcf..9d8a43a 100644 | ||
709 | --- a/gold/layout.cc | ||
710 | +++ b/gold/layout.cc | ||
711 | @@ -2975,8 +2975,9 @@ Layout::segment_precedes(const Output_segment* seg1, | ||
712 | |||
713 | // We shouldn't get here--we shouldn't create segments which we | ||
714 | // can't distinguish. Unless of course we are using a weird linker | ||
715 | - // script. | ||
716 | - gold_assert(this->script_options_->saw_phdrs_clause()); | ||
717 | + // script or overlapping --section-start options. | ||
718 | + gold_assert(this->script_options_->saw_phdrs_clause() | ||
719 | + || parameters->options().any_section_start()); | ||
720 | return false; | ||
721 | } | ||
722 | |||
723 | diff --git a/gold/options.cc b/gold/options.cc | ||
724 | index be32645..dcf6ba7 100644 | ||
725 | --- a/gold/options.cc | ||
726 | +++ b/gold/options.cc | ||
727 | @@ -198,7 +198,7 @@ parse_uint(const char* option_name, const char* arg, int* retval) | ||
728 | { | ||
729 | char* endptr; | ||
730 | *retval = strtol(arg, &endptr, 0); | ||
731 | - if (*endptr != '\0' || retval < 0) | ||
732 | + if (*endptr != '\0' || *retval < 0) | ||
733 | gold_fatal(_("%s: invalid option value (expected an integer): %s"), | ||
734 | option_name, arg); | ||
735 | } | ||
736 | @@ -1224,6 +1224,37 @@ General_options::finalize() | ||
737 | gold_fatal(_("Options --incremental-changed, --incremental-unchanged, " | ||
738 | "--incremental-unknown require the use of --incremental")); | ||
739 | |||
740 | + // Check for options that are not compatible with incremental linking. | ||
741 | + // Where an option can be disabled without seriously changing the semantics | ||
742 | + // of the link, we turn the option off; otherwise, we issue a fatal error. | ||
743 | + | ||
744 | + if (this->incremental_mode_ != INCREMENTAL_OFF) | ||
745 | + { | ||
746 | + if (this->relocatable()) | ||
747 | + gold_fatal(_("incremental linking is not compatible with -r")); | ||
748 | + if (this->emit_relocs()) | ||
749 | + gold_fatal(_("incremental linking is not compatible with " | ||
750 | + "--emit-relocs")); | ||
751 | + if (this->has_plugins()) | ||
752 | + gold_fatal(_("incremental linking is not compatible with --plugin")); | ||
753 | + if (this->gc_sections()) | ||
754 | + { | ||
755 | + gold_warning(_("ignoring --gc-sections for an incremental link")); | ||
756 | + this->set_gc_sections(false); | ||
757 | + } | ||
758 | + if (this->icf_enabled()) | ||
759 | + { | ||
760 | + gold_warning(_("ignoring --icf for an incremental link")); | ||
761 | + this->set_icf_status(ICF_NONE); | ||
762 | + } | ||
763 | + if (strcmp(this->compress_debug_sections(), "none") != 0) | ||
764 | + { | ||
765 | + gold_warning(_("ignoring --compress-debug-sections for an " | ||
766 | + "incremental link")); | ||
767 | + this->set_compress_debug_sections("none"); | ||
768 | + } | ||
769 | + } | ||
770 | + | ||
771 | // FIXME: we can/should be doing a lot more sanity checking here. | ||
772 | } | ||
773 | |||
774 | diff --git a/gold/options.h b/gold/options.h | ||
775 | index 768df9c..8876a1e 100644 | ||
776 | --- a/gold/options.h | ||
777 | +++ b/gold/options.h | ||
778 | @@ -791,6 +791,10 @@ class General_options | ||
779 | DEFINE_bool(g, options::EXACTLY_ONE_DASH, '\0', false, | ||
780 | N_("Ignored"), NULL); | ||
781 | |||
782 | + DEFINE_bool(gnu_unique, options::TWO_DASHES, '\0', true, | ||
783 | + N_("Enable STB_GNU_UNIQUE symbol binding (default)"), | ||
784 | + N_("Disable STB_GNU_UNIQUE symbol binding")); | ||
785 | + | ||
786 | DEFINE_string(soname, options::ONE_DASH, 'h', NULL, | ||
787 | N_("Set shared library name"), N_("FILENAME")); | ||
788 | |||
789 | @@ -1385,6 +1389,11 @@ class General_options | ||
790 | bool | ||
791 | section_start(const char* secname, uint64_t* paddr) const; | ||
792 | |||
793 | + // Return whether any --section-start option was used. | ||
794 | + bool | ||
795 | + any_section_start() const | ||
796 | + { return !this->section_starts_.empty(); } | ||
797 | + | ||
798 | enum Fix_v4bx | ||
799 | { | ||
800 | // Leave original instruction. | ||
801 | diff --git a/gold/output.cc b/gold/output.cc | ||
802 | index 29d8e3d..a7e1e9a 100644 | ||
803 | --- a/gold/output.cc | ||
804 | +++ b/gold/output.cc | ||
805 | @@ -119,7 +119,9 @@ extern "C" void *gold_mremap(void *, size_t, size_t, int); | ||
806 | static int | ||
807 | posix_fallocate(int o, off_t offset, off_t len) | ||
808 | { | ||
809 | - return ftruncate(o, offset + len); | ||
810 | + if (ftruncate(o, offset + len) < 0) | ||
811 | + return errno; | ||
812 | + return 0; | ||
813 | } | ||
814 | #endif // !defined(HAVE_POSIX_FALLOCATE) | ||
815 | |||
816 | @@ -706,7 +708,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
817 | bool is_symbolless) | ||
818 | : address_(address), local_sym_index_(GSYM_CODE), type_(type), | ||
819 | is_relative_(is_relative), is_symbolless_(is_symbolless), | ||
820 | - is_section_symbol_(false), shndx_(INVALID_CODE) | ||
821 | + is_section_symbol_(false), use_plt_offset_(false), shndx_(INVALID_CODE) | ||
822 | { | ||
823 | // this->type_ is a bitfield; make sure TYPE fits. | ||
824 | gold_assert(this->type_ == type); | ||
825 | @@ -727,7 +729,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
826 | bool is_symbolless) | ||
827 | : address_(address), local_sym_index_(GSYM_CODE), type_(type), | ||
828 | is_relative_(is_relative), is_symbolless_(is_symbolless), | ||
829 | - is_section_symbol_(false), shndx_(shndx) | ||
830 | + is_section_symbol_(false), use_plt_offset_(false), shndx_(shndx) | ||
831 | { | ||
832 | gold_assert(shndx != INVALID_CODE); | ||
833 | // this->type_ is a bitfield; make sure TYPE fits. | ||
834 | @@ -749,10 +751,12 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
835 | Address address, | ||
836 | bool is_relative, | ||
837 | bool is_symbolless, | ||
838 | - bool is_section_symbol) | ||
839 | + bool is_section_symbol, | ||
840 | + bool use_plt_offset) | ||
841 | : address_(address), local_sym_index_(local_sym_index), type_(type), | ||
842 | is_relative_(is_relative), is_symbolless_(is_symbolless), | ||
843 | - is_section_symbol_(is_section_symbol), shndx_(INVALID_CODE) | ||
844 | + is_section_symbol_(is_section_symbol), use_plt_offset_(use_plt_offset), | ||
845 | + shndx_(INVALID_CODE) | ||
846 | { | ||
847 | gold_assert(local_sym_index != GSYM_CODE | ||
848 | && local_sym_index != INVALID_CODE); | ||
849 | @@ -773,10 +777,12 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
850 | Address address, | ||
851 | bool is_relative, | ||
852 | bool is_symbolless, | ||
853 | - bool is_section_symbol) | ||
854 | + bool is_section_symbol, | ||
855 | + bool use_plt_offset) | ||
856 | : address_(address), local_sym_index_(local_sym_index), type_(type), | ||
857 | is_relative_(is_relative), is_symbolless_(is_symbolless), | ||
858 | - is_section_symbol_(is_section_symbol), shndx_(shndx) | ||
859 | + is_section_symbol_(is_section_symbol), use_plt_offset_(use_plt_offset), | ||
860 | + shndx_(shndx) | ||
861 | { | ||
862 | gold_assert(local_sym_index != GSYM_CODE | ||
863 | && local_sym_index != INVALID_CODE); | ||
864 | @@ -799,7 +805,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
865 | Address address) | ||
866 | : address_(address), local_sym_index_(SECTION_CODE), type_(type), | ||
867 | is_relative_(false), is_symbolless_(false), | ||
868 | - is_section_symbol_(true), shndx_(INVALID_CODE) | ||
869 | + is_section_symbol_(true), use_plt_offset_(false), shndx_(INVALID_CODE) | ||
870 | { | ||
871 | // this->type_ is a bitfield; make sure TYPE fits. | ||
872 | gold_assert(this->type_ == type); | ||
873 | @@ -820,7 +826,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
874 | Address address) | ||
875 | : address_(address), local_sym_index_(SECTION_CODE), type_(type), | ||
876 | is_relative_(false), is_symbolless_(false), | ||
877 | - is_section_symbol_(true), shndx_(shndx) | ||
878 | + is_section_symbol_(true), use_plt_offset_(false), shndx_(shndx) | ||
879 | { | ||
880 | gold_assert(shndx != INVALID_CODE); | ||
881 | // this->type_ is a bitfield; make sure TYPE fits. | ||
882 | @@ -842,7 +848,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
883 | Address address) | ||
884 | : address_(address), local_sym_index_(0), type_(type), | ||
885 | is_relative_(false), is_symbolless_(false), | ||
886 | - is_section_symbol_(false), shndx_(INVALID_CODE) | ||
887 | + is_section_symbol_(false), use_plt_offset_(false), shndx_(INVALID_CODE) | ||
888 | { | ||
889 | // this->type_ is a bitfield; make sure TYPE fits. | ||
890 | gold_assert(this->type_ == type); | ||
891 | @@ -858,7 +864,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
892 | Address address) | ||
893 | : address_(address), local_sym_index_(0), type_(type), | ||
894 | is_relative_(false), is_symbolless_(false), | ||
895 | - is_section_symbol_(false), shndx_(shndx) | ||
896 | + is_section_symbol_(false), use_plt_offset_(false), shndx_(shndx) | ||
897 | { | ||
898 | gold_assert(shndx != INVALID_CODE); | ||
899 | // this->type_ is a bitfield; make sure TYPE fits. | ||
900 | @@ -877,7 +883,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
901 | Address address) | ||
902 | : address_(address), local_sym_index_(TARGET_CODE), type_(type), | ||
903 | is_relative_(false), is_symbolless_(false), | ||
904 | - is_section_symbol_(false), shndx_(INVALID_CODE) | ||
905 | + is_section_symbol_(false), use_plt_offset_(false), shndx_(INVALID_CODE) | ||
906 | { | ||
907 | // this->type_ is a bitfield; make sure TYPE fits. | ||
908 | gold_assert(this->type_ == type); | ||
909 | @@ -894,7 +900,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc( | ||
910 | Address address) | ||
911 | : address_(address), local_sym_index_(TARGET_CODE), type_(type), | ||
912 | is_relative_(false), is_symbolless_(false), | ||
913 | - is_section_symbol_(false), shndx_(shndx) | ||
914 | + is_section_symbol_(false), use_plt_offset_(false), shndx_(shndx) | ||
915 | { | ||
916 | gold_assert(shndx != INVALID_CODE); | ||
917 | // this->type_ is a bitfield; make sure TYPE fits. | ||
918 | @@ -1121,6 +1127,12 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::symbol_value( | ||
919 | Sized_relobj_file<size, big_endian>* relobj = | ||
920 | this->u1_.relobj->sized_relobj(); | ||
921 | gold_assert(relobj != NULL); | ||
922 | + if (this->use_plt_offset_) | ||
923 | + { | ||
924 | + uint64_t plt_address = | ||
925 | + parameters->target().plt_address_for_local(relobj, lsi); | ||
926 | + return plt_address + relobj->local_plt_offset(lsi); | ||
927 | + } | ||
928 | const Symbol_value<size>* symval = relobj->local_symbol(lsi); | ||
929 | return symval->value(relobj, addend); | ||
930 | } | ||
931 | @@ -4880,17 +4892,27 @@ Output_file::open_base_file(const char* base_name, bool writable) | ||
932 | if (use_base_file) | ||
933 | { | ||
934 | this->open(s.st_size); | ||
935 | - ssize_t len = ::read(o, this->base_, s.st_size); | ||
936 | - if (len < 0) | ||
937 | - { | ||
938 | - gold_info(_("%s: read failed: %s"), base_name, strerror(errno)); | ||
939 | - return false; | ||
940 | - } | ||
941 | - if (len < s.st_size) | ||
942 | - { | ||
943 | - gold_info(_("%s: file too short"), base_name); | ||
944 | - return false; | ||
945 | - } | ||
946 | + ssize_t bytes_to_read = s.st_size; | ||
947 | + unsigned char* p = this->base_; | ||
948 | + while (bytes_to_read > 0) | ||
949 | + { | ||
950 | + ssize_t len = ::read(o, p, bytes_to_read); | ||
951 | + if (len < 0) | ||
952 | + { | ||
953 | + gold_info(_("%s: read failed: %s"), base_name, strerror(errno)); | ||
954 | + return false; | ||
955 | + } | ||
956 | + if (len == 0) | ||
957 | + { | ||
958 | + gold_info(_("%s: file too short: read only %lld of %lld bytes"), | ||
959 | + base_name, | ||
960 | + static_cast<long long>(s.st_size - bytes_to_read), | ||
961 | + static_cast<long long>(s.st_size)); | ||
962 | + return false; | ||
963 | + } | ||
964 | + p += len; | ||
965 | + bytes_to_read -= len; | ||
966 | + } | ||
967 | ::close(o); | ||
968 | return true; | ||
969 | } | ||
970 | @@ -5052,8 +5074,12 @@ Output_file::map_no_anonymous(bool writable) | ||
971 | // output file will wind up incomplete, but we will have already | ||
972 | // exited. The alternative to fallocate would be to use fdatasync, | ||
973 | // but that would be a more significant performance hit. | ||
974 | - if (writable && ::posix_fallocate(o, 0, this->file_size_) < 0) | ||
975 | - gold_fatal(_("%s: %s"), this->name_, strerror(errno)); | ||
976 | + if (writable) | ||
977 | + { | ||
978 | + int err = ::posix_fallocate(o, 0, this->file_size_); | ||
979 | + if (err != 0) | ||
980 | + gold_fatal(_("%s: %s"), this->name_, strerror(err)); | ||
981 | + } | ||
982 | |||
983 | // Map the file into memory. | ||
984 | int prot = PROT_READ; | ||
985 | diff --git a/gold/output.h b/gold/output.h | ||
986 | index 1bec2c0..e2d35e2 100644 | ||
987 | --- a/gold/output.h | ||
988 | +++ b/gold/output.h | ||
989 | @@ -1033,12 +1033,14 @@ class Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
990 | Output_reloc(Sized_relobj<size, big_endian>* relobj, | ||
991 | unsigned int local_sym_index, unsigned int type, | ||
992 | Output_data* od, Address address, bool is_relative, | ||
993 | - bool is_symbolless, bool is_section_symbol); | ||
994 | + bool is_symbolless, bool is_section_symbol, | ||
995 | + bool use_plt_offset); | ||
996 | |||
997 | Output_reloc(Sized_relobj<size, big_endian>* relobj, | ||
998 | unsigned int local_sym_index, unsigned int type, | ||
999 | unsigned int shndx, Address address, bool is_relative, | ||
1000 | - bool is_symbolless, bool is_section_symbol); | ||
1001 | + bool is_symbolless, bool is_section_symbol, | ||
1002 | + bool use_plt_offset); | ||
1003 | |||
1004 | // A reloc against the STT_SECTION symbol of an output section. | ||
1005 | |||
1006 | @@ -1216,7 +1218,7 @@ class Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1007 | // input file. | ||
1008 | unsigned int local_sym_index_; | ||
1009 | // The reloc type--a processor specific code. | ||
1010 | - unsigned int type_ : 29; | ||
1011 | + unsigned int type_ : 28; | ||
1012 | // True if the relocation is a RELATIVE relocation. | ||
1013 | bool is_relative_ : 1; | ||
1014 | // True if the relocation is one which should not use | ||
1015 | @@ -1224,6 +1226,10 @@ class Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1016 | bool is_symbolless_ : 1; | ||
1017 | // True if the relocation is against a section symbol. | ||
1018 | bool is_section_symbol_ : 1; | ||
1019 | + // True if the addend should be the PLT offset. This is used only | ||
1020 | + // for RELATIVE relocations to local symbols. | ||
1021 | + // (Used only for RELA, but stored here for space.) | ||
1022 | + bool use_plt_offset_ : 1; | ||
1023 | // If the reloc address is an input section in an object, the | ||
1024 | // section index. This is INVALID_CODE if the reloc address is | ||
1025 | // specified in some other way. | ||
1026 | @@ -1268,9 +1274,10 @@ class Output_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1027 | unsigned int local_sym_index, unsigned int type, | ||
1028 | Output_data* od, Address address, | ||
1029 | Addend addend, bool is_relative, | ||
1030 | - bool is_symbolless, bool is_section_symbol) | ||
1031 | + bool is_symbolless, bool is_section_symbol, | ||
1032 | + bool use_plt_offset) | ||
1033 | : rel_(relobj, local_sym_index, type, od, address, is_relative, | ||
1034 | - is_symbolless, is_section_symbol), | ||
1035 | + is_symbolless, is_section_symbol, use_plt_offset), | ||
1036 | addend_(addend) | ||
1037 | { } | ||
1038 | |||
1039 | @@ -1278,9 +1285,10 @@ class Output_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1040 | unsigned int local_sym_index, unsigned int type, | ||
1041 | unsigned int shndx, Address address, | ||
1042 | Addend addend, bool is_relative, | ||
1043 | - bool is_symbolless, bool is_section_symbol) | ||
1044 | + bool is_symbolless, bool is_section_symbol, | ||
1045 | + bool use_plt_offset) | ||
1046 | : rel_(relobj, local_sym_index, type, shndx, address, is_relative, | ||
1047 | - is_symbolless, is_section_symbol), | ||
1048 | + is_symbolless, is_section_symbol, use_plt_offset), | ||
1049 | addend_(addend) | ||
1050 | { } | ||
1051 | |||
1052 | @@ -1571,7 +1579,7 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1053 | Output_data* od, Address address) | ||
1054 | { | ||
1055 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, | ||
1056 | - address, false, false, false)); | ||
1057 | + address, false, false, false, false)); | ||
1058 | } | ||
1059 | |||
1060 | void | ||
1061 | @@ -1580,7 +1588,7 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1062 | Output_data* od, unsigned int shndx, Address address) | ||
1063 | { | ||
1064 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, | ||
1065 | - address, false, false, false)); | ||
1066 | + address, false, false, false, false)); | ||
1067 | } | ||
1068 | |||
1069 | // Add a RELATIVE reloc against a local symbol. | ||
1070 | @@ -1591,7 +1599,7 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1071 | Output_data* od, Address address) | ||
1072 | { | ||
1073 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, | ||
1074 | - address, true, true, false)); | ||
1075 | + address, true, true, false, false)); | ||
1076 | } | ||
1077 | |||
1078 | void | ||
1079 | @@ -1600,7 +1608,7 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1080 | Output_data* od, unsigned int shndx, Address address) | ||
1081 | { | ||
1082 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, | ||
1083 | - address, true, true, false)); | ||
1084 | + address, true, true, false, false)); | ||
1085 | } | ||
1086 | |||
1087 | // Add a local relocation which does not use a symbol for the relocation, | ||
1088 | @@ -1612,7 +1620,7 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1089 | Output_data* od, Address address) | ||
1090 | { | ||
1091 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, | ||
1092 | - address, false, true, false)); | ||
1093 | + address, false, true, false, false)); | ||
1094 | } | ||
1095 | |||
1096 | void | ||
1097 | @@ -1622,7 +1630,7 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1098 | Address address) | ||
1099 | { | ||
1100 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, | ||
1101 | - address, false, true, false)); | ||
1102 | + address, false, true, false, false)); | ||
1103 | } | ||
1104 | |||
1105 | // Add a reloc against a local section symbol. This will be | ||
1106 | @@ -1635,7 +1643,7 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1107 | Output_data* od, Address address) | ||
1108 | { | ||
1109 | this->add(od, Output_reloc_type(relobj, input_shndx, type, od, | ||
1110 | - address, false, false, true)); | ||
1111 | + address, false, false, true, false)); | ||
1112 | } | ||
1113 | |||
1114 | void | ||
1115 | @@ -1644,7 +1652,7 @@ class Output_data_reloc<elfcpp::SHT_REL, dynamic, size, big_endian> | ||
1116 | Output_data* od, unsigned int shndx, Address address) | ||
1117 | { | ||
1118 | this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx, | ||
1119 | - address, false, false, true)); | ||
1120 | + address, false, false, true, false)); | ||
1121 | } | ||
1122 | |||
1123 | // A reloc against the STT_SECTION symbol of an output section. | ||
1124 | @@ -1767,7 +1775,7 @@ class Output_data_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1125 | Output_data* od, Address address, Addend addend) | ||
1126 | { | ||
1127 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address, | ||
1128 | - addend, false, false, false)); | ||
1129 | + addend, false, false, false, false)); | ||
1130 | } | ||
1131 | |||
1132 | void | ||
1133 | @@ -1777,7 +1785,8 @@ class Output_data_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1134 | Addend addend) | ||
1135 | { | ||
1136 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, | ||
1137 | - address, addend, false, false, false)); | ||
1138 | + address, addend, false, false, false, | ||
1139 | + false)); | ||
1140 | } | ||
1141 | |||
1142 | // Add a RELATIVE reloc against a local symbol. | ||
1143 | @@ -1785,20 +1794,23 @@ class Output_data_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1144 | void | ||
1145 | add_local_relative(Sized_relobj<size, big_endian>* relobj, | ||
1146 | unsigned int local_sym_index, unsigned int type, | ||
1147 | - Output_data* od, Address address, Addend addend) | ||
1148 | + Output_data* od, Address address, Addend addend, | ||
1149 | + bool use_plt_offset) | ||
1150 | { | ||
1151 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address, | ||
1152 | - addend, true, true, false)); | ||
1153 | + addend, true, true, false, | ||
1154 | + use_plt_offset)); | ||
1155 | } | ||
1156 | |||
1157 | void | ||
1158 | add_local_relative(Sized_relobj<size, big_endian>* relobj, | ||
1159 | unsigned int local_sym_index, unsigned int type, | ||
1160 | Output_data* od, unsigned int shndx, Address address, | ||
1161 | - Addend addend) | ||
1162 | + Addend addend, bool use_plt_offset) | ||
1163 | { | ||
1164 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, | ||
1165 | - address, addend, true, true, false)); | ||
1166 | + address, addend, true, true, false, | ||
1167 | + use_plt_offset)); | ||
1168 | } | ||
1169 | |||
1170 | // Add a local relocation which does not use a symbol for the relocation, | ||
1171 | @@ -1810,7 +1822,7 @@ class Output_data_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1172 | Output_data* od, Address address, Addend addend) | ||
1173 | { | ||
1174 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, od, address, | ||
1175 | - addend, false, true, false)); | ||
1176 | + addend, false, true, false, false)); | ||
1177 | } | ||
1178 | |||
1179 | void | ||
1180 | @@ -1820,7 +1832,8 @@ class Output_data_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1181 | Address address, Addend addend) | ||
1182 | { | ||
1183 | this->add(od, Output_reloc_type(relobj, local_sym_index, type, shndx, | ||
1184 | - address, addend, false, true, false)); | ||
1185 | + address, addend, false, true, false, | ||
1186 | + false)); | ||
1187 | } | ||
1188 | |||
1189 | // Add a reloc against a local section symbol. This will be | ||
1190 | @@ -1833,7 +1846,7 @@ class Output_data_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1191 | Output_data* od, Address address, Addend addend) | ||
1192 | { | ||
1193 | this->add(od, Output_reloc_type(relobj, input_shndx, type, od, address, | ||
1194 | - addend, false, false, true)); | ||
1195 | + addend, false, false, true, false)); | ||
1196 | } | ||
1197 | |||
1198 | void | ||
1199 | @@ -1843,7 +1856,8 @@ class Output_data_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian> | ||
1200 | Addend addend) | ||
1201 | { | ||
1202 | this->add(od, Output_reloc_type(relobj, input_shndx, type, shndx, | ||
1203 | - address, addend, false, false, true)); | ||
1204 | + address, addend, false, false, true, | ||
1205 | + false)); | ||
1206 | } | ||
1207 | |||
1208 | // A reloc against the STT_SECTION symbol of an output section. | ||
1209 | diff --git a/gold/plugin.cc b/gold/plugin.cc | ||
1210 | index 3ccd8d0..b4e68f8 100644 | ||
1211 | --- a/gold/plugin.cc | ||
1212 | +++ b/gold/plugin.cc | ||
1213 | @@ -818,7 +818,9 @@ Pluginobj::Pluginobj(const std::string& name, Input_file* input_file, | ||
1214 | } | ||
1215 | |||
1216 | // Return TRUE if a defined symbol is referenced from outside the | ||
1217 | -// universe of claimed objects. | ||
1218 | +// universe of claimed objects. Only references from relocatable, | ||
1219 | +// non-IR (unclaimed) objects count as a reference. References from | ||
1220 | +// dynamic objects count only as "visible". | ||
1221 | |||
1222 | static inline bool | ||
1223 | is_referenced_from_outside(Symbol* lsym) | ||
1224 | @@ -838,6 +840,8 @@ is_referenced_from_outside(Symbol* lsym) | ||
1225 | static inline bool | ||
1226 | is_visible_from_outside(Symbol* lsym) | ||
1227 | { | ||
1228 | + if (lsym->in_dyn()) | ||
1229 | + return true; | ||
1230 | if (parameters->options().export_dynamic() || parameters->options().shared()) | ||
1231 | return lsym->is_externally_visible(); | ||
1232 | return false; | ||
1233 | @@ -1244,14 +1248,18 @@ Sized_pluginobj<size, big_endian>::do_initialize_xindex() | ||
1234 | return NULL; | ||
1235 | } | ||
1236 | |||
1237 | -// Get symbol counts. Not used for plugin objects. | ||
1238 | +// Get symbol counts. Don't count plugin objects; the replacement | ||
1239 | +// files will provide the counts. | ||
1240 | |||
1241 | template<int size, bool big_endian> | ||
1242 | void | ||
1243 | -Sized_pluginobj<size, big_endian>::do_get_global_symbol_counts(const Symbol_table*, | ||
1244 | - size_t*, size_t*) const | ||
1245 | +Sized_pluginobj<size, big_endian>::do_get_global_symbol_counts( | ||
1246 | + const Symbol_table*, | ||
1247 | + size_t* defined, | ||
1248 | + size_t* used) const | ||
1249 | { | ||
1250 | - gold_unreachable(); | ||
1251 | + *defined = 0; | ||
1252 | + *used = 0; | ||
1253 | } | ||
1254 | |||
1255 | // Get symbols. Not used for plugin objects. | ||
1256 | diff --git a/gold/powerpc.cc b/gold/powerpc.cc | ||
1257 | index 45783c3..62a17ca 100644 | ||
1258 | --- a/gold/powerpc.cc | ||
1259 | +++ b/gold/powerpc.cc | ||
1260 | @@ -1329,7 +1329,7 @@ Target_powerpc<size, big_endian>::Scan::local( | ||
1261 | rela_dyn->add_local_relative(object, r_sym, r_type, | ||
1262 | output_section, data_shndx, | ||
1263 | reloc.get_r_offset(), | ||
1264 | - reloc.get_r_addend()); | ||
1265 | + reloc.get_r_addend(), false); | ||
1266 | } | ||
1267 | } | ||
1268 | break; | ||
1269 | @@ -1372,7 +1372,7 @@ Target_powerpc<size, big_endian>::Scan::local( | ||
1270 | object->set_local_got_offset(r_sym, GOT_TYPE_STANDARD, off); | ||
1271 | rela_dyn->add_local_relative(object, r_sym, | ||
1272 | elfcpp::R_POWERPC_RELATIVE, | ||
1273 | - got, off, 0); | ||
1274 | + got, off, 0, false); | ||
1275 | } | ||
1276 | } | ||
1277 | else | ||
1278 | diff --git a/gold/readsyms.cc b/gold/readsyms.cc | ||
1279 | index 1e50942..9974722 100644 | ||
1280 | --- a/gold/readsyms.cc | ||
1281 | +++ b/gold/readsyms.cc | ||
1282 | @@ -161,8 +161,10 @@ void | ||
1283 | Read_symbols::run(Workqueue* workqueue) | ||
1284 | { | ||
1285 | // If we didn't queue a new task, then we need to explicitly unblock | ||
1286 | - // the token. | ||
1287 | - if (!this->do_read_symbols(workqueue)) | ||
1288 | + // the token. If the object is a member of a lib group, however, | ||
1289 | + // the token was already added to the list of locks for the task, | ||
1290 | + // and it will be unblocked automatically at the end of the task. | ||
1291 | + if (!this->do_read_symbols(workqueue) && this->member_ == NULL) | ||
1292 | workqueue->queue_soon(new Unblock_token(this->this_blocker_, | ||
1293 | this->next_blocker_)); | ||
1294 | } | ||
1295 | diff --git a/gold/resolve.cc b/gold/resolve.cc | ||
1296 | index 03288ec..780038a 100644 | ||
1297 | --- a/gold/resolve.cc | ||
1298 | +++ b/gold/resolve.cc | ||
1299 | @@ -296,7 +296,7 @@ Symbol_table::resolve(Sized_symbol<size>* to, | ||
1300 | |||
1301 | // Record if we've seen this symbol in a real ELF object (i.e., the | ||
1302 | // symbol is referenced from outside the world known to the plugin). | ||
1303 | - if (object->pluginobj() == NULL) | ||
1304 | + if (object->pluginobj() == NULL && !object->is_dynamic()) | ||
1305 | to->set_in_real_elf(); | ||
1306 | |||
1307 | // If we're processing replacement files, allow new symbols to override | ||
1308 | @@ -336,9 +336,9 @@ Symbol_table::resolve(Sized_symbol<size>* to, | ||
1309 | && to->name()[0] == '_' && to->name()[1] == 'Z') | ||
1310 | { | ||
1311 | Symbol_location fromloc | ||
1312 | - = { object, orig_st_shndx, sym.get_st_value() }; | ||
1313 | + = { object, orig_st_shndx, static_cast<off_t>(sym.get_st_value()) }; | ||
1314 | Symbol_location toloc = { to->object(), to->shndx(&to_is_ordinary), | ||
1315 | - to->value() }; | ||
1316 | + static_cast<off_t>(to->value()) }; | ||
1317 | this->candidate_odr_violations_[to->name()].insert(fromloc); | ||
1318 | this->candidate_odr_violations_[to->name()].insert(toloc); | ||
1319 | } | ||
1320 | diff --git a/gold/script-sections.cc b/gold/script-sections.cc | ||
1321 | index 1fad88d..f90c0b3 100644 | ||
1322 | --- a/gold/script-sections.cc | ||
1323 | +++ b/gold/script-sections.cc | ||
1324 | @@ -680,7 +680,7 @@ class Sections_element_assignment : public Sections_element | ||
1325 | set_section_addresses(Symbol_table* symtab, Layout* layout, | ||
1326 | uint64_t* dot_value, uint64_t*, uint64_t*) | ||
1327 | { | ||
1328 | - this->assignment_.set_if_absolute(symtab, layout, true, *dot_value); | ||
1329 | + this->assignment_.set_if_absolute(symtab, layout, true, *dot_value, NULL); | ||
1330 | } | ||
1331 | |||
1332 | // Print for debugging. | ||
1333 | @@ -714,7 +714,7 @@ class Sections_element_dot_assignment : public Sections_element | ||
1334 | // output section definition the dot symbol is always considered | ||
1335 | // to be absolute. | ||
1336 | *dot_value = this->val_->eval_with_dot(symtab, layout, true, *dot_value, | ||
1337 | - NULL, NULL, NULL); | ||
1338 | + NULL, NULL, NULL, false); | ||
1339 | } | ||
1340 | |||
1341 | // Update the dot symbol while setting section addresses. | ||
1342 | @@ -724,7 +724,7 @@ class Sections_element_dot_assignment : public Sections_element | ||
1343 | uint64_t* load_address) | ||
1344 | { | ||
1345 | *dot_value = this->val_->eval_with_dot(symtab, layout, false, *dot_value, | ||
1346 | - NULL, NULL, dot_alignment); | ||
1347 | + NULL, NULL, dot_alignment, false); | ||
1348 | *load_address = *dot_value; | ||
1349 | } | ||
1350 | |||
1351 | @@ -866,9 +866,11 @@ class Output_section_element_assignment : public Output_section_element | ||
1352 | void | ||
1353 | set_section_addresses(Symbol_table* symtab, Layout* layout, Output_section*, | ||
1354 | uint64_t, uint64_t* dot_value, uint64_t*, | ||
1355 | - Output_section**, std::string*, Input_section_list*) | ||
1356 | + Output_section** dot_section, std::string*, | ||
1357 | + Input_section_list*) | ||
1358 | { | ||
1359 | - this->assignment_.set_if_absolute(symtab, layout, true, *dot_value); | ||
1360 | + this->assignment_.set_if_absolute(symtab, layout, true, *dot_value, | ||
1361 | + *dot_section); | ||
1362 | } | ||
1363 | |||
1364 | // Print for debugging. | ||
1365 | @@ -892,20 +894,28 @@ class Output_section_element_dot_assignment : public Output_section_element | ||
1366 | : val_(val) | ||
1367 | { } | ||
1368 | |||
1369 | + // An assignment to dot within an output section is enough to force | ||
1370 | + // the output section to exist. | ||
1371 | + bool | ||
1372 | + needs_output_section() const | ||
1373 | + { return true; } | ||
1374 | + | ||
1375 | // Finalize the symbol. | ||
1376 | void | ||
1377 | finalize_symbols(Symbol_table* symtab, const Layout* layout, | ||
1378 | uint64_t* dot_value, Output_section** dot_section) | ||
1379 | { | ||
1380 | *dot_value = this->val_->eval_with_dot(symtab, layout, true, *dot_value, | ||
1381 | - *dot_section, dot_section, NULL); | ||
1382 | + *dot_section, dot_section, NULL, | ||
1383 | + true); | ||
1384 | } | ||
1385 | |||
1386 | // Update the dot symbol while setting section addresses. | ||
1387 | void | ||
1388 | set_section_addresses(Symbol_table* symtab, Layout* layout, Output_section*, | ||
1389 | uint64_t, uint64_t* dot_value, uint64_t*, | ||
1390 | - Output_section**, std::string*, Input_section_list*); | ||
1391 | + Output_section** dot_section, std::string*, | ||
1392 | + Input_section_list*); | ||
1393 | |||
1394 | // Print for debugging. | ||
1395 | void | ||
1396 | @@ -936,7 +946,8 @@ Output_section_element_dot_assignment::set_section_addresses( | ||
1397 | { | ||
1398 | uint64_t next_dot = this->val_->eval_with_dot(symtab, layout, false, | ||
1399 | *dot_value, *dot_section, | ||
1400 | - dot_section, dot_alignment); | ||
1401 | + dot_section, dot_alignment, | ||
1402 | + true); | ||
1403 | if (next_dot < *dot_value) | ||
1404 | gold_error(_("dot may not move backward")); | ||
1405 | if (next_dot > *dot_value && output_section != NULL) | ||
1406 | @@ -1037,7 +1048,8 @@ Output_data_expression::do_write_to_buffer(unsigned char* buf) | ||
1407 | { | ||
1408 | uint64_t val = this->val_->eval_with_dot(this->symtab_, this->layout_, | ||
1409 | true, this->dot_value_, | ||
1410 | - this->dot_section_, NULL, NULL); | ||
1411 | + this->dot_section_, NULL, NULL, | ||
1412 | + false); | ||
1413 | |||
1414 | if (parameters->target().is_big_endian()) | ||
1415 | this->endian_write_to_buffer<true>(val, buf); | ||
1416 | @@ -1187,7 +1199,7 @@ class Output_section_element_fill : public Output_section_element | ||
1417 | Output_section* fill_section; | ||
1418 | uint64_t fill_val = this->val_->eval_with_dot(symtab, layout, false, | ||
1419 | *dot_value, *dot_section, | ||
1420 | - &fill_section, NULL); | ||
1421 | + &fill_section, NULL, false); | ||
1422 | if (fill_section != NULL) | ||
1423 | gold_warning(_("fill value is not absolute")); | ||
1424 | // FIXME: The GNU linker supports fill values of arbitrary length. | ||
1425 | @@ -2108,13 +2120,13 @@ Output_section_definition::finalize_symbols(Symbol_table* symtab, | ||
1426 | { | ||
1427 | address = this->address_->eval_with_dot(symtab, layout, true, | ||
1428 | *dot_value, NULL, | ||
1429 | - NULL, NULL); | ||
1430 | + NULL, NULL, false); | ||
1431 | } | ||
1432 | if (this->align_ != NULL) | ||
1433 | { | ||
1434 | uint64_t align = this->align_->eval_with_dot(symtab, layout, true, | ||
1435 | *dot_value, NULL, | ||
1436 | - NULL, NULL); | ||
1437 | + NULL, NULL, false); | ||
1438 | address = align_address(address, align); | ||
1439 | } | ||
1440 | *dot_value = address; | ||
1441 | @@ -2303,7 +2315,7 @@ Output_section_definition::set_section_addresses(Symbol_table* symtab, | ||
1442 | else | ||
1443 | address = this->address_->eval_with_dot(symtab, layout, true, | ||
1444 | *dot_value, NULL, NULL, | ||
1445 | - dot_alignment); | ||
1446 | + dot_alignment, false); | ||
1447 | uint64_t align; | ||
1448 | if (this->align_ == NULL) | ||
1449 | { | ||
1450 | @@ -2316,7 +2328,7 @@ Output_section_definition::set_section_addresses(Symbol_table* symtab, | ||
1451 | { | ||
1452 | Output_section* align_section; | ||
1453 | align = this->align_->eval_with_dot(symtab, layout, true, *dot_value, | ||
1454 | - NULL, &align_section, NULL); | ||
1455 | + NULL, &align_section, NULL, false); | ||
1456 | if (align_section != NULL) | ||
1457 | gold_warning(_("alignment of section %s is not absolute"), | ||
1458 | this->name_.c_str()); | ||
1459 | @@ -2401,7 +2413,7 @@ Output_section_definition::set_section_addresses(Symbol_table* symtab, | ||
1460 | laddr = this->load_address_->eval_with_dot(symtab, layout, true, | ||
1461 | *dot_value, | ||
1462 | this->output_section_, | ||
1463 | - NULL, NULL); | ||
1464 | + NULL, NULL, false); | ||
1465 | if (this->output_section_ != NULL) | ||
1466 | this->output_section_->set_load_address(laddr); | ||
1467 | } | ||
1468 | @@ -2416,7 +2428,8 @@ Output_section_definition::set_section_addresses(Symbol_table* symtab, | ||
1469 | Output_section* subalign_section; | ||
1470 | subalign = this->subalign_->eval_with_dot(symtab, layout, true, | ||
1471 | *dot_value, NULL, | ||
1472 | - &subalign_section, NULL); | ||
1473 | + &subalign_section, NULL, | ||
1474 | + false); | ||
1475 | if (subalign_section != NULL) | ||
1476 | gold_warning(_("subalign of section %s is not absolute"), | ||
1477 | this->name_.c_str()); | ||
1478 | @@ -2431,7 +2444,7 @@ Output_section_definition::set_section_addresses(Symbol_table* symtab, | ||
1479 | uint64_t fill_val = this->fill_->eval_with_dot(symtab, layout, true, | ||
1480 | *dot_value, | ||
1481 | NULL, &fill_section, | ||
1482 | - NULL); | ||
1483 | + NULL, false); | ||
1484 | if (fill_section != NULL) | ||
1485 | gold_warning(_("fill of section %s is not absolute"), | ||
1486 | this->name_.c_str()); | ||
1487 | diff --git a/gold/script.cc b/gold/script.cc | ||
1488 | index 7df0c9e..b471cf9 100644 | ||
1489 | --- a/gold/script.cc | ||
1490 | +++ b/gold/script.cc | ||
1491 | @@ -983,18 +983,20 @@ Symbol_assignment::sized_finalize(Symbol_table* symtab, const Layout* layout, | ||
1492 | uint64_t final_val = this->val_->eval_maybe_dot(symtab, layout, true, | ||
1493 | is_dot_available, | ||
1494 | dot_value, dot_section, | ||
1495 | - §ion, NULL); | ||
1496 | + §ion, NULL, false); | ||
1497 | Sized_symbol<size>* ssym = symtab->get_sized_symbol<size>(this->sym_); | ||
1498 | ssym->set_value(final_val); | ||
1499 | if (section != NULL) | ||
1500 | ssym->set_output_section(section); | ||
1501 | } | ||
1502 | |||
1503 | -// Set the symbol value if the expression yields an absolute value. | ||
1504 | +// Set the symbol value if the expression yields an absolute value or | ||
1505 | +// a value relative to DOT_SECTION. | ||
1506 | |||
1507 | void | ||
1508 | Symbol_assignment::set_if_absolute(Symbol_table* symtab, const Layout* layout, | ||
1509 | - bool is_dot_available, uint64_t dot_value) | ||
1510 | + bool is_dot_available, uint64_t dot_value, | ||
1511 | + Output_section* dot_section) | ||
1512 | { | ||
1513 | if (this->sym_ == NULL) | ||
1514 | return; | ||
1515 | @@ -1002,8 +1004,9 @@ Symbol_assignment::set_if_absolute(Symbol_table* symtab, const Layout* layout, | ||
1516 | Output_section* val_section; | ||
1517 | uint64_t val = this->val_->eval_maybe_dot(symtab, layout, false, | ||
1518 | is_dot_available, dot_value, | ||
1519 | - NULL, &val_section, NULL); | ||
1520 | - if (val_section != NULL) | ||
1521 | + dot_section, &val_section, NULL, | ||
1522 | + false); | ||
1523 | + if (val_section != NULL && val_section != dot_section) | ||
1524 | return; | ||
1525 | |||
1526 | if (parameters->target().get_size() == 32) | ||
1527 | @@ -1026,6 +1029,8 @@ Symbol_assignment::set_if_absolute(Symbol_table* symtab, const Layout* layout, | ||
1528 | } | ||
1529 | else | ||
1530 | gold_unreachable(); | ||
1531 | + if (val_section != NULL) | ||
1532 | + this->sym_->set_output_section(val_section); | ||
1533 | } | ||
1534 | |||
1535 | // Print for debugging. | ||
1536 | @@ -1215,7 +1220,7 @@ Script_options::set_section_addresses(Symbol_table* symtab, Layout* layout) | ||
1537 | for (Symbol_assignments::iterator p = this->symbol_assignments_.begin(); | ||
1538 | p != this->symbol_assignments_.end(); | ||
1539 | ++p) | ||
1540 | - (*p)->set_if_absolute(symtab, layout, false, 0); | ||
1541 | + (*p)->set_if_absolute(symtab, layout, false, 0, NULL); | ||
1542 | |||
1543 | return this->script_sections_.set_section_addresses(symtab, layout); | ||
1544 | } | ||
1545 | diff --git a/gold/script.h b/gold/script.h | ||
1546 | index 73079a4..f41f438 100644 | ||
1547 | --- a/gold/script.h | ||
1548 | +++ b/gold/script.h | ||
1549 | @@ -90,20 +90,28 @@ class Expression | ||
1550 | // the section address. If RESULT_ALIGNMENT is not NULL, this sets | ||
1551 | // *RESULT_ALIGNMENT to the alignment of the value of that alignment | ||
1552 | // is larger than *RESULT_ALIGNMENT; this will only be non-zero if | ||
1553 | - // this is an ALIGN expression. | ||
1554 | + // this is an ALIGN expression. If IS_SECTION_DOT_ASSIGMENT is true, | ||
1555 | + // we are evaluating an assignment to dot within an output section, | ||
1556 | + // and an absolute value should be interpreted as an offset within | ||
1557 | + // the section. | ||
1558 | uint64_t | ||
1559 | eval_with_dot(const Symbol_table*, const Layout*, bool check_assertions, | ||
1560 | uint64_t dot_value, Output_section* dot_section, | ||
1561 | - Output_section** result_section, uint64_t* result_alignment); | ||
1562 | + Output_section** result_section, uint64_t* result_alignment, | ||
1563 | + bool is_section_dot_assignment); | ||
1564 | |||
1565 | // Return the value of an expression which may or may not be | ||
1566 | // permitted to refer to the dot symbol, depending on | ||
1567 | - // is_dot_available. | ||
1568 | + // is_dot_available. If IS_SECTION_DOT_ASSIGMENT is true, | ||
1569 | + // we are evaluating an assignment to dot within an output section, | ||
1570 | + // and an absolute value should be interpreted as an offset within | ||
1571 | + // the section. | ||
1572 | uint64_t | ||
1573 | eval_maybe_dot(const Symbol_table*, const Layout*, bool check_assertions, | ||
1574 | bool is_dot_available, uint64_t dot_value, | ||
1575 | Output_section* dot_section, | ||
1576 | - Output_section** result_section, uint64_t* result_alignment); | ||
1577 | + Output_section** result_section, uint64_t* result_alignment, | ||
1578 | + bool is_section_dot_assignment); | ||
1579 | |||
1580 | // Print the expression to the FILE. This is for debugging. | ||
1581 | virtual void | ||
1582 | @@ -339,12 +347,12 @@ class Symbol_assignment | ||
1583 | finalize_with_dot(Symbol_table*, const Layout*, uint64_t dot_value, | ||
1584 | Output_section* dot_section); | ||
1585 | |||
1586 | - // Set the symbol value, but only if the value is absolute. This is | ||
1587 | - // used while processing a SECTIONS clause. We assume that dot is | ||
1588 | - // an absolute value here. We do not check assertions. | ||
1589 | + // Set the symbol value, but only if the value is absolute or relative to | ||
1590 | + // DOT_SECTION. This is used while processing a SECTIONS clause. | ||
1591 | + // We assume that dot is an absolute value here. We do not check assertions. | ||
1592 | void | ||
1593 | set_if_absolute(Symbol_table*, const Layout*, bool is_dot_available, | ||
1594 | - uint64_t dot_value); | ||
1595 | + uint64_t dot_value, Output_section* dot_section); | ||
1596 | |||
1597 | const std::string& | ||
1598 | name() const | ||
1599 | diff --git a/gold/sparc.cc b/gold/sparc.cc | ||
1600 | index 5f67a4e..12e1dee 100644 | ||
1601 | --- a/gold/sparc.cc | ||
1602 | +++ b/gold/sparc.cc | ||
1603 | @@ -1855,7 +1855,7 @@ Target_sparc<size, big_endian>::Scan::local( | ||
1604 | rela_dyn->add_local_relative(object, r_sym, elfcpp::R_SPARC_RELATIVE, | ||
1605 | output_section, data_shndx, | ||
1606 | reloc.get_r_offset(), | ||
1607 | - reloc.get_r_addend()); | ||
1608 | + reloc.get_r_addend(), false); | ||
1609 | } | ||
1610 | break; | ||
1611 | |||
1612 | @@ -1946,7 +1946,7 @@ Target_sparc<size, big_endian>::Scan::local( | ||
1613 | object->set_local_got_offset(r_sym, GOT_TYPE_STANDARD, off); | ||
1614 | rela_dyn->add_local_relative(object, r_sym, | ||
1615 | elfcpp::R_SPARC_RELATIVE, | ||
1616 | - got, off, 0); | ||
1617 | + got, off, 0, false); | ||
1618 | } | ||
1619 | } | ||
1620 | else | ||
1621 | diff --git a/gold/symtab.cc b/gold/symtab.cc | ||
1622 | index ff1b5ca..f0ba1d5 100644 | ||
1623 | --- a/gold/symtab.cc | ||
1624 | +++ b/gold/symtab.cc | ||
1625 | @@ -602,20 +602,16 @@ Symbol_table::gc_mark_undef_symbols(Layout* layout) | ||
1626 | } | ||
1627 | |||
1628 | void | ||
1629 | -Symbol_table::gc_mark_symbol_for_shlib(Symbol* sym) | ||
1630 | +Symbol_table::gc_mark_symbol(Symbol* sym) | ||
1631 | { | ||
1632 | - if (!sym->is_from_dynobj() | ||
1633 | - && sym->is_externally_visible()) | ||
1634 | + // Add the object and section to the work list. | ||
1635 | + Relobj* obj = static_cast<Relobj*>(sym->object()); | ||
1636 | + bool is_ordinary; | ||
1637 | + unsigned int shndx = sym->shndx(&is_ordinary); | ||
1638 | + if (is_ordinary && shndx != elfcpp::SHN_UNDEF) | ||
1639 | { | ||
1640 | - //Add the object and section to the work list. | ||
1641 | - Relobj* obj = static_cast<Relobj*>(sym->object()); | ||
1642 | - bool is_ordinary; | ||
1643 | - unsigned int shndx = sym->shndx(&is_ordinary); | ||
1644 | - if (is_ordinary && shndx != elfcpp::SHN_UNDEF) | ||
1645 | - { | ||
1646 | - gold_assert(this->gc_!= NULL); | ||
1647 | - this->gc_->worklist().push(Section_id(obj, shndx)); | ||
1648 | - } | ||
1649 | + gold_assert(this->gc_!= NULL); | ||
1650 | + this->gc_->worklist().push(Section_id(obj, shndx)); | ||
1651 | } | ||
1652 | } | ||
1653 | |||
1654 | @@ -626,16 +622,7 @@ Symbol_table::gc_mark_dyn_syms(Symbol* sym) | ||
1655 | { | ||
1656 | if (sym->in_dyn() && sym->source() == Symbol::FROM_OBJECT | ||
1657 | && !sym->object()->is_dynamic()) | ||
1658 | - { | ||
1659 | - Relobj* obj = static_cast<Relobj*>(sym->object()); | ||
1660 | - bool is_ordinary; | ||
1661 | - unsigned int shndx = sym->shndx(&is_ordinary); | ||
1662 | - if (is_ordinary && shndx != elfcpp::SHN_UNDEF) | ||
1663 | - { | ||
1664 | - gold_assert(this->gc_ != NULL); | ||
1665 | - this->gc_->worklist().push(Section_id(obj, shndx)); | ||
1666 | - } | ||
1667 | - } | ||
1668 | + this->gc_mark_symbol(sym); | ||
1669 | } | ||
1670 | |||
1671 | // Make TO a symbol which forwards to FROM. | ||
1672 | @@ -1143,6 +1130,14 @@ Symbol_table::add_from_relobj( | ||
1673 | bool is_default_version = false; | ||
1674 | bool is_forced_local = false; | ||
1675 | |||
1676 | + // FIXME: For incremental links, we don't store version information, | ||
1677 | + // so we need to ignore version symbols for now. | ||
1678 | + if (parameters->incremental_update() && ver != NULL) | ||
1679 | + { | ||
1680 | + namelen = ver - name; | ||
1681 | + ver = NULL; | ||
1682 | + } | ||
1683 | + | ||
1684 | if (ver != NULL) | ||
1685 | { | ||
1686 | // The symbol name is of the form foo@VERSION or foo@@VERSION | ||
1687 | @@ -1243,11 +1238,16 @@ Symbol_table::add_from_relobj( | ||
1688 | if (is_forced_local) | ||
1689 | this->force_local(res); | ||
1690 | |||
1691 | - // If building a shared library using garbage collection, do not | ||
1692 | - // treat externally visible symbols as garbage. | ||
1693 | - if (parameters->options().gc_sections() | ||
1694 | - && parameters->options().shared()) | ||
1695 | - this->gc_mark_symbol_for_shlib(res); | ||
1696 | + // Do not treat this symbol as garbage if this symbol will be | ||
1697 | + // exported to the dynamic symbol table. This is true when | ||
1698 | + // building a shared library or using --export-dynamic and | ||
1699 | + // the symbol is externally visible. | ||
1700 | + if (parameters->options().gc_sections() | ||
1701 | + && res->is_externally_visible() | ||
1702 | + && !res->is_from_dynobj() | ||
1703 | + && (parameters->options().shared() | ||
1704 | + || parameters->options().export_dynamic())) | ||
1705 | + this->gc_mark_symbol(res); | ||
1706 | |||
1707 | if (is_defined_in_discarded_section) | ||
1708 | res->set_is_defined_in_discarded_section(); | ||
1709 | @@ -1346,6 +1346,11 @@ Symbol_table::add_from_dynobj( | ||
1710 | return; | ||
1711 | } | ||
1712 | |||
1713 | + // FIXME: For incremental links, we don't store version information, | ||
1714 | + // so we need to ignore version symbols for now. | ||
1715 | + if (parameters->incremental_update()) | ||
1716 | + versym = NULL; | ||
1717 | + | ||
1718 | if (versym != NULL && versym_size / 2 < count) | ||
1719 | { | ||
1720 | dynobj->error(_("too few symbol versions")); | ||
1721 | @@ -2809,6 +2814,12 @@ Symbol_table::sized_write_globals(const Stringpool* sympool, | ||
1722 | typename elfcpp::Elf_types<size>::Elf_Addr sym_value = sym->value(); | ||
1723 | typename elfcpp::Elf_types<size>::Elf_Addr dynsym_value = sym_value; | ||
1724 | elfcpp::STB binding = sym->binding(); | ||
1725 | + | ||
1726 | + // If --no-gnu-unique is set, change STB_GNU_UNIQUE to STB_GLOBAL. | ||
1727 | + if (binding == elfcpp::STB_GNU_UNIQUE | ||
1728 | + && !parameters->options().gnu_unique()) | ||
1729 | + binding = elfcpp::STB_GLOBAL; | ||
1730 | + | ||
1731 | switch (sym->source()) | ||
1732 | { | ||
1733 | case Symbol::FROM_OBJECT: | ||
1734 | diff --git a/gold/symtab.h b/gold/symtab.h | ||
1735 | index b9b9e00..427f72f 100644 | ||
1736 | --- a/gold/symtab.h | ||
1737 | +++ b/gold/symtab.h | ||
1738 | @@ -1308,10 +1308,9 @@ class Symbol_table | ||
1739 | void | ||
1740 | gc_mark_undef_symbols(Layout*); | ||
1741 | |||
1742 | - // During garbage collection, this ensures externally visible symbols | ||
1743 | - // are not treated as garbage while building shared objects. | ||
1744 | + // This tells garbage collection that this symbol is referenced. | ||
1745 | void | ||
1746 | - gc_mark_symbol_for_shlib(Symbol* sym); | ||
1747 | + gc_mark_symbol(Symbol* sym); | ||
1748 | |||
1749 | // During garbage collection, this keeps sections that correspond to | ||
1750 | // symbols seen in dynamic objects. | ||
1751 | diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in | ||
1752 | index 67149fb..785dcdd 100644 | ||
1753 | --- a/gold/testsuite/Makefile.in | ||
1754 | +++ b/gold/testsuite/Makefile.in | ||
1755 | @@ -1844,6 +1844,8 @@ EGREP = @EGREP@ | ||
1756 | EXEEXT = @EXEEXT@ | ||
1757 | GENCAT = @GENCAT@ | ||
1758 | GMSGFMT = @GMSGFMT@ | ||
1759 | +GOLD_LDADD = @GOLD_LDADD@ | ||
1760 | +GOLD_LDFLAGS = @GOLD_LDFLAGS@ | ||
1761 | GREP = @GREP@ | ||
1762 | INCINTL = @INCINTL@ | ||
1763 | INSTALL = @INSTALL@ | ||
1764 | diff --git a/gold/testsuite/plugin_test_2.sh b/gold/testsuite/plugin_test_2.sh | ||
1765 | index a47d22a..293b1f0 100755 | ||
1766 | --- a/gold/testsuite/plugin_test_2.sh | ||
1767 | +++ b/gold/testsuite/plugin_test_2.sh | ||
1768 | @@ -45,7 +45,7 @@ check plugin_test_2.err "two_file_test_main.o: claim file hook called" | ||
1769 | check plugin_test_2.err "two_file_test_1.syms: claim file hook called" | ||
1770 | check plugin_test_2.err "two_file_test_1b.syms: claim file hook called" | ||
1771 | check plugin_test_2.err "two_file_shared_2.so: claim file hook called" | ||
1772 | -check plugin_test_2.err "two_file_test_1.syms: _Z4f13iv: PREVAILING_DEF_REG" | ||
1773 | +check plugin_test_2.err "two_file_test_1.syms: _Z4f13iv: PREVAILING_DEF_IRONLY_EXP" | ||
1774 | check plugin_test_2.err "two_file_test_1.syms: _Z2t2v: PREVAILING_DEF_REG" | ||
1775 | check plugin_test_2.err "two_file_test_1.syms: v2: RESOLVED_DYN" | ||
1776 | check plugin_test_2.err "two_file_test_1.syms: t17data: RESOLVED_DYN" | ||
1777 | diff --git a/gold/testsuite/script_test_2.t b/gold/testsuite/script_test_2.t | ||
1778 | index 73d39df..6a0188f 100644 | ||
1779 | --- a/gold/testsuite/script_test_2.t | ||
1780 | +++ b/gold/testsuite/script_test_2.t | ||
1781 | @@ -49,7 +49,7 @@ SECTIONS | ||
1782 | /* This should match the remaining sections. */ | ||
1783 | *(.gold_test) | ||
1784 | |||
1785 | - . = . + 4; | ||
1786 | + . = 60; | ||
1787 | start_data = .; | ||
1788 | BYTE(1) | ||
1789 | SHORT(2) | ||
1790 | diff --git a/gold/x86_64.cc b/gold/x86_64.cc | ||
1791 | index e6b0021..e7c981b 100644 | ||
1792 | --- a/gold/x86_64.cc | ||
1793 | +++ b/gold/x86_64.cc | ||
1794 | @@ -1549,7 +1549,7 @@ Target_x86_64::reserve_local_got_entry( | ||
1795 | case GOT_TYPE_STANDARD: | ||
1796 | if (parameters->options().output_is_position_independent()) | ||
1797 | rela_dyn->add_local_relative(obj, r_sym, elfcpp::R_X86_64_RELATIVE, | ||
1798 | - this->got_, got_offset, 0); | ||
1799 | + this->got_, got_offset, 0, false); | ||
1800 | break; | ||
1801 | case GOT_TYPE_TLS_OFFSET: | ||
1802 | rela_dyn->add_local(obj, r_sym, elfcpp::R_X86_64_TPOFF64, | ||
1803 | @@ -1953,8 +1953,8 @@ Target_x86_64::Scan::local(Symbol_table* symtab, | ||
1804 | const elfcpp::Sym<64, false>& lsym) | ||
1805 | { | ||
1806 | // A local STT_GNU_IFUNC symbol may require a PLT entry. | ||
1807 | - if (lsym.get_st_type() == elfcpp::STT_GNU_IFUNC | ||
1808 | - && this->reloc_needs_plt_for_ifunc(object, r_type)) | ||
1809 | + bool is_ifunc = lsym.get_st_type() == elfcpp::STT_GNU_IFUNC; | ||
1810 | + if (is_ifunc && this->reloc_needs_plt_for_ifunc(object, r_type)) | ||
1811 | { | ||
1812 | unsigned int r_sym = elfcpp::elf_r_sym<64>(reloc.get_r_info()); | ||
1813 | target->make_local_ifunc_plt_entry(symtab, layout, object, r_sym); | ||
1814 | @@ -1982,7 +1982,7 @@ Target_x86_64::Scan::local(Symbol_table* symtab, | ||
1815 | elfcpp::R_X86_64_RELATIVE, | ||
1816 | output_section, data_shndx, | ||
1817 | reloc.get_r_offset(), | ||
1818 | - reloc.get_r_addend()); | ||
1819 | + reloc.get_r_addend(), is_ifunc); | ||
1820 | } | ||
1821 | break; | ||
1822 | |||
1823 | @@ -2058,7 +2058,7 @@ Target_x86_64::Scan::local(Symbol_table* symtab, | ||
1824 | // lets function pointers compare correctly with shared | ||
1825 | // libraries. Otherwise we would need an IRELATIVE reloc. | ||
1826 | bool is_new; | ||
1827 | - if (lsym.get_st_type() == elfcpp::STT_GNU_IFUNC) | ||
1828 | + if (is_ifunc) | ||
1829 | is_new = got->add_local_plt(object, r_sym, GOT_TYPE_STANDARD); | ||
1830 | else | ||
1831 | is_new = got->add_local(object, r_sym, GOT_TYPE_STANDARD); | ||
1832 | @@ -2076,7 +2076,7 @@ Target_x86_64::Scan::local(Symbol_table* symtab, | ||
1833 | object->local_got_offset(r_sym, GOT_TYPE_STANDARD); | ||
1834 | rela_dyn->add_local_relative(object, r_sym, | ||
1835 | elfcpp::R_X86_64_RELATIVE, | ||
1836 | - got, got_offset, 0); | ||
1837 | + got, got_offset, 0, is_ifunc); | ||
1838 | } | ||
1839 | else | ||
1840 | { | ||
1841 | @@ -3181,12 +3181,6 @@ Target_x86_64::Relocate::relocate_tls(const Relocate_info<64, false>* relinfo, | ||
1842 | } | ||
1843 | if (optimized_type == tls::TLSOPT_TO_IE) | ||
1844 | { | ||
1845 | - if (tls_segment == NULL) | ||
1846 | - { | ||
1847 | - gold_assert(parameters->errors()->error_count() > 0 | ||
1848 | - || issue_undefined_symbol_error(gsym)); | ||
1849 | - return; | ||
1850 | - } | ||
1851 | value = target->got_plt_section()->address() + got_offset; | ||
1852 | this->tls_gd_to_ie(relinfo, relnum, tls_segment, rela, r_type, | ||
1853 | value, view, address, view_size); | ||
1854 | @@ -3867,42 +3861,51 @@ Target_x86_64::do_code_fill(section_size_type length) const | ||
1855 | } | ||
1856 | |||
1857 | // Nop sequences of various lengths. | ||
1858 | - const char nop1[1] = { 0x90 }; // nop | ||
1859 | - const char nop2[2] = { 0x66, 0x90 }; // xchg %ax %ax | ||
1860 | - const char nop3[3] = { 0x0f, 0x1f, 0x00 }; // nop (%rax) | ||
1861 | - const char nop4[4] = { 0x0f, 0x1f, 0x40, 0x00}; // nop 0(%rax) | ||
1862 | - const char nop5[5] = { 0x0f, 0x1f, 0x44, 0x00, // nop 0(%rax,%rax,1) | ||
1863 | - 0x00 }; | ||
1864 | - const char nop6[6] = { 0x66, 0x0f, 0x1f, 0x44, // nopw 0(%rax,%rax,1) | ||
1865 | - 0x00, 0x00 }; | ||
1866 | - const char nop7[7] = { 0x0f, 0x1f, 0x80, 0x00, // nopl 0L(%rax) | ||
1867 | - 0x00, 0x00, 0x00 }; | ||
1868 | - const char nop8[8] = { 0x0f, 0x1f, 0x84, 0x00, // nopl 0L(%rax,%rax,1) | ||
1869 | - 0x00, 0x00, 0x00, 0x00 }; | ||
1870 | - const char nop9[9] = { 0x66, 0x0f, 0x1f, 0x84, // nopw 0L(%rax,%rax,1) | ||
1871 | - 0x00, 0x00, 0x00, 0x00, | ||
1872 | - 0x00 }; | ||
1873 | - const char nop10[10] = { 0x66, 0x2e, 0x0f, 0x1f, // nopw %cs:0L(%rax,%rax,1) | ||
1874 | - 0x84, 0x00, 0x00, 0x00, | ||
1875 | - 0x00, 0x00 }; | ||
1876 | - const char nop11[11] = { 0x66, 0x66, 0x2e, 0x0f, // data16 | ||
1877 | - 0x1f, 0x84, 0x00, 0x00, // nopw %cs:0L(%rax,%rax,1) | ||
1878 | - 0x00, 0x00, 0x00 }; | ||
1879 | - const char nop12[12] = { 0x66, 0x66, 0x66, 0x2e, // data16; data16 | ||
1880 | - 0x0f, 0x1f, 0x84, 0x00, // nopw %cs:0L(%rax,%rax,1) | ||
1881 | - 0x00, 0x00, 0x00, 0x00 }; | ||
1882 | - const char nop13[13] = { 0x66, 0x66, 0x66, 0x66, // data16; data16; data16 | ||
1883 | - 0x2e, 0x0f, 0x1f, 0x84, // nopw %cs:0L(%rax,%rax,1) | ||
1884 | - 0x00, 0x00, 0x00, 0x00, | ||
1885 | - 0x00 }; | ||
1886 | - const char nop14[14] = { 0x66, 0x66, 0x66, 0x66, // data16; data16; data16 | ||
1887 | - 0x66, 0x2e, 0x0f, 0x1f, // data16 | ||
1888 | - 0x84, 0x00, 0x00, 0x00, // nopw %cs:0L(%rax,%rax,1) | ||
1889 | - 0x00, 0x00 }; | ||
1890 | - const char nop15[15] = { 0x66, 0x66, 0x66, 0x66, // data16; data16; data16 | ||
1891 | - 0x66, 0x66, 0x2e, 0x0f, // data16; data16 | ||
1892 | - 0x1f, 0x84, 0x00, 0x00, // nopw %cs:0L(%rax,%rax,1) | ||
1893 | - 0x00, 0x00, 0x00 }; | ||
1894 | + const char nop1[1] = { '\x90' }; // nop | ||
1895 | + const char nop2[2] = { '\x66', '\x90' }; // xchg %ax %ax | ||
1896 | + const char nop3[3] = { '\x0f', '\x1f', '\x00' }; // nop (%rax) | ||
1897 | + const char nop4[4] = { '\x0f', '\x1f', '\x40', // nop 0(%rax) | ||
1898 | + '\x00'}; | ||
1899 | + const char nop5[5] = { '\x0f', '\x1f', '\x44', // nop 0(%rax,%rax,1) | ||
1900 | + '\x00', '\x00' }; | ||
1901 | + const char nop6[6] = { '\x66', '\x0f', '\x1f', // nopw 0(%rax,%rax,1) | ||
1902 | + '\x44', '\x00', '\x00' }; | ||
1903 | + const char nop7[7] = { '\x0f', '\x1f', '\x80', // nopl 0L(%rax) | ||
1904 | + '\x00', '\x00', '\x00', | ||
1905 | + '\x00' }; | ||
1906 | + const char nop8[8] = { '\x0f', '\x1f', '\x84', // nopl 0L(%rax,%rax,1) | ||
1907 | + '\x00', '\x00', '\x00', | ||
1908 | + '\x00', '\x00' }; | ||
1909 | + const char nop9[9] = { '\x66', '\x0f', '\x1f', // nopw 0L(%rax,%rax,1) | ||
1910 | + '\x84', '\x00', '\x00', | ||
1911 | + '\x00', '\x00', '\x00' }; | ||
1912 | + const char nop10[10] = { '\x66', '\x2e', '\x0f', // nopw %cs:0L(%rax,%rax,1) | ||
1913 | + '\x1f', '\x84', '\x00', | ||
1914 | + '\x00', '\x00', '\x00', | ||
1915 | + '\x00' }; | ||
1916 | + const char nop11[11] = { '\x66', '\x66', '\x2e', // data16 | ||
1917 | + '\x0f', '\x1f', '\x84', // nopw %cs:0L(%rax,%rax,1) | ||
1918 | + '\x00', '\x00', '\x00', | ||
1919 | + '\x00', '\x00' }; | ||
1920 | + const char nop12[12] = { '\x66', '\x66', '\x66', // data16; data16 | ||
1921 | + '\x2e', '\x0f', '\x1f', // nopw %cs:0L(%rax,%rax,1) | ||
1922 | + '\x84', '\x00', '\x00', | ||
1923 | + '\x00', '\x00', '\x00' }; | ||
1924 | + const char nop13[13] = { '\x66', '\x66', '\x66', // data16; data16; data16 | ||
1925 | + '\x66', '\x2e', '\x0f', // nopw %cs:0L(%rax,%rax,1) | ||
1926 | + '\x1f', '\x84', '\x00', | ||
1927 | + '\x00', '\x00', '\x00', | ||
1928 | + '\x00' }; | ||
1929 | + const char nop14[14] = { '\x66', '\x66', '\x66', // data16; data16; data16 | ||
1930 | + '\x66', '\x66', '\x2e', // data16 | ||
1931 | + '\x0f', '\x1f', '\x84', // nopw %cs:0L(%rax,%rax,1) | ||
1932 | + '\x00', '\x00', '\x00', | ||
1933 | + '\x00', '\x00' }; | ||
1934 | + const char nop15[15] = { '\x66', '\x66', '\x66', // data16; data16; data16 | ||
1935 | + '\x66', '\x66', '\x66', // data16; data16 | ||
1936 | + '\x2e', '\x0f', '\x1f', // nopw %cs:0L(%rax,%rax,1) | ||
1937 | + '\x84', '\x00', '\x00', | ||
1938 | + '\x00', '\x00', '\x00' }; | ||
1939 | |||
1940 | const char* nops[16] = { | ||
1941 | NULL, | ||
1942 | -- | ||
1943 | 1.7.9.5 | ||
1944 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0039-emulparams-elf32bmip.sh-OTHER_SECTIONS-Put-.mdebug.-.patch b/meta/recipes-devtools/binutils/binutils/0039-emulparams-elf32bmip.sh-OTHER_SECTIONS-Put-.mdebug.-.patch new file mode 100644 index 0000000000..657d6739eb --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0039-emulparams-elf32bmip.sh-OTHER_SECTIONS-Put-.mdebug.-.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From 80041361bf80194da35c5efb842125f3ce1d2bf2 Mon Sep 17 00:00:00 2001 | ||
4 | From: Joseph Myers <joseph@codesourcery.com> | ||
5 | Date: Tue, 20 Dec 2011 18:00:03 +0000 | ||
6 | Subject: [PATCH 039/262] * emulparams/elf32bmip.sh (OTHER_SECTIONS): | ||
7 | Put .mdebug.* and .gcc_compiled_long* sections | ||
8 | at address 0. | ||
9 | |||
10 | --- | ||
11 | ld/ChangeLog | 5 +++++ | ||
12 | ld/emulparams/elf32bmip.sh | 16 ++++++++-------- | ||
13 | 2 files changed, 13 insertions(+), 8 deletions(-) | ||
14 | |||
15 | 2011-12-20 Joseph Myers <joseph@codesourcery.com> | ||
16 | |||
17 | * emulparams/elf32bmip.sh (OTHER_SECTIONS): Put .mdebug.* and | ||
18 | .gcc_compiled_long* sections at address 0. | ||
19 | |||
20 | diff --git a/ld/emulparams/elf32bmip.sh b/ld/emulparams/elf32bmip.sh | ||
21 | index 44a0b8a..f0fcd2c 100644 | ||
22 | --- a/ld/emulparams/elf32bmip.sh | ||
23 | +++ b/ld/emulparams/elf32bmip.sh | ||
24 | @@ -64,14 +64,14 @@ OTHER_BSS_SYMBOLS='_fbss = .;' | ||
25 | OTHER_SECTIONS=' | ||
26 | .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } | ||
27 | .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } | ||
28 | - .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) } | ||
29 | - .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) } | ||
30 | - .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) } | ||
31 | - .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) } | ||
32 | - .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) } | ||
33 | - .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) } | ||
34 | - .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) } | ||
35 | - .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) } | ||
36 | + .mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) } | ||
37 | + .mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) } | ||
38 | + .mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) } | ||
39 | + .mdebug.abiO64 0 : { KEEP(*(.mdebug.abiO64)) } | ||
40 | + .mdebug.eabi32 0 : { KEEP(*(.mdebug.eabi32)) } | ||
41 | + .mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) } | ||
42 | + .gcc_compiled_long32 0 : { KEEP(*(.gcc_compiled_long32)) } | ||
43 | + .gcc_compiled_long64 0 : { KEEP(*(.gcc_compiled_long64)) } | ||
44 | ' | ||
45 | ARCH=mips | ||
46 | MACHINE= | ||
47 | -- | ||
48 | 1.7.9.5 | ||
49 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0052-gas.patch b/meta/recipes-devtools/binutils/binutils/0052-gas.patch new file mode 100644 index 0000000000..a9bb3ac0e4 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0052-gas.patch | |||
@@ -0,0 +1,83 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From e45a3a5695408d472e8f0ca6c21eb03e5fd42817 Mon Sep 17 00:00:00 2001 | ||
4 | From: Richard Sandiford <rsandifo@nildram.co.uk> | ||
5 | Date: Sun, 8 Jan 2012 12:34:30 +0000 | ||
6 | Subject: [PATCH 052/262] gas/ * config/tc-mips.c (s_tls_rel_directive): | ||
7 | Call mips_clear_insn_labels. | ||
8 | |||
9 | gas/testsuite/ | ||
10 | * gas/mips/tls-relw.s, gas/mips/tls-relw.d: New test. | ||
11 | * gas/mips/mips.exp: Run it. | ||
12 | --- | ||
13 | gas/ChangeLog | 4 ++++ | ||
14 | gas/config/tc-mips.c | 1 + | ||
15 | gas/testsuite/ChangeLog | 5 +++++ | ||
16 | gas/testsuite/gas/mips/mips.exp | 1 + | ||
17 | gas/testsuite/gas/mips/tls-relw.d | 8 ++++++++ | ||
18 | gas/testsuite/gas/mips/tls-relw.s | 12 ++++++++++++ | ||
19 | 6 files changed, 31 insertions(+) | ||
20 | create mode 100644 gas/testsuite/gas/mips/tls-relw.d | ||
21 | create mode 100644 gas/testsuite/gas/mips/tls-relw.s | ||
22 | |||
23 | 2012-01-08 Richard Sandiford <rdsandiford@googlemail.com> | ||
24 | |||
25 | * config/tc-mips.c (s_tls_rel_directive): Call mips_clear_insn_labels. | ||
26 | |||
27 | diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c | ||
28 | index 0fb3a6e..5324450 100644 | ||
29 | --- a/gas/config/tc-mips.c | ||
30 | +++ b/gas/config/tc-mips.c | ||
31 | @@ -16591,6 +16591,7 @@ s_tls_rel_directive (const size_t bytes, const char *dirstr, | ||
32 | md_number_to_chars (p, 0, bytes); | ||
33 | fix_new_exp (frag_now, p - frag_now->fr_literal, bytes, &ex, FALSE, rtype); | ||
34 | demand_empty_rest_of_line (); | ||
35 | + mips_clear_insn_labels (); | ||
36 | } | ||
37 | |||
38 | /* Handle .dtprelword. */ | ||
39 | --- a/gas/testsuite/gas/mips/mips.exp | ||
40 | +++ b/gas/testsuite/gas/mips/mips.exp | ||
41 | @@ -878,6 +878,7 @@ if { [istarget mips*-*-vxworks*] } { | ||
42 | |||
43 | run_list_test "tls-ill" "-32" | ||
44 | run_dump_test "tls-o32" | ||
45 | + run_dump_test "tls-relw" | ||
46 | run_dump_test "jalr2" | ||
47 | |||
48 | run_dump_test_arches "aent" [mips_arch_list_matching mips1] | ||
49 | diff --git a/gas/testsuite/gas/mips/tls-relw.d b/gas/testsuite/gas/mips/tls-relw.d | ||
50 | new file mode 100644 | ||
51 | index 0000000..bc13b43 | ||
52 | --- /dev/null | ||
53 | +++ b/gas/testsuite/gas/mips/tls-relw.d | ||
54 | @@ -0,0 +1,8 @@ | ||
55 | +# as: -EB | ||
56 | +# objdump: -sj.data | ||
57 | + | ||
58 | +.* | ||
59 | + | ||
60 | +Contents of section \.data: | ||
61 | + 0000 00000001 00000000 00000002 00000004 ................ | ||
62 | + 0010 00000000 00000003 00000010 00000000 ................ | ||
63 | diff --git a/gas/testsuite/gas/mips/tls-relw.s b/gas/testsuite/gas/mips/tls-relw.s | ||
64 | new file mode 100644 | ||
65 | index 0000000..6890685 | ||
66 | --- /dev/null | ||
67 | +++ b/gas/testsuite/gas/mips/tls-relw.s | ||
68 | @@ -0,0 +1,12 @@ | ||
69 | + .data | ||
70 | +start: | ||
71 | + .word 1 | ||
72 | +a: | ||
73 | + .tprelword t1 | ||
74 | + .word 2 | ||
75 | + .word a-start | ||
76 | +b: | ||
77 | + .dtprelword t2 | ||
78 | + .word 3 | ||
79 | + .word b-start | ||
80 | + .word 0 | ||
81 | -- | ||
82 | 1.7.9.5 | ||
83 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0055-Remove-ABI_64_P-check-on-R_X86_64_PCXX.patch b/meta/recipes-devtools/binutils/binutils/0055-Remove-ABI_64_P-check-on-R_X86_64_PCXX.patch new file mode 100644 index 0000000000..697d70eac5 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0055-Remove-ABI_64_P-check-on-R_X86_64_PCXX.patch | |||
@@ -0,0 +1,176 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From fee27086a7592c1812253e9c1c26f412dd87f3a2 Mon Sep 17 00:00:00 2001 | ||
4 | From: "H.J. Lu" <hjl.tools@gmail.com> | ||
5 | Date: Tue, 10 Jan 2012 20:34:56 +0000 | ||
6 | Subject: [PATCH 055/262] Remove ABI_64_P check on R_X86_64_PCXX | ||
7 | |||
8 | bfd/ | ||
9 | |||
10 | 2012-01-10 H.J. Lu <hongjiu.lu@intel.com> | ||
11 | |||
12 | PR ld/13581 | ||
13 | * elf64-x86-64.c (elf_x86_64_relocate_section): Remove ABI_64_P | ||
14 | check on R_X86_64_PCXX. | ||
15 | |||
16 | ld/testsuite/ | ||
17 | |||
18 | 2012-01-10 H.J. Lu <hongjiu.lu@intel.com> | ||
19 | |||
20 | PR ld/13581 | ||
21 | * ld-x86-64/ilp32-4.s: New. | ||
22 | * ld-x86-64/ilp32-10.d: Likewise. | ||
23 | * ld-x86-64/ilp32-10.s: Likewise. | ||
24 | |||
25 | * ld-x86-64/ilp32-4.d: Adjusted. | ||
26 | * ld-x86-64/ilp32-5.d: Likewise. | ||
27 | * ld-x86-64/ilp32-5.s: Likewise. | ||
28 | |||
29 | * ld-x86-64/x86-64.exp: Run ilp32-10. | ||
30 | --- | ||
31 | bfd/ChangeLog | 7 +++++++ | ||
32 | bfd/elf64-x86-64.c | 1 - | ||
33 | ld/testsuite/ChangeLog | 14 ++++++++++++++ | ||
34 | ld/testsuite/ld-x86-64/ilp32-10.d | 3 +++ | ||
35 | ld/testsuite/ld-x86-64/ilp32-10.s | 3 +++ | ||
36 | ld/testsuite/ld-x86-64/ilp32-4.d | 32 +++++++++++++------------------- | ||
37 | ld/testsuite/ld-x86-64/ilp32-4.s | 3 +++ | ||
38 | ld/testsuite/ld-x86-64/ilp32-5.d | 2 +- | ||
39 | ld/testsuite/ld-x86-64/ilp32-5.s | 2 +- | ||
40 | ld/testsuite/ld-x86-64/x86-64.exp | 1 + | ||
41 | 10 files changed, 46 insertions(+), 22 deletions(-) | ||
42 | create mode 100644 ld/testsuite/ld-x86-64/ilp32-10.d | ||
43 | create mode 100644 ld/testsuite/ld-x86-64/ilp32-10.s | ||
44 | create mode 100644 ld/testsuite/ld-x86-64/ilp32-4.s | ||
45 | |||
46 | diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c | ||
47 | index 3a2444b..bdb3ae6 100644 | ||
48 | --- a/bfd/elf64-x86-64.c | ||
49 | +++ b/bfd/elf64-x86-64.c | ||
50 | @@ -3460,7 +3460,6 @@ elf_x86_64_relocate_section (bfd *output_bfd, | ||
51 | case R_X86_64_PC16: | ||
52 | case R_X86_64_PC32: | ||
53 | if (info->shared | ||
54 | - && ABI_64_P (output_bfd) | ||
55 | && (input_section->flags & SEC_ALLOC) != 0 | ||
56 | && (input_section->flags & SEC_READONLY) != 0 | ||
57 | && h != NULL) | ||
58 | diff --git a/ld/testsuite/ld-x86-64/ilp32-10.d b/ld/testsuite/ld-x86-64/ilp32-10.d | ||
59 | new file mode 100644 | ||
60 | index 0000000..43d9fbd | ||
61 | --- /dev/null | ||
62 | +++ b/ld/testsuite/ld-x86-64/ilp32-10.d | ||
63 | @@ -0,0 +1,3 @@ | ||
64 | +#as: --x32 | ||
65 | +#ld: -shared -melf32_x86_64 | ||
66 | +#error: .*relocation R_X86_64_PC32 against undefined symbol `bar' can not be used when making a shared object; recompile with -fPIC | ||
67 | diff --git a/ld/testsuite/ld-x86-64/ilp32-10.s b/ld/testsuite/ld-x86-64/ilp32-10.s | ||
68 | new file mode 100644 | ||
69 | index 0000000..70e4a90 | ||
70 | --- /dev/null | ||
71 | +++ b/ld/testsuite/ld-x86-64/ilp32-10.s | ||
72 | @@ -0,0 +1,3 @@ | ||
73 | + .globl foo | ||
74 | +foo: | ||
75 | + mov bar(%rip), %rax | ||
76 | diff --git a/ld/testsuite/ld-x86-64/ilp32-4.d b/ld/testsuite/ld-x86-64/ilp32-4.d | ||
77 | index 84dc7b2..92d8a67 100644 | ||
78 | --- a/ld/testsuite/ld-x86-64/ilp32-4.d | ||
79 | +++ b/ld/testsuite/ld-x86-64/ilp32-4.d | ||
80 | @@ -1,36 +1,30 @@ | ||
81 | -#source: start.s | ||
82 | #as: --x32 | ||
83 | #ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info | ||
84 | #readelf: -d -S --wide | ||
85 | |||
86 | -There are 10 section headers, starting at offset 0x22c: | ||
87 | +There are 9 section headers, starting at offset 0x1d8: | ||
88 | |||
89 | Section Headers: | ||
90 | \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al | ||
91 | \[ 0\] NULL 00000000 000000 000000 00 0 0 0 | ||
92 | - \[ 1\] .hash HASH 00000094 000094 000030 04 A 2 0 4 | ||
93 | - \[ 2\] .dynsym DYNSYM 000000c4 0000c4 000070 10 A 3 2 4 | ||
94 | - \[ 3\] .dynstr STRTAB 00000134 000134 00001d 00 A 0 0 1 | ||
95 | - \[ 4\] .rela.dyn RELA 00000154 000154 00000c 0c A 2 0 4 | ||
96 | - \[ 5\] .text PROGBITS 00000160 000160 000005 00 AX 0 0 4 | ||
97 | - \[ 6\] .dynamic DYNAMIC 00200168 000168 000078 08 WA 3 0 4 | ||
98 | - \[ 7\] .shstrtab STRTAB 00000000 0001e0 00004a 00 0 0 1 | ||
99 | - \[ 8\] .symtab SYMTAB 00000000 0003bc 0000e0 10 9 9 4 | ||
100 | - \[ 9\] .strtab STRTAB 00000000 00049c 000043 00 0 0 1 | ||
101 | + \[ 1\] .hash HASH 00000094 000094 00002c 04 A 2 0 4 | ||
102 | + \[ 2\] .dynsym DYNSYM 000000c0 0000c0 000060 10 A 3 2 4 | ||
103 | + \[ 3\] .dynstr STRTAB 00000120 000120 000019 00 A 0 0 1 | ||
104 | + \[ 4\] .text PROGBITS 0000013c 00013c 000001 00 AX 0 0 4 | ||
105 | + \[ 5\] .dynamic DYNAMIC 00200140 000140 000058 08 WA 3 0 4 | ||
106 | + \[ 6\] .shstrtab STRTAB 00000000 000198 000040 00 0 0 1 | ||
107 | + \[ 7\] .symtab SYMTAB 00000000 000340 0000c0 10 8 8 4 | ||
108 | + \[ 8\] .strtab STRTAB 00000000 000400 00003f 00 0 0 1 | ||
109 | Key to Flags: | ||
110 | W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\), l \(large\) | ||
111 | I \(info\), L \(link order\), G \(group\), T \(TLS\), E \(exclude\), x \(unknown\) | ||
112 | O \(extra OS processing required\) o \(OS specific\), p \(processor specific\) | ||
113 | |||
114 | -Dynamic section at offset 0x168 contains 10 entries: | ||
115 | +Dynamic section at offset 0x140 contains 6 entries: | ||
116 | Tag Type Name/Value | ||
117 | 0x00000004 \(HASH\) 0x94 | ||
118 | - 0x00000005 \(STRTAB\) 0x134 | ||
119 | - 0x00000006 \(SYMTAB\) 0xc4 | ||
120 | - 0x0000000a \(STRSZ\) 29 \(bytes\) | ||
121 | + 0x00000005 \(STRTAB\) 0x120 | ||
122 | + 0x00000006 \(SYMTAB\) 0xc0 | ||
123 | + 0x0000000a \(STRSZ\) 25 \(bytes\) | ||
124 | 0x0000000b \(SYMENT\) 16 \(bytes\) | ||
125 | - 0x00000007 \(RELA\) 0x154 | ||
126 | - 0x00000008 \(RELASZ\) 12 \(bytes\) | ||
127 | - 0x00000009 \(RELAENT\) 12 \(bytes\) | ||
128 | - 0x00000016 \(TEXTREL\) 0x0 | ||
129 | 0x00000000 \(NULL\) 0x0 | ||
130 | diff --git a/ld/testsuite/ld-x86-64/ilp32-4.s b/ld/testsuite/ld-x86-64/ilp32-4.s | ||
131 | new file mode 100644 | ||
132 | index 0000000..5f270c7 | ||
133 | --- /dev/null | ||
134 | +++ b/ld/testsuite/ld-x86-64/ilp32-4.s | ||
135 | @@ -0,0 +1,3 @@ | ||
136 | + .globl _start | ||
137 | +_start: | ||
138 | + ret | ||
139 | diff --git a/ld/testsuite/ld-x86-64/ilp32-5.d b/ld/testsuite/ld-x86-64/ilp32-5.d | ||
140 | index e4673e5..4870c2b 100644 | ||
141 | --- a/ld/testsuite/ld-x86-64/ilp32-5.d | ||
142 | +++ b/ld/testsuite/ld-x86-64/ilp32-5.d | ||
143 | @@ -4,5 +4,5 @@ | ||
144 | |||
145 | #... | ||
146 | [0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9a-f]+ | ||
147 | -[0-9a-f]+ +[0-9a-f]+ +R_X86_64_PC32 +[0-9a-f]+ +foo - 4 | ||
148 | +[0-9a-f]+ +[0-9a-f]+ +R_X86_64_GLOB_DAT +[0-9a-f]+ +foo \+ 0 | ||
149 | [0-9a-f]+ +[0-9a-f]+ +R_X86_64_32 +[0-9a-f]+ +foo \+ 0 | ||
150 | diff --git a/ld/testsuite/ld-x86-64/ilp32-5.s b/ld/testsuite/ld-x86-64/ilp32-5.s | ||
151 | index 0d97807..ef0c60e 100644 | ||
152 | --- a/ld/testsuite/ld-x86-64/ilp32-5.s | ||
153 | +++ b/ld/testsuite/ld-x86-64/ilp32-5.s | ||
154 | @@ -1,6 +1,6 @@ | ||
155 | .globl bar | ||
156 | bar: | ||
157 | - mov foo(%rip), %rax | ||
158 | + mov foo@GOTPCREL(%rip), %rax | ||
159 | |||
160 | .data | ||
161 | xxx: | ||
162 | diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp | ||
163 | index 77b081b..44d3e07 100644 | ||
164 | --- a/ld/testsuite/ld-x86-64/x86-64.exp | ||
165 | +++ b/ld/testsuite/ld-x86-64/x86-64.exp | ||
166 | @@ -207,6 +207,7 @@ run_dump_test "ilp32-6" | ||
167 | run_dump_test "ilp32-7" | ||
168 | run_dump_test "ilp32-8" | ||
169 | run_dump_test "ilp32-9" | ||
170 | +run_dump_test "ilp32-10" | ||
171 | run_dump_test "ia32-1" | ||
172 | run_dump_test "ia32-2" | ||
173 | run_dump_test "ia32-3" | ||
174 | -- | ||
175 | 1.7.9.5 | ||
176 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0078-PR-binutils-13622.patch b/meta/recipes-devtools/binutils/binutils/0078-PR-binutils-13622.patch new file mode 100644 index 0000000000..a28fc9d8e9 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0078-PR-binutils-13622.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From dcf0cb6bb406708020efe2db44f53af0fe822773 Mon Sep 17 00:00:00 2001 | ||
4 | From: Nick Clifton <nickc@redhat.com> | ||
5 | Date: Mon, 30 Jan 2012 11:35:37 +0000 | ||
6 | Subject: [PATCH 078/262] PR binutils/13622 * readelf.c | ||
7 | (process_section_groups): If there are no section | ||
8 | headers do not scan for section groups. | ||
9 | (process_note_sections): Likewise for note | ||
10 | sections. | ||
11 | |||
12 | --- | ||
13 | binutils/ChangeLog | 7 +++++++ | ||
14 | binutils/readelf.c | 5 +++-- | ||
15 | 2 files changed, 10 insertions(+), 2 deletions(-) | ||
16 | |||
17 | 2012-01-26 Nick Clifton <nickc@redhat.com> | ||
18 | |||
19 | PR binutils/13622 | ||
20 | * readelf.c (process_section_groups): If there are no section | ||
21 | headers do not scan for section groups. | ||
22 | (process_note_sections): Likewise for note sections. | ||
23 | diff --git a/binutils/readelf.c b/binutils/readelf.c | ||
24 | index 9e13190..bf053d9 100644 | ||
25 | --- a/binutils/readelf.c | ||
26 | +++ b/binutils/readelf.c | ||
27 | @@ -4937,7 +4937,8 @@ process_section_groups (FILE * file) | ||
28 | if (section_headers == NULL) | ||
29 | { | ||
30 | error (_("Section headers are not available!\n")); | ||
31 | - abort (); | ||
32 | + /* PR 13622: This can happen with a corrupt ELF header. */ | ||
33 | + return 0; | ||
34 | } | ||
35 | |||
36 | section_headers_groups = (struct group **) calloc (elf_header.e_shnum, | ||
37 | @@ -12942,7 +12943,7 @@ process_note_sections (FILE * file) | ||
38 | int res = 1; | ||
39 | |||
40 | for (i = 0, section = section_headers; | ||
41 | - i < elf_header.e_shnum; | ||
42 | + i < elf_header.e_shnum && section != NULL; | ||
43 | i++, section++) | ||
44 | if (section->sh_type == SHT_NOTE) | ||
45 | res &= process_corefile_note_segment (file, | ||
46 | -- | ||
47 | 1.7.9.5 | ||
48 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0144-timer.cc-include-unistd.h.patch b/meta/recipes-devtools/binutils/binutils/0144-timer.cc-include-unistd.h.patch new file mode 100644 index 0000000000..271c513daf --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0144-timer.cc-include-unistd.h.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From b7578c6b7bd966b63ab1b2682fd90ed4f3a92e71 Mon Sep 17 00:00:00 2001 | ||
4 | From: Ian Lance Taylor <ian@airs.com> | ||
5 | Date: Fri, 6 Apr 2012 17:23:58 +0000 | ||
6 | Subject: [PATCH 144/262] * timer.cc: #include <unistd.h>. | ||
7 | |||
8 | --- | ||
9 | gold/ChangeLog | 4 ++++ | ||
10 | gold/timer.cc | 2 ++ | ||
11 | 2 files changed, 6 insertions(+) | ||
12 | |||
13 | 2012-04-06 Ian Lance Taylor <iant@google.com> | ||
14 | |||
15 | * timer.cc: #include <unistd.h>. | ||
16 | |||
17 | diff --git a/gold/timer.cc b/gold/timer.cc | ||
18 | index d9b8874..44e19f5 100644 | ||
19 | --- a/gold/timer.cc | ||
20 | +++ b/gold/timer.cc | ||
21 | @@ -22,6 +22,8 @@ | ||
22 | |||
23 | #include "gold.h" | ||
24 | |||
25 | +#include <unistd.h> | ||
26 | + | ||
27 | #ifdef HAVE_TIMES | ||
28 | #include <sys/times.h> | ||
29 | #endif | ||
30 | -- | ||
31 | 1.7.9.5 | ||
32 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0166-2012-04-27-Doug-Kwan-dougkwan-google.com.patch b/meta/recipes-devtools/binutils/binutils/0166-2012-04-27-Doug-Kwan-dougkwan-google.com.patch new file mode 100644 index 0000000000..bd1ff5bd95 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0166-2012-04-27-Doug-Kwan-dougkwan-google.com.patch | |||
@@ -0,0 +1,169 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From b6db4b7975d21ec53da5975ddac021098da13bf3 Mon Sep 17 00:00:00 2001 | ||
4 | From: Doug Kwan <dougkwan@google.com> | ||
5 | Date: Thu, 26 Apr 2012 18:08:19 +0000 | ||
6 | Subject: [PATCH 166/262] 2012-04-27 Doug Kwan <dougkwan@google.com> | ||
7 | |||
8 | Backport from mainline: | ||
9 | |||
10 | 2012-03-16 Doug Kwan <dougkwan@google.com> | ||
11 | |||
12 | * testsuite/Makefile.am: Disable test initpri3b. | ||
13 | * testsuite/Makefile.in: Regenerate. | ||
14 | |||
15 | 2012-03-14 Doug Kwan <dougkwan@google.com> | ||
16 | |||
17 | * gold/arm.cc (Target_arm::Scan::global): Generate | ||
18 | R_ARM_GLOB_DAT dynamic relocations for protected symbols in | ||
19 | shared objects. | ||
20 | --- | ||
21 | gold/ChangeLog | 15 +++++++++++++++ | ||
22 | gold/arm.cc | 4 +++- | ||
23 | gold/testsuite/Makefile.am | 15 ++++++++++----- | ||
24 | gold/testsuite/Makefile.in | 32 +++++++++++++------------------- | ||
25 | 4 files changed, 41 insertions(+), 25 deletions(-) | ||
26 | |||
27 | diff --git a/gold/arm.cc b/gold/arm.cc | ||
28 | index 72c3670..a1e8e4c 100644 | ||
29 | --- a/gold/arm.cc | ||
30 | +++ b/gold/arm.cc | ||
31 | @@ -8374,7 +8374,9 @@ Target_arm<big_endian>::Scan::global(Symbol_table* symtab, | ||
32 | Reloc_section* rel_dyn = target->rel_dyn_section(layout); | ||
33 | if (gsym->is_from_dynobj() | ||
34 | || gsym->is_undefined() | ||
35 | - || gsym->is_preemptible()) | ||
36 | + || gsym->is_preemptible() | ||
37 | + || (gsym->visibility() == elfcpp::STV_PROTECTED | ||
38 | + && parameters->options().shared())) | ||
39 | got->add_global_with_rel(gsym, GOT_TYPE_STANDARD, | ||
40 | rel_dyn, elfcpp::R_ARM_GLOB_DAT); | ||
41 | else | ||
42 | diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am | ||
43 | index 9b8605b..97d6457 100644 | ||
44 | --- a/gold/testsuite/Makefile.am | ||
45 | +++ b/gold/testsuite/Makefile.am | ||
46 | @@ -870,11 +870,16 @@ initpri3a_DEPENDENCIES = gcctestdir/ld | ||
47 | initpri3a_LDFLAGS = -Bgcctestdir/ | ||
48 | initpri3a_LDADD = | ||
49 | |||
50 | -check_PROGRAMS += initpri3b | ||
51 | -initpri3b_SOURCES = initpri3.c | ||
52 | -initpri3b_DEPENDENCIES = gcctestdir/ld | ||
53 | -initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array | ||
54 | -initpri3b_LDADD = | ||
55 | +# This test fails on targets not using .ctors and .dtors sections (e.g. ARM | ||
56 | +# EABI). Given that gcc is moving towards using .init_array in all cases, | ||
57 | +# this test is commented out. A better fix would be checking whether gcc | ||
58 | +# uses .ctors or .init_array sections in configure. | ||
59 | + | ||
60 | +# check_PROGRAMS += initpri3b | ||
61 | +# initpri3b_SOURCES = initpri3.c | ||
62 | +# initpri3b_DEPENDENCIES = gcctestdir/ld | ||
63 | +# initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array | ||
64 | +# initpri3b_LDADD = | ||
65 | |||
66 | # Test --detect-odr-violations | ||
67 | check_SCRIPTS += debug_msg.sh | ||
68 | diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in | ||
69 | index 785dcdd..518d32b 100644 | ||
70 | --- a/gold/testsuite/Makefile.in | ||
71 | +++ b/gold/testsuite/Makefile.in | ||
72 | @@ -56,6 +56,17 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ | ||
73 | @NATIVE_OR_CROSS_LINKER_TRUE@am__append_1 = object_unittest \ | ||
74 | @NATIVE_OR_CROSS_LINKER_TRUE@ binary_unittest | ||
75 | |||
76 | +# This test fails on targets not using .ctors and .dtors sections (e.g. ARM | ||
77 | +# EABI). Given that gcc is moving towards using .init_array in all cases, | ||
78 | +# this test is commented out. A better fix would be checking whether gcc | ||
79 | +# uses .ctors or .init_array sections in configure. | ||
80 | + | ||
81 | +# check_PROGRAMS += initpri3b | ||
82 | +# initpri3b_SOURCES = initpri3.c | ||
83 | +# initpri3b_DEPENDENCIES = gcctestdir/ld | ||
84 | +# initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array | ||
85 | +# initpri3b_LDADD = | ||
86 | + | ||
87 | # Test --detect-odr-violations | ||
88 | |||
89 | # Similar to --detect-odr-violations: check for undefined symbols in .so's | ||
90 | @@ -189,7 +200,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ | ||
91 | # Test -o when emitting to a special file (such as something in /dev). | ||
92 | @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_24 = many_sections_test \ | ||
93 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_r_test initpri1 \ | ||
94 | -@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2 initpri3a initpri3b \ | ||
95 | +@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2 initpri3a \ | ||
96 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile | ||
97 | @GCC_FALSE@many_sections_test_DEPENDENCIES = | ||
98 | @NATIVE_LINKER_FALSE@many_sections_test_DEPENDENCIES = | ||
99 | @@ -204,8 +215,6 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ | ||
100 | @NATIVE_LINKER_FALSE@initpri2_DEPENDENCIES = | ||
101 | @GCC_FALSE@initpri3a_DEPENDENCIES = | ||
102 | @NATIVE_LINKER_FALSE@initpri3a_DEPENDENCIES = | ||
103 | -@GCC_FALSE@initpri3b_DEPENDENCIES = | ||
104 | -@NATIVE_LINKER_FALSE@initpri3b_DEPENDENCIES = | ||
105 | |||
106 | # Check that --detect-odr-violations works with compressed debug sections. | ||
107 | @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@am__append_27 = debug_msg_cdebug.err | ||
108 | @@ -712,7 +721,6 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) | ||
109 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri1$(EXEEXT) \ | ||
110 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2$(EXEEXT) \ | ||
111 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri3a$(EXEEXT) \ | ||
112 | -@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri3b$(EXEEXT) \ | ||
113 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile$(EXEEXT) | ||
114 | @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_21 = flagstest_compress_debug_sections$(EXEEXT) \ | ||
115 | @GCC_TRUE@@HAVE_ZLIB_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile_and_compress_debug_sections$(EXEEXT) | ||
116 | @@ -1200,11 +1208,6 @@ initpri2_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(initpri2_LDFLAGS) \ | ||
117 | initpri3a_OBJECTS = $(am_initpri3a_OBJECTS) | ||
118 | initpri3a_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(initpri3a_LDFLAGS) \ | ||
119 | $(LDFLAGS) -o $@ | ||
120 | -@GCC_TRUE@@NATIVE_LINKER_TRUE@am_initpri3b_OBJECTS = \ | ||
121 | -@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri3.$(OBJEXT) | ||
122 | -initpri3b_OBJECTS = $(am_initpri3b_OBJECTS) | ||
123 | -initpri3b_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(initpri3b_LDFLAGS) \ | ||
124 | - $(LDFLAGS) -o $@ | ||
125 | @GCC_TRUE@@NATIVE_LINKER_TRUE@am_justsyms_OBJECTS = \ | ||
126 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms_1.$(OBJEXT) | ||
127 | justsyms_OBJECTS = $(am_justsyms_OBJECTS) | ||
128 | @@ -1698,7 +1701,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \ | ||
129 | incremental_copy_test.c incremental_test_2.c \ | ||
130 | incremental_test_3.c incremental_test_4.c incremental_test_5.c \ | ||
131 | incremental_test_6.c $(initpri1_SOURCES) $(initpri2_SOURCES) \ | ||
132 | - $(initpri3a_SOURCES) $(initpri3b_SOURCES) $(justsyms_SOURCES) \ | ||
133 | + $(initpri3a_SOURCES) $(justsyms_SOURCES) \ | ||
134 | $(justsyms_exec_SOURCES) $(large_SOURCES) local_labels_test.c \ | ||
135 | many_sections_r_test.c $(many_sections_test_SOURCES) \ | ||
136 | $(object_unittest_SOURCES) permission_test.c plugin_test_1.c \ | ||
137 | @@ -2281,10 +2284,6 @@ LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ | ||
138 | @GCC_TRUE@@NATIVE_LINKER_TRUE@initpri3a_DEPENDENCIES = gcctestdir/ld | ||
139 | @GCC_TRUE@@NATIVE_LINKER_TRUE@initpri3a_LDFLAGS = -Bgcctestdir/ | ||
140 | @GCC_TRUE@@NATIVE_LINKER_TRUE@initpri3a_LDADD = | ||
141 | -@GCC_TRUE@@NATIVE_LINKER_TRUE@initpri3b_SOURCES = initpri3.c | ||
142 | -@GCC_TRUE@@NATIVE_LINKER_TRUE@initpri3b_DEPENDENCIES = gcctestdir/ld | ||
143 | -@GCC_TRUE@@NATIVE_LINKER_TRUE@initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array | ||
144 | -@GCC_TRUE@@NATIVE_LINKER_TRUE@initpri3b_LDADD = | ||
145 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_SOURCES = ver_test_main.cc | ||
146 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so | ||
147 | @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | ||
148 | @@ -2928,9 +2927,6 @@ initpri2$(EXEEXT): $(initpri2_OBJECTS) $(initpri2_DEPENDENCIES) | ||
149 | initpri3a$(EXEEXT): $(initpri3a_OBJECTS) $(initpri3a_DEPENDENCIES) | ||
150 | @rm -f initpri3a$(EXEEXT) | ||
151 | $(initpri3a_LINK) $(initpri3a_OBJECTS) $(initpri3a_LDADD) $(LIBS) | ||
152 | -initpri3b$(EXEEXT): $(initpri3b_OBJECTS) $(initpri3b_DEPENDENCIES) | ||
153 | - @rm -f initpri3b$(EXEEXT) | ||
154 | - $(initpri3b_LINK) $(initpri3b_OBJECTS) $(initpri3b_LDADD) $(LIBS) | ||
155 | justsyms$(EXEEXT): $(justsyms_OBJECTS) $(justsyms_DEPENDENCIES) | ||
156 | @rm -f justsyms$(EXEEXT) | ||
157 | $(justsyms_LINK) $(justsyms_OBJECTS) $(justsyms_LDADD) $(LIBS) | ||
158 | @@ -3869,8 +3865,6 @@ initpri2.log: initpri2$(EXEEXT) | ||
159 | @p='initpri2$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) | ||
160 | initpri3a.log: initpri3a$(EXEEXT) | ||
161 | @p='initpri3a$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) | ||
162 | -initpri3b.log: initpri3b$(EXEEXT) | ||
163 | - @p='initpri3b$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) | ||
164 | flagstest_o_specialfile.log: flagstest_o_specialfile$(EXEEXT) | ||
165 | @p='flagstest_o_specialfile$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) | ||
166 | flagstest_compress_debug_sections.log: flagstest_compress_debug_sections$(EXEEXT) | ||
167 | -- | ||
168 | 1.7.9.5 | ||
169 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0182-PR-ld-13991.patch b/meta/recipes-devtools/binutils/binutils/0182-PR-ld-13991.patch new file mode 100644 index 0000000000..f4c94388c8 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0182-PR-ld-13991.patch | |||
@@ -0,0 +1,1617 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | From e827844b6119ff7e0c2de167f2b261c6c06226c8 Mon Sep 17 00:00:00 2001 | ||
4 | From: Nick Clifton <nickc@redhat.com> | ||
5 | Date: Fri, 11 May 2012 12:24:12 +0000 | ||
6 | Subject: [PATCH 182/262] PR ld/13991 bfd/ * bfd/elf-bfd.h | ||
7 | (_bfd_elf_link_just_syms): Define as | ||
8 | _bfd_generic_link_just_syms. * bfd/elflink.c | ||
9 | (_bfd_elf_link_just_syms): Delete. * | ||
10 | bfd/linker.c (_bfd_generic_link_just_syms): Set | ||
11 | sec_info_type. | ||
12 | |||
13 | * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. | ||
14 | * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, | ||
15 | SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, | ||
16 | SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. | ||
17 | * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, | ||
18 | * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, | ||
19 | * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, | ||
20 | * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, | ||
21 | * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, | ||
22 | * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, | ||
23 | * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, | ||
24 | * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, | ||
25 | * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, | ||
26 | * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, | ||
27 | * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, | ||
28 | * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, | ||
29 | * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, | ||
30 | * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, | ||
31 | * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, | ||
32 | * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, | ||
33 | * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, | ||
34 | * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, | ||
35 | * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, | ||
36 | * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, | ||
37 | * bfd/reloc.c: Update all references. | ||
38 | * bfd/bfd-in2.h: Regenerate. | ||
39 | ld/ | ||
40 | * ld/ldlang.c (size_input_section): Use sec_info_type rather than | ||
41 | usrdata->flags.just_syms. | ||
42 | * ld/ldwrite.c (build_link_order): Likewise. | ||
43 | * ld/emultempl/hppaelf.em (build_section_lists): Likewise. | ||
44 | * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. | ||
45 | * ld/emultempl/armelf.em (build_section_lists): Likewise. | ||
46 | (after_allocation): Update for renamed sec_info_type value. | ||
47 | * ld/emultempl/tic6xdsbt.em: Likewise. | ||
48 | --- | ||
49 | bfd/ChangeLog | 38 +++++++++++++++++++++++++++++++++ | ||
50 | bfd/bfd-in.h | 6 +++--- | ||
51 | bfd/bfd-in2.h | 16 +++++++------- | ||
52 | bfd/elf-bfd.h | 3 +-- | ||
53 | bfd/elf-eh-frame.c | 10 ++++----- | ||
54 | bfd/elf-m10200.c | 2 +- | ||
55 | bfd/elf-m10300.c | 4 ++-- | ||
56 | bfd/elf.c | 10 ++++----- | ||
57 | bfd/elf32-arm.c | 6 +++--- | ||
58 | bfd/elf32-avr.c | 2 +- | ||
59 | bfd/elf32-bfin.c | 6 +++--- | ||
60 | bfd/elf32-cr16.c | 2 +- | ||
61 | bfd/elf32-cr16c.c | 2 +- | ||
62 | bfd/elf32-cris.c | 2 +- | ||
63 | bfd/elf32-crx.c | 2 +- | ||
64 | bfd/elf32-d10v.c | 2 +- | ||
65 | bfd/elf32-fr30.c | 2 +- | ||
66 | bfd/elf32-frv.c | 4 ++-- | ||
67 | bfd/elf32-h8300.c | 2 +- | ||
68 | bfd/elf32-hppa.c | 2 +- | ||
69 | bfd/elf32-i370.c | 2 +- | ||
70 | bfd/elf32-i386.c | 4 ++-- | ||
71 | bfd/elf32-i860.c | 2 +- | ||
72 | bfd/elf32-ip2k.c | 2 +- | ||
73 | bfd/elf32-iq2000.c | 2 +- | ||
74 | bfd/elf32-lm32.c | 6 +++--- | ||
75 | bfd/elf32-m32c.c | 2 +- | ||
76 | bfd/elf32-m32r.c | 2 +- | ||
77 | bfd/elf32-m68hc1x.c | 2 +- | ||
78 | bfd/elf32-m68k.c | 2 +- | ||
79 | bfd/elf32-mcore.c | 2 +- | ||
80 | bfd/elf32-mep.c | 2 +- | ||
81 | bfd/elf32-moxie.c | 2 +- | ||
82 | bfd/elf32-msp430.c | 2 +- | ||
83 | bfd/elf32-mt.c | 2 +- | ||
84 | bfd/elf32-openrisc.c | 2 +- | ||
85 | bfd/elf32-ppc.c | 6 +++--- | ||
86 | bfd/elf32-rx.c | 4 ++-- | ||
87 | bfd/elf32-s390.c | 2 +- | ||
88 | bfd/elf32-score.c | 2 +- | ||
89 | bfd/elf32-score7.c | 2 +- | ||
90 | bfd/elf32-sh.c | 4 ++-- | ||
91 | bfd/elf32-spu.c | 2 +- | ||
92 | bfd/elf32-tic6x.c | 2 +- | ||
93 | bfd/elf32-tilepro.c | 2 +- | ||
94 | bfd/elf32-v850.c | 2 +- | ||
95 | bfd/elf32-vax.c | 2 +- | ||
96 | bfd/elf32-xc16x.c | 2 +- | ||
97 | bfd/elf32-xstormy16.c | 2 +- | ||
98 | bfd/elf32-xtensa.c | 8 +++---- | ||
99 | bfd/elf64-alpha.c | 8 +++---- | ||
100 | bfd/elf64-hppa.c | 2 +- | ||
101 | bfd/elf64-mmix.c | 2 +- | ||
102 | bfd/elf64-ppc.c | 20 +++++++++--------- | ||
103 | bfd/elf64-s390.c | 2 +- | ||
104 | bfd/elf64-sh64.c | 4 ++-- | ||
105 | bfd/elf64-x86-64.c | 4 ++-- | ||
106 | bfd/elflink.c | 51 ++++++++++++++++++--------------------------- | ||
107 | bfd/elfnn-ia64.c | 6 +++--- | ||
108 | bfd/elfxx-mips.c | 2 +- | ||
109 | bfd/elfxx-sparc.c | 2 +- | ||
110 | bfd/elfxx-tilegx.c | 2 +- | ||
111 | bfd/linker.c | 3 ++- | ||
112 | bfd/reloc.c | 2 +- | ||
113 | bfd/section.c | 10 ++++----- | ||
114 | ld/ChangeLog | 15 +++++++++++++ | ||
115 | ld/emultempl/armelf.em | 4 ++-- | ||
116 | ld/emultempl/hppaelf.em | 2 +- | ||
117 | ld/emultempl/ppc64elf.em | 4 ++-- | ||
118 | ld/emultempl/tic6xdsbt.em | 2 +- | ||
119 | ld/ldlang.c | 2 +- | ||
120 | ld/ldwrite.c | 4 ++-- | ||
121 | 72 files changed, 199 insertions(+), 157 deletions(-) | ||
122 | |||
123 | diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h | ||
124 | index a477b49..7c5298a 100644 | ||
125 | --- a/bfd/bfd-in.h | ||
126 | +++ b/bfd/bfd-in.h | ||
127 | @@ -295,11 +295,11 @@ typedef struct bfd_section *sec_ptr; | ||
128 | ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd)) | ||
129 | |||
130 | /* Return TRUE if input section SEC has been discarded. */ | ||
131 | -#define elf_discarded_section(sec) \ | ||
132 | +#define discarded_section(sec) \ | ||
133 | (!bfd_is_abs_section (sec) \ | ||
134 | && bfd_is_abs_section ((sec)->output_section) \ | ||
135 | - && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \ | ||
136 | - && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) | ||
137 | + && (sec)->sec_info_type != SEC_INFO_TYPE_MERGE \ | ||
138 | + && (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS) | ||
139 | |||
140 | /* Forward define. */ | ||
141 | struct stat; | ||
142 | diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h | ||
143 | index cd90740..34f9628 100644 | ||
144 | --- a/bfd/bfd-in2.h | ||
145 | +++ b/bfd/bfd-in2.h | ||
146 | @@ -302,11 +302,11 @@ typedef struct bfd_section *sec_ptr; | ||
147 | ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd)) | ||
148 | |||
149 | /* Return TRUE if input section SEC has been discarded. */ | ||
150 | -#define elf_discarded_section(sec) \ | ||
151 | +#define discarded_section(sec) \ | ||
152 | (!bfd_is_abs_section (sec) \ | ||
153 | && bfd_is_abs_section ((sec)->output_section) \ | ||
154 | - && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \ | ||
155 | - && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) | ||
156 | + && (sec)->sec_info_type != SEC_INFO_TYPE_MERGE \ | ||
157 | + && (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS) | ||
158 | |||
159 | /* Forward define. */ | ||
160 | struct stat; | ||
161 | @@ -1384,11 +1384,11 @@ typedef struct bfd_section | ||
162 | |||
163 | /* Type of sec_info information. */ | ||
164 | unsigned int sec_info_type:3; | ||
165 | -#define ELF_INFO_TYPE_NONE 0 | ||
166 | -#define ELF_INFO_TYPE_STABS 1 | ||
167 | -#define ELF_INFO_TYPE_MERGE 2 | ||
168 | -#define ELF_INFO_TYPE_EH_FRAME 3 | ||
169 | -#define ELF_INFO_TYPE_JUST_SYMS 4 | ||
170 | +#define SEC_INFO_TYPE_NONE 0 | ||
171 | +#define SEC_INFO_TYPE_STABS 1 | ||
172 | +#define SEC_INFO_TYPE_MERGE 2 | ||
173 | +#define SEC_INFO_TYPE_EH_FRAME 3 | ||
174 | +#define SEC_INFO_TYPE_JUST_SYMS 4 | ||
175 | |||
176 | /* Nonzero if this section uses RELA relocations, rather than REL. */ | ||
177 | unsigned int use_rela_p:1; | ||
178 | diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h | ||
179 | index d6e2ab2..2cfe2ba 100644 | ||
180 | --- a/bfd/elf-bfd.h | ||
181 | +++ b/bfd/elf-bfd.h | ||
182 | @@ -1807,8 +1807,7 @@ extern void bfd_elf_set_group_contents | ||
183 | (bfd *, asection *, void *); | ||
184 | extern asection *_bfd_elf_check_kept_section | ||
185 | (asection *, struct bfd_link_info *); | ||
186 | -extern void _bfd_elf_link_just_syms | ||
187 | - (asection *, struct bfd_link_info *); | ||
188 | +#define _bfd_elf_link_just_syms _bfd_generic_link_just_syms | ||
189 | extern void _bfd_elf_copy_link_hash_symbol_type | ||
190 | (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *); | ||
191 | extern bfd_boolean _bfd_elf_size_group_sections | ||
192 | diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c | ||
193 | index 54142b2..7b5cf7a 100644 | ||
194 | --- a/bfd/elf-eh-frame.c | ||
195 | +++ b/bfd/elf-eh-frame.c | ||
196 | @@ -491,7 +491,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, | ||
197 | return; | ||
198 | |||
199 | if (sec->size == 0 | ||
200 | - || sec->sec_info_type != ELF_INFO_TYPE_NONE) | ||
201 | + || sec->sec_info_type != SEC_INFO_TYPE_NONE) | ||
202 | { | ||
203 | /* This file does not contain .eh_frame information. */ | ||
204 | return; | ||
205 | @@ -904,7 +904,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, | ||
206 | BFD_ASSERT (cie_count == num_cies); | ||
207 | |||
208 | elf_section_data (sec)->sec_info = sec_info; | ||
209 | - sec->sec_info_type = ELF_INFO_TYPE_EH_FRAME; | ||
210 | + sec->sec_info_type = SEC_INFO_TYPE_EH_FRAME; | ||
211 | if (hdr_info->merge_cies) | ||
212 | { | ||
213 | sec_info->cies = local_cies; | ||
214 | @@ -1137,7 +1137,7 @@ _bfd_elf_discard_section_eh_frame | ||
215 | struct eh_frame_hdr_info *hdr_info; | ||
216 | unsigned int ptr_size, offset; | ||
217 | |||
218 | - if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME) | ||
219 | + if (sec->sec_info_type != SEC_INFO_TYPE_EH_FRAME) | ||
220 | return FALSE; | ||
221 | |||
222 | sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info; | ||
223 | @@ -1307,7 +1307,7 @@ _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
224 | struct eh_frame_sec_info *sec_info; | ||
225 | unsigned int lo, hi, mid; | ||
226 | |||
227 | - if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME) | ||
228 | + if (sec->sec_info_type != SEC_INFO_TYPE_EH_FRAME) | ||
229 | return offset; | ||
230 | sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info; | ||
231 | |||
232 | @@ -1395,7 +1395,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, | ||
233 | unsigned int ptr_size; | ||
234 | struct eh_cie_fde *ent; | ||
235 | |||
236 | - if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME) | ||
237 | + if (sec->sec_info_type != SEC_INFO_TYPE_EH_FRAME) | ||
238 | /* FIXME: octets_per_byte. */ | ||
239 | return bfd_set_section_contents (abfd, sec->output_section, contents, | ||
240 | sec->output_offset, sec->size); | ||
241 | diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c | ||
242 | index a38f4db..d58c75c 100644 | ||
243 | --- a/bfd/elf-m10200.c | ||
244 | +++ b/bfd/elf-m10200.c | ||
245 | @@ -401,7 +401,7 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, | ||
246 | unresolved_reloc, warned); | ||
247 | } | ||
248 | |||
249 | - if (sec != NULL && elf_discarded_section (sec)) | ||
250 | + if (sec != NULL && discarded_section (sec)) | ||
251 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
252 | rel, relend, howto, contents); | ||
253 | |||
254 | diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c | ||
255 | index 8276a2f..876ff4a 100644 | ||
256 | --- a/bfd/elf-m10300.c | ||
257 | +++ b/bfd/elf-m10300.c | ||
258 | @@ -1509,7 +1509,7 @@ mn10300_elf_relocate_section (bfd *output_bfd, | ||
259 | h->root.root.root.string); | ||
260 | } | ||
261 | |||
262 | - if (sec != NULL && elf_discarded_section (sec)) | ||
263 | + if (sec != NULL && discarded_section (sec)) | ||
264 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
265 | rel, relend, howto, contents); | ||
266 | |||
267 | @@ -2763,7 +2763,7 @@ mn10300_elf_relax_section (bfd *abfd, | ||
268 | isym->st_name); | ||
269 | |||
270 | if ((sym_sec->flags & SEC_MERGE) | ||
271 | - && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE) | ||
272 | + && sym_sec->sec_info_type == SEC_INFO_TYPE_MERGE) | ||
273 | { | ||
274 | symval = isym->st_value; | ||
275 | |||
276 | diff --git a/bfd/elf.c b/bfd/elf.c | ||
277 | index aa40c33..9e23bee 100644 | ||
278 | --- a/bfd/elf.c | ||
279 | +++ b/bfd/elf.c | ||
280 | @@ -3071,7 +3071,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) | ||
281 | if (link_info != NULL) | ||
282 | { | ||
283 | /* Check discarded linkonce section. */ | ||
284 | - if (elf_discarded_section (s)) | ||
285 | + if (discarded_section (s)) | ||
286 | { | ||
287 | asection *kept; | ||
288 | (*_bfd_error_handler) | ||
289 | @@ -9390,7 +9390,7 @@ _bfd_elf_rela_local_sym (bfd *abfd, | ||
290 | + sym->st_value); | ||
291 | if ((sec->flags & SEC_MERGE) | ||
292 | && ELF_ST_TYPE (sym->st_info) == STT_SECTION | ||
293 | - && sec->sec_info_type == ELF_INFO_TYPE_MERGE) | ||
294 | + && sec->sec_info_type == SEC_INFO_TYPE_MERGE) | ||
295 | { | ||
296 | rel->r_addend = | ||
297 | _bfd_merged_section_offset (abfd, psec, | ||
298 | @@ -9421,7 +9421,7 @@ _bfd_elf_rel_local_sym (bfd *abfd, | ||
299 | { | ||
300 | asection *sec = *psec; | ||
301 | |||
302 | - if (sec->sec_info_type != ELF_INFO_TYPE_MERGE) | ||
303 | + if (sec->sec_info_type != SEC_INFO_TYPE_MERGE) | ||
304 | return sym->st_value + addend; | ||
305 | |||
306 | return _bfd_merged_section_offset (abfd, psec, | ||
307 | @@ -9437,10 +9437,10 @@ _bfd_elf_section_offset (bfd *abfd, | ||
308 | { | ||
309 | switch (sec->sec_info_type) | ||
310 | { | ||
311 | - case ELF_INFO_TYPE_STABS: | ||
312 | + case SEC_INFO_TYPE_STABS: | ||
313 | return _bfd_stab_section_offset (sec, elf_section_data (sec)->sec_info, | ||
314 | offset); | ||
315 | - case ELF_INFO_TYPE_EH_FRAME: | ||
316 | + case SEC_INFO_TYPE_EH_FRAME: | ||
317 | return _bfd_elf_eh_frame_section_offset (abfd, info, sec, offset); | ||
318 | default: | ||
319 | if ((sec->flags & SEC_ELF_REVERSE_COPY) != 0) | ||
320 | diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c | ||
321 | index 1f6c1a0..9355f66 100644 | ||
322 | --- a/bfd/elf32-arm.c | ||
323 | +++ b/bfd/elf32-arm.c | ||
324 | @@ -4485,7 +4485,7 @@ cortex_a8_erratum_scan (bfd *input_bfd, | ||
325 | if (elf_section_type (section) != SHT_PROGBITS | ||
326 | || (elf_section_flags (section) & SHF_EXECINSTR) == 0 | ||
327 | || (section->flags & SEC_EXCLUDE) != 0 | ||
328 | - || (section->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) | ||
329 | + || (section->sec_info_type == SEC_INFO_TYPE_JUST_SYMS) | ||
330 | || (section->output_section == bfd_abs_section_ptr)) | ||
331 | continue; | ||
332 | |||
333 | @@ -6556,7 +6556,7 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info) | ||
334 | if (elf_section_type (sec) != SHT_PROGBITS | ||
335 | || (elf_section_flags (sec) & SHF_EXECINSTR) == 0 | ||
336 | || (sec->flags & SEC_EXCLUDE) != 0 | ||
337 | - || sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS | ||
338 | + || sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS | ||
339 | || sec->output_section == bfd_abs_section_ptr | ||
340 | || strcmp (sec->name, VFP11_ERRATUM_VENEER_SECTION_NAME) == 0) | ||
341 | continue; | ||
342 | @@ -10305,7 +10305,7 @@ elf32_arm_relocate_section (bfd * output_bfd, | ||
343 | sym_type = h->type; | ||
344 | } | ||
345 | |||
346 | - if (sec != NULL && elf_discarded_section (sec)) | ||
347 | + if (sec != NULL && discarded_section (sec)) | ||
348 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
349 | rel, relend, howto, contents); | ||
350 | |||
351 | diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c | ||
352 | index a7f9217..97dc268 100644 | ||
353 | --- a/bfd/elf32-avr.c | ||
354 | +++ b/bfd/elf32-avr.c | ||
355 | @@ -1189,7 +1189,7 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
356 | name = h->root.root.string; | ||
357 | } | ||
358 | |||
359 | - if (sec != NULL && elf_discarded_section (sec)) | ||
360 | + if (sec != NULL && discarded_section (sec)) | ||
361 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
362 | rel, relend, howto, contents); | ||
363 | |||
364 | diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c | ||
365 | index b112dfc..4941f40 100644 | ||
366 | --- a/bfd/elf32-bfin.c | ||
367 | +++ b/bfd/elf32-bfin.c | ||
368 | @@ -1444,7 +1444,7 @@ bfin_relocate_section (bfd * output_bfd, | ||
369 | unresolved_reloc, warned); | ||
370 | } | ||
371 | |||
372 | - if (sec != NULL && elf_discarded_section (sec)) | ||
373 | + if (sec != NULL && discarded_section (sec)) | ||
374 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
375 | rel, relend, howto, contents); | ||
376 | |||
377 | @@ -2663,7 +2663,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, | ||
378 | osec = sec; | ||
379 | } | ||
380 | |||
381 | - if (sec != NULL && elf_discarded_section (sec)) | ||
382 | + if (sec != NULL && discarded_section (sec)) | ||
383 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
384 | rel, relend, howto, contents); | ||
385 | |||
386 | @@ -4429,7 +4429,7 @@ bfinfdpic_elf_discard_info (bfd *ibfd, | ||
387 | |||
388 | /* Account for relaxation of .eh_frame section. */ | ||
389 | for (s = ibfd->sections; s; s = s->next) | ||
390 | - if (s->sec_info_type == ELF_INFO_TYPE_EH_FRAME) | ||
391 | + if (s->sec_info_type == SEC_INFO_TYPE_EH_FRAME) | ||
392 | { | ||
393 | if (!_bfinfdpic_check_discarded_relocs (ibfd, s, info, &changed)) | ||
394 | return FALSE; | ||
395 | diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c | ||
396 | index 0118131..38af05f 100644 | ||
397 | --- a/bfd/elf32-cr16.c | ||
398 | +++ b/bfd/elf32-cr16.c | ||
399 | @@ -1431,7 +1431,7 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
400 | unresolved_reloc, warned); | ||
401 | } | ||
402 | |||
403 | - if (sec != NULL && elf_discarded_section (sec)) | ||
404 | + if (sec != NULL && discarded_section (sec)) | ||
405 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
406 | rel, relend, howto, contents); | ||
407 | |||
408 | diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c | ||
409 | index ca2d7cb..109936b 100644 | ||
410 | --- a/bfd/elf32-cr16c.c | ||
411 | +++ b/bfd/elf32-cr16c.c | ||
412 | @@ -723,7 +723,7 @@ elf32_cr16c_relocate_section (bfd *output_bfd, | ||
413 | unresolved_reloc, warned); | ||
414 | } | ||
415 | |||
416 | - if (sec != NULL && elf_discarded_section (sec)) | ||
417 | + if (sec != NULL && discarded_section (sec)) | ||
418 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
419 | rel, relend, howto, contents); | ||
420 | |||
421 | diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c | ||
422 | index 310f6d1..ec23f03 100644 | ||
423 | --- a/bfd/elf32-cris.c | ||
424 | +++ b/bfd/elf32-cris.c | ||
425 | @@ -1180,7 +1180,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
426 | } | ||
427 | } | ||
428 | |||
429 | - if (sec != NULL && elf_discarded_section (sec)) | ||
430 | + if (sec != NULL && discarded_section (sec)) | ||
431 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
432 | rel, relend, howto, contents); | ||
433 | |||
434 | diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c | ||
435 | index d48932d..fd13447 100644 | ||
436 | --- a/bfd/elf32-crx.c | ||
437 | +++ b/bfd/elf32-crx.c | ||
438 | @@ -873,7 +873,7 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
439 | unresolved_reloc, warned); | ||
440 | } | ||
441 | |||
442 | - if (sec != NULL && elf_discarded_section (sec)) | ||
443 | + if (sec != NULL && discarded_section (sec)) | ||
444 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
445 | rel, relend, howto, contents); | ||
446 | |||
447 | diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c | ||
448 | index 7d65395..e39a9b5 100644 | ||
449 | --- a/bfd/elf32-d10v.c | ||
450 | +++ b/bfd/elf32-d10v.c | ||
451 | @@ -463,7 +463,7 @@ elf32_d10v_relocate_section (bfd *output_bfd, | ||
452 | unresolved_reloc, warned); | ||
453 | } | ||
454 | |||
455 | - if (sec != NULL && elf_discarded_section (sec)) | ||
456 | + if (sec != NULL && discarded_section (sec)) | ||
457 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
458 | rel, relend, howto, contents); | ||
459 | |||
460 | diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c | ||
461 | index 97b0d29..57be6ae 100644 | ||
462 | --- a/bfd/elf32-fr30.c | ||
463 | +++ b/bfd/elf32-fr30.c | ||
464 | @@ -577,7 +577,7 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, | ||
465 | name = h->root.root.string; | ||
466 | } | ||
467 | |||
468 | - if (sec != NULL && elf_discarded_section (sec)) | ||
469 | + if (sec != NULL && discarded_section (sec)) | ||
470 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
471 | rel, relend, howto, contents); | ||
472 | |||
473 | diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c | ||
474 | index 7f3c4dd..513f811 100644 | ||
475 | --- a/bfd/elf32-frv.c | ||
476 | +++ b/bfd/elf32-frv.c | ||
477 | @@ -2812,7 +2812,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, | ||
478 | name = h->root.root.string; | ||
479 | } | ||
480 | |||
481 | - if (sec != NULL && elf_discarded_section (sec)) | ||
482 | + if (sec != NULL && discarded_section (sec)) | ||
483 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
484 | rel, relend, howto, contents); | ||
485 | |||
486 | @@ -5678,7 +5678,7 @@ frvfdpic_elf_discard_info (bfd *ibfd, | ||
487 | |||
488 | /* Account for relaxation of .eh_frame section. */ | ||
489 | for (s = ibfd->sections; s; s = s->next) | ||
490 | - if (s->sec_info_type == ELF_INFO_TYPE_EH_FRAME) | ||
491 | + if (s->sec_info_type == SEC_INFO_TYPE_EH_FRAME) | ||
492 | { | ||
493 | if (!_frvfdpic_check_discarded_relocs (ibfd, s, info, &changed)) | ||
494 | return FALSE; | ||
495 | diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c | ||
496 | index 95d3983..ff1ee70 100644 | ||
497 | --- a/bfd/elf32-h8300.c | ||
498 | +++ b/bfd/elf32-h8300.c | ||
499 | @@ -460,7 +460,7 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
500 | unresolved_reloc, warned); | ||
501 | } | ||
502 | |||
503 | - if (sec != NULL && elf_discarded_section (sec)) | ||
504 | + if (sec != NULL && discarded_section (sec)) | ||
505 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
506 | rel, relend, howto, contents); | ||
507 | |||
508 | diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c | ||
509 | index dcf6df0..044b6fa 100644 | ||
510 | --- a/bfd/elf32-hppa.c | ||
511 | +++ b/bfd/elf32-hppa.c | ||
512 | @@ -3741,7 +3741,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, | ||
513 | hh = hppa_elf_hash_entry (eh); | ||
514 | } | ||
515 | |||
516 | - if (sym_sec != NULL && elf_discarded_section (sym_sec)) | ||
517 | + if (sym_sec != NULL && discarded_section (sym_sec)) | ||
518 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
519 | rela, relend, | ||
520 | elf_hppa_howto_table + r_type, | ||
521 | diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c | ||
522 | index 8082927..516511f 100644 | ||
523 | --- a/bfd/elf32-i370.c | ||
524 | +++ b/bfd/elf32-i370.c | ||
525 | @@ -1138,7 +1138,7 @@ i370_elf_relocate_section (bfd *output_bfd, | ||
526 | } | ||
527 | } | ||
528 | |||
529 | - if (sec != NULL && elf_discarded_section (sec)) | ||
530 | + if (sec != NULL && discarded_section (sec)) | ||
531 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
532 | rel, relend, howto, contents); | ||
533 | |||
534 | diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c | ||
535 | index d518d01..b925ca6 100644 | ||
536 | --- a/bfd/elf32-i386.c | ||
537 | +++ b/bfd/elf32-i386.c | ||
538 | @@ -3178,7 +3178,7 @@ elf_i386_relocate_section (bfd *output_bfd, | ||
539 | unresolved_reloc, warned); | ||
540 | } | ||
541 | |||
542 | - if (sec != NULL && elf_discarded_section (sec)) | ||
543 | + if (sec != NULL && discarded_section (sec)) | ||
544 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
545 | rel, relend, howto, contents); | ||
546 | |||
547 | @@ -4846,7 +4846,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, | ||
548 | + PLT_FDE_START_OFFSET); | ||
549 | } | ||
550 | if (htab->plt_eh_frame->sec_info_type | ||
551 | - == ELF_INFO_TYPE_EH_FRAME) | ||
552 | + == SEC_INFO_TYPE_EH_FRAME) | ||
553 | { | ||
554 | if (! _bfd_elf_write_section_eh_frame (output_bfd, info, | ||
555 | htab->plt_eh_frame, | ||
556 | diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c | ||
557 | index 00c8ca7..88f4265 100644 | ||
558 | --- a/bfd/elf32-i860.c | ||
559 | +++ b/bfd/elf32-i860.c | ||
560 | @@ -1128,7 +1128,7 @@ elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
561 | unresolved_reloc, warned); | ||
562 | } | ||
563 | |||
564 | - if (sec != NULL && elf_discarded_section (sec)) | ||
565 | + if (sec != NULL && discarded_section (sec)) | ||
566 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
567 | rel, relend, howto, contents); | ||
568 | |||
569 | diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c | ||
570 | index 0a251b8..43c7b1c 100644 | ||
571 | --- a/bfd/elf32-ip2k.c | ||
572 | +++ b/bfd/elf32-ip2k.c | ||
573 | @@ -1436,7 +1436,7 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
574 | name = h->root.root.string; | ||
575 | } | ||
576 | |||
577 | - if (sec != NULL && elf_discarded_section (sec)) | ||
578 | + if (sec != NULL && discarded_section (sec)) | ||
579 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
580 | rel, relend, howto, contents); | ||
581 | |||
582 | diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c | ||
583 | index 63ef3dc..3954616 100644 | ||
584 | --- a/bfd/elf32-iq2000.c | ||
585 | +++ b/bfd/elf32-iq2000.c | ||
586 | @@ -633,7 +633,7 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, | ||
587 | name = h->root.root.string; | ||
588 | } | ||
589 | |||
590 | - if (sec != NULL && elf_discarded_section (sec)) | ||
591 | + if (sec != NULL && discarded_section (sec)) | ||
592 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
593 | rel, relend, howto, contents); | ||
594 | |||
595 | diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c | ||
596 | index 07add20..a2b1003 100644 | ||
597 | --- a/bfd/elf32-lm32.c | ||
598 | +++ b/bfd/elf32-lm32.c | ||
599 | @@ -893,7 +893,7 @@ lm32_elf_relocate_section (bfd *output_bfd, | ||
600 | name = h->root.root.string; | ||
601 | } | ||
602 | |||
603 | - if (sec != NULL && elf_discarded_section (sec)) | ||
604 | + if (sec != NULL && discarded_section (sec)) | ||
605 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
606 | rel, relend, howto, contents); | ||
607 | |||
608 | @@ -2372,7 +2372,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd, | ||
609 | /* Don't generate entries for weak symbols. */ | ||
610 | if (!h || (h && h->root.type != bfd_link_hash_undefweak)) | ||
611 | { | ||
612 | - if (!elf_discarded_section (s) && !((bfd_get_section_flags (ibfd, s) & SEC_ALLOC) == 0)) | ||
613 | + if (!discarded_section (s) && !((bfd_get_section_flags (ibfd, s) & SEC_ALLOC) == 0)) | ||
614 | { | ||
615 | switch (ELF32_R_TYPE (internal_relocs->r_info)) | ||
616 | { | ||
617 | @@ -2394,7 +2394,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd, | ||
618 | if (!strcmp (current->name, h->root.root.string)) | ||
619 | break; | ||
620 | } | ||
621 | - if (!current && !elf_discarded_section (s) && (bfd_get_section_flags (ibfd, s) & SEC_ALLOC)) | ||
622 | + if (!current && !discarded_section (s) && (bfd_get_section_flags (ibfd, s) & SEC_ALLOC)) | ||
623 | { | ||
624 | /* Will this have an entry in the GOT. */ | ||
625 | if (ELF32_R_TYPE (internal_relocs->r_info) == R_LM32_16_GOT) | ||
626 | diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c | ||
627 | index cf7ad99..bcdb55d 100644 | ||
628 | --- a/bfd/elf32-m32c.c | ||
629 | +++ b/bfd/elf32-m32c.c | ||
630 | @@ -434,7 +434,7 @@ m32c_elf_relocate_section | ||
631 | } | ||
632 | } | ||
633 | |||
634 | - if (sec != NULL && elf_discarded_section (sec)) | ||
635 | + if (sec != NULL && discarded_section (sec)) | ||
636 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
637 | rel, relend, howto, contents); | ||
638 | |||
639 | diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c | ||
640 | index 51ef61e..b151a8a 100644 | ||
641 | --- a/bfd/elf32-m32r.c | ||
642 | +++ b/bfd/elf32-m32r.c | ||
643 | @@ -2616,7 +2616,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
644 | } | ||
645 | } | ||
646 | |||
647 | - if (sec != NULL && elf_discarded_section (sec)) | ||
648 | + if (sec != NULL && discarded_section (sec)) | ||
649 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
650 | rel, relend, howto, contents); | ||
651 | |||
652 | diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c | ||
653 | index 961dce4..4b9a1c0 100644 | ||
654 | --- a/bfd/elf32-m68hc1x.c | ||
655 | +++ b/bfd/elf32-m68hc1x.c | ||
656 | @@ -970,7 +970,7 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
657 | is_far = (h && (h->other & STO_M68HC12_FAR)); | ||
658 | } | ||
659 | |||
660 | - if (sec != NULL && elf_discarded_section (sec)) | ||
661 | + if (sec != NULL && discarded_section (sec)) | ||
662 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
663 | rel, relend, howto, contents); | ||
664 | |||
665 | diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c | ||
666 | index 3e9ada9..518a41a 100644 | ||
667 | --- a/bfd/elf32-m68k.c | ||
668 | +++ b/bfd/elf32-m68k.c | ||
669 | @@ -3717,7 +3717,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, | ||
670 | unresolved_reloc, warned); | ||
671 | } | ||
672 | |||
673 | - if (sec != NULL && elf_discarded_section (sec)) | ||
674 | + if (sec != NULL && discarded_section (sec)) | ||
675 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
676 | rel, relend, howto, contents); | ||
677 | |||
678 | diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c | ||
679 | index 31cc095..02aef53 100644 | ||
680 | --- a/bfd/elf32-mcore.c | ||
681 | +++ b/bfd/elf32-mcore.c | ||
682 | @@ -466,7 +466,7 @@ mcore_elf_relocate_section (bfd * output_bfd, | ||
683 | unresolved_reloc, warned); | ||
684 | } | ||
685 | |||
686 | - if (sec != NULL && elf_discarded_section (sec)) | ||
687 | + if (sec != NULL && discarded_section (sec)) | ||
688 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
689 | rel, relend, howto, contents); | ||
690 | |||
691 | diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c | ||
692 | index 6fecb25..e5104b3 100644 | ||
693 | --- a/bfd/elf32-mep.c | ||
694 | +++ b/bfd/elf32-mep.c | ||
695 | @@ -500,7 +500,7 @@ mep_elf_relocate_section | ||
696 | name = h->root.root.string; | ||
697 | } | ||
698 | |||
699 | - if (sec != NULL && elf_discarded_section (sec)) | ||
700 | + if (sec != NULL && discarded_section (sec)) | ||
701 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
702 | rel, relend, howto, contents); | ||
703 | |||
704 | diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c | ||
705 | index 8463599..c340826 100644 | ||
706 | --- a/bfd/elf32-moxie.c | ||
707 | +++ b/bfd/elf32-moxie.c | ||
708 | @@ -250,7 +250,7 @@ moxie_elf_relocate_section (bfd *output_bfd, | ||
709 | name = h->root.root.string; | ||
710 | } | ||
711 | |||
712 | - if (sec != NULL && elf_discarded_section (sec)) | ||
713 | + if (sec != NULL && discarded_section (sec)) | ||
714 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
715 | rel, relend, howto, contents); | ||
716 | |||
717 | diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c | ||
718 | index 9a5fb2a..2fa70d9 100644 | ||
719 | --- a/bfd/elf32-msp430.c | ||
720 | +++ b/bfd/elf32-msp430.c | ||
721 | @@ -454,7 +454,7 @@ elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, | ||
722 | unresolved_reloc, warned); | ||
723 | } | ||
724 | |||
725 | - if (sec != NULL && elf_discarded_section (sec)) | ||
726 | + if (sec != NULL && discarded_section (sec)) | ||
727 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
728 | rel, relend, howto, contents); | ||
729 | |||
730 | diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c | ||
731 | index 1be5d00..b87995e 100644 | ||
732 | --- a/bfd/elf32-mt.c | ||
733 | +++ b/bfd/elf32-mt.c | ||
734 | @@ -354,7 +354,7 @@ mt_elf_relocate_section | ||
735 | name = h->root.root.string; | ||
736 | } | ||
737 | |||
738 | - if (sec != NULL && elf_discarded_section (sec)) | ||
739 | + if (sec != NULL && discarded_section (sec)) | ||
740 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
741 | rel, relend, howto, contents); | ||
742 | |||
743 | diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c | ||
744 | index ada738e..e441f4d 100644 | ||
745 | --- a/bfd/elf32-openrisc.c | ||
746 | +++ b/bfd/elf32-openrisc.c | ||
747 | @@ -373,7 +373,7 @@ openrisc_elf_relocate_section (bfd *output_bfd, | ||
748 | unresolved_reloc, warned); | ||
749 | } | ||
750 | |||
751 | - if (sec != NULL && elf_discarded_section (sec)) | ||
752 | + if (sec != NULL && discarded_section (sec)) | ||
753 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
754 | rel, relend, howto, contents); | ||
755 | |||
756 | diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c | ||
757 | index 574cd98..d3925af 100644 | ||
758 | --- a/bfd/elf32-ppc.c | ||
759 | +++ b/bfd/elf32-ppc.c | ||
760 | @@ -6231,7 +6231,7 @@ ppc_elf_relax_section (bfd *abfd, | ||
761 | attribute for a code section, and we are only looking at | ||
762 | branches. However, implement it correctly here as a | ||
763 | reference for other target relax_section functions. */ | ||
764 | - if (0 && tsec->sec_info_type == ELF_INFO_TYPE_MERGE) | ||
765 | + if (0 && tsec->sec_info_type == SEC_INFO_TYPE_MERGE) | ||
766 | { | ||
767 | /* At this stage in linking, no SEC_MERGE symbol has been | ||
768 | adjusted, so all references to such symbols need to be | ||
769 | @@ -6886,7 +6886,7 @@ ppc_elf_relocate_section (bfd *output_bfd, | ||
770 | sym_name = h->root.root.string; | ||
771 | } | ||
772 | |||
773 | - if (sec != NULL && elf_discarded_section (sec)) | ||
774 | + if (sec != NULL && discarded_section (sec)) | ||
775 | { | ||
776 | /* For relocs against symbols from removed linkonce sections, | ||
777 | or sections discarded by a linker script, we just want the | ||
778 | @@ -9054,7 +9054,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, | ||
779 | BFD_ASSERT ((bfd_vma) ((p + 3 - htab->glink_eh_frame->contents) & -4) | ||
780 | == htab->glink_eh_frame->size); | ||
781 | |||
782 | - if (htab->glink_eh_frame->sec_info_type == ELF_INFO_TYPE_EH_FRAME | ||
783 | + if (htab->glink_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME | ||
784 | && !_bfd_elf_write_section_eh_frame (output_bfd, info, | ||
785 | htab->glink_eh_frame, | ||
786 | htab->glink_eh_frame->contents)) | ||
787 | diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c | ||
788 | index f049f6e..32820b4 100644 | ||
789 | --- a/bfd/elf32-rx.c | ||
790 | +++ b/bfd/elf32-rx.c | ||
791 | @@ -510,7 +510,7 @@ rx_elf_relocate_section | ||
792 | name = h->root.root.string; | ||
793 | } | ||
794 | |||
795 | - if (sec != NULL && elf_discarded_section (sec)) | ||
796 | + if (sec != NULL && discarded_section (sec)) | ||
797 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
798 | rel, relend, howto, contents); | ||
799 | |||
800 | @@ -1588,7 +1588,7 @@ rx_offset_for_reloc (bfd * abfd, | ||
801 | if (ssec) | ||
802 | { | ||
803 | if ((ssec->flags & SEC_MERGE) | ||
804 | - && ssec->sec_info_type == ELF_INFO_TYPE_MERGE) | ||
805 | + && ssec->sec_info_type == SEC_INFO_TYPE_MERGE) | ||
806 | symval = _bfd_merged_section_offset (abfd, & ssec, | ||
807 | elf_section_data (ssec)->sec_info, | ||
808 | symval); | ||
809 | diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c | ||
810 | index 98437d0..11fb072 100644 | ||
811 | --- a/bfd/elf32-s390.c | ||
812 | +++ b/bfd/elf32-s390.c | ||
813 | @@ -2282,7 +2282,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, | ||
814 | unresolved_reloc, warned); | ||
815 | } | ||
816 | |||
817 | - if (sec != NULL && elf_discarded_section (sec)) | ||
818 | + if (sec != NULL && discarded_section (sec)) | ||
819 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
820 | rel, relend, howto, contents); | ||
821 | |||
822 | diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c | ||
823 | index b437624..ef849aa 100644 | ||
824 | --- a/bfd/elf32-score.c | ||
825 | +++ b/bfd/elf32-score.c | ||
826 | @@ -2672,7 +2672,7 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd, | ||
827 | } | ||
828 | } | ||
829 | |||
830 | - if (sec != NULL && elf_discarded_section (sec)) | ||
831 | + if (sec != NULL && discarded_section (sec)) | ||
832 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
833 | rel, relend, howto, contents); | ||
834 | |||
835 | diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c | ||
836 | index 3e98bfc..3d228f3 100644 | ||
837 | --- a/bfd/elf32-score7.c | ||
838 | +++ b/bfd/elf32-score7.c | ||
839 | @@ -2443,7 +2443,7 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd, | ||
840 | } | ||
841 | } | ||
842 | |||
843 | - if (sec != NULL && elf_discarded_section (sec)) | ||
844 | + if (sec != NULL && discarded_section (sec)) | ||
845 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
846 | rel, relend, howto, contents); | ||
847 | |||
848 | diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c | ||
849 | index ca2c4af..e56c3b5 100644 | ||
850 | --- a/bfd/elf32-sh.c | ||
851 | +++ b/bfd/elf32-sh.c | ||
852 | @@ -4048,7 +4048,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
853 | _("Unexpected STO_SH5_ISA32 on local symbol is not handled"), | ||
854 | input_bfd, input_section, rel->r_offset)); | ||
855 | |||
856 | - if (sec != NULL && elf_discarded_section (sec)) | ||
857 | + if (sec != NULL && discarded_section (sec)) | ||
858 | /* Handled below. */ | ||
859 | ; | ||
860 | else if (info->relocatable) | ||
861 | @@ -4236,7 +4236,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
862 | } | ||
863 | } | ||
864 | |||
865 | - if (sec != NULL && elf_discarded_section (sec)) | ||
866 | + if (sec != NULL && discarded_section (sec)) | ||
867 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
868 | rel, relend, howto, contents); | ||
869 | |||
870 | diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c | ||
871 | index ae3ed10..40a9da2 100644 | ||
872 | --- a/bfd/elf32-spu.c | ||
873 | +++ b/bfd/elf32-spu.c | ||
874 | @@ -4895,7 +4895,7 @@ spu_elf_relocate_section (bfd *output_bfd, | ||
875 | sym_name = h->root.root.string; | ||
876 | } | ||
877 | |||
878 | - if (sec != NULL && elf_discarded_section (sec)) | ||
879 | + if (sec != NULL && discarded_section (sec)) | ||
880 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
881 | rel, relend, howto, contents); | ||
882 | |||
883 | diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c | ||
884 | index 44042eb..a879d3c 100644 | ||
885 | --- a/bfd/elf32-tic6x.c | ||
886 | +++ b/bfd/elf32-tic6x.c | ||
887 | @@ -2334,7 +2334,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd, | ||
888 | unresolved_reloc, warned); | ||
889 | } | ||
890 | |||
891 | - if (sec != NULL && elf_discarded_section (sec)) | ||
892 | + if (sec != NULL && discarded_section (sec)) | ||
893 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
894 | rel, relend, howto, contents); | ||
895 | |||
896 | diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c | ||
897 | index f2aed9c..a4e565d 100644 | ||
898 | --- a/bfd/elf32-tilepro.c | ||
899 | +++ b/bfd/elf32-tilepro.c | ||
900 | @@ -2594,7 +2594,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
901 | } | ||
902 | } | ||
903 | |||
904 | - if (sec != NULL && elf_discarded_section (sec)) | ||
905 | + if (sec != NULL && discarded_section (sec)) | ||
906 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
907 | rel, relend, howto, contents); | ||
908 | |||
909 | diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c | ||
910 | index 9e6f77d..0fbe080 100644 | ||
911 | --- a/bfd/elf32-v850.c | ||
912 | +++ b/bfd/elf32-v850.c | ||
913 | @@ -2093,7 +2093,7 @@ v850_elf_relocate_section (bfd *output_bfd, | ||
914 | unresolved_reloc, warned); | ||
915 | } | ||
916 | |||
917 | - if (sec != NULL && elf_discarded_section (sec)) | ||
918 | + if (sec != NULL && discarded_section (sec)) | ||
919 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
920 | rel, relend, howto, contents); | ||
921 | |||
922 | diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c | ||
923 | index 643381c..fc3cb7c 100644 | ||
924 | --- a/bfd/elf32-vax.c | ||
925 | +++ b/bfd/elf32-vax.c | ||
926 | @@ -1450,7 +1450,7 @@ elf_vax_relocate_section (bfd *output_bfd, | ||
927 | relocation = 0; | ||
928 | } | ||
929 | |||
930 | - if (sec != NULL && elf_discarded_section (sec)) | ||
931 | + if (sec != NULL && discarded_section (sec)) | ||
932 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
933 | rel, relend, howto, contents); | ||
934 | |||
935 | diff --git a/bfd/elf32-xc16x.c b/bfd/elf32-xc16x.c | ||
936 | index 11d9840..00c7841 100644 | ||
937 | --- a/bfd/elf32-xc16x.c | ||
938 | +++ b/bfd/elf32-xc16x.c | ||
939 | @@ -381,7 +381,7 @@ elf32_xc16x_relocate_section (bfd *output_bfd, | ||
940 | unresolved_reloc, warned); | ||
941 | } | ||
942 | |||
943 | - if (sec != NULL && elf_discarded_section (sec)) | ||
944 | + if (sec != NULL && discarded_section (sec)) | ||
945 | { | ||
946 | /* For relocs against symbols from removed linkonce sections, | ||
947 | or sections discarded by a linker script, we just want the | ||
948 | diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c | ||
949 | index 6141783..86e1d5b 100644 | ||
950 | --- a/bfd/elf32-xstormy16.c | ||
951 | +++ b/bfd/elf32-xstormy16.c | ||
952 | @@ -825,7 +825,7 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNU | ||
953 | unresolved_reloc, warned); | ||
954 | } | ||
955 | |||
956 | - if (sec != NULL && elf_discarded_section (sec)) | ||
957 | + if (sec != NULL && discarded_section (sec)) | ||
958 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
959 | rel, relend, howto, contents); | ||
960 | |||
961 | diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c | ||
962 | index c6e4fb4..5a51eae 100644 | ||
963 | --- a/bfd/elf32-xtensa.c | ||
964 | +++ b/bfd/elf32-xtensa.c | ||
965 | @@ -1712,7 +1712,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
966 | continue; | ||
967 | for (s = abfd->sections; s != NULL; s = s->next) | ||
968 | { | ||
969 | - if (! elf_discarded_section (s) | ||
970 | + if (! discarded_section (s) | ||
971 | && xtensa_is_littable_section (s) | ||
972 | && s != spltlittbl) | ||
973 | sgotloc->size += s->size; | ||
974 | @@ -2656,7 +2656,7 @@ elf_xtensa_relocate_section (bfd *output_bfd, | ||
975 | sym_type = h->type; | ||
976 | } | ||
977 | |||
978 | - if (sec != NULL && elf_discarded_section (sec)) | ||
979 | + if (sec != NULL && discarded_section (sec)) | ||
980 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
981 | rel, relend, howto, contents); | ||
982 | |||
983 | @@ -8960,9 +8960,9 @@ relax_section (bfd *abfd, asection *sec, struct bfd_link_info *link_info) | ||
984 | that here and adjust things accordingly. */ | ||
985 | if (! elf_xtensa_ignore_discarded_relocs (sec) | ||
986 | && elf_xtensa_action_discarded (sec) == PRETEND | ||
987 | - && sec->sec_info_type != ELF_INFO_TYPE_STABS | ||
988 | + && sec->sec_info_type != SEC_INFO_TYPE_STABS | ||
989 | && target_sec != NULL | ||
990 | - && elf_discarded_section (target_sec)) | ||
991 | + && discarded_section (target_sec)) | ||
992 | { | ||
993 | /* It would be natural to call _bfd_elf_check_kept_section | ||
994 | here, but it's not exported from elflink.c. It's also a | ||
995 | diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c | ||
996 | index 6076709..ddb1cd7 100644 | ||
997 | --- a/bfd/elf64-alpha.c | ||
998 | +++ b/bfd/elf64-alpha.c | ||
999 | @@ -4106,7 +4106,7 @@ elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
1000 | sec = h->root.u.def.section; | ||
1001 | } | ||
1002 | |||
1003 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1004 | + if (sec != NULL && discarded_section (sec)) | ||
1005 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1006 | rel, relend, | ||
1007 | elf64_alpha_howto_table + r_type, | ||
1008 | @@ -4263,7 +4263,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
1009 | unless it has been done already. */ | ||
1010 | if ((sec->flags & SEC_MERGE) | ||
1011 | && ELF_ST_TYPE (sym->st_info) == STT_SECTION | ||
1012 | - && sec->sec_info_type == ELF_INFO_TYPE_MERGE | ||
1013 | + && sec->sec_info_type == SEC_INFO_TYPE_MERGE | ||
1014 | && gotent | ||
1015 | && !gotent->reloc_xlated) | ||
1016 | { | ||
1017 | @@ -4315,7 +4315,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
1018 | gotent = h->got_entries; | ||
1019 | } | ||
1020 | |||
1021 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1022 | + if (sec != NULL && discarded_section (sec)) | ||
1023 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1024 | rel, relend, howto, contents); | ||
1025 | |||
1026 | @@ -4717,7 +4717,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
1027 | |||
1028 | if (r_symndx < symtab_hdr->sh_info | ||
1029 | && sec != NULL && howto->pc_relative | ||
1030 | - && elf_discarded_section (sec)) | ||
1031 | + && discarded_section (sec)) | ||
1032 | break; | ||
1033 | |||
1034 | if (h != NULL) | ||
1035 | diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c | ||
1036 | index 057a92d..9d2dfcf 100644 | ||
1037 | --- a/bfd/elf64-hppa.c | ||
1038 | +++ b/bfd/elf64-hppa.c | ||
1039 | @@ -3919,7 +3919,7 @@ elf64_hppa_relocate_section (bfd *output_bfd, | ||
1040 | } | ||
1041 | } | ||
1042 | |||
1043 | - if (sym_sec != NULL && elf_discarded_section (sym_sec)) | ||
1044 | + if (sym_sec != NULL && discarded_section (sym_sec)) | ||
1045 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1046 | rel, relend, howto, contents); | ||
1047 | |||
1048 | diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c | ||
1049 | index ecc9ad0..9cc407f 100644 | ||
1050 | --- a/bfd/elf64-mmix.c | ||
1051 | +++ b/bfd/elf64-mmix.c | ||
1052 | @@ -1475,7 +1475,7 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section, | ||
1053 | name = h->root.root.string; | ||
1054 | } | ||
1055 | |||
1056 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1057 | + if (sec != NULL && discarded_section (sec)) | ||
1058 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1059 | rel, relend, howto, contents); | ||
1060 | |||
1061 | diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c | ||
1062 | index 32a3430..52e9ce9 100644 | ||
1063 | --- a/bfd/elf64-ppc.c | ||
1064 | +++ b/bfd/elf64-ppc.c | ||
1065 | @@ -6852,7 +6852,7 @@ adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) | ||
1066 | if (dsec == NULL) | ||
1067 | { | ||
1068 | for (dsec = sym_sec->owner->sections; dsec; dsec = dsec->next) | ||
1069 | - if (elf_discarded_section (dsec)) | ||
1070 | + if (discarded_section (dsec)) | ||
1071 | { | ||
1072 | ppc64_elf_tdata (sym_sec->owner)->deleted_section = dsec; | ||
1073 | break; | ||
1074 | @@ -7033,7 +7033,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info, bfd_boolean non_overlapping) | ||
1075 | if (sec == NULL || sec->size == 0) | ||
1076 | continue; | ||
1077 | |||
1078 | - if (sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) | ||
1079 | + if (sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS) | ||
1080 | continue; | ||
1081 | |||
1082 | if (sec->output_section == bfd_abs_section_ptr) | ||
1083 | @@ -8077,8 +8077,8 @@ ppc64_elf_edit_toc (struct bfd_link_info *info) | ||
1084 | toc = bfd_get_section_by_name (ibfd, ".toc"); | ||
1085 | if (toc == NULL | ||
1086 | || toc->size == 0 | ||
1087 | - || toc->sec_info_type == ELF_INFO_TYPE_JUST_SYMS | ||
1088 | - || elf_discarded_section (toc)) | ||
1089 | + || toc->sec_info_type == SEC_INFO_TYPE_JUST_SYMS | ||
1090 | + || discarded_section (toc)) | ||
1091 | continue; | ||
1092 | |||
1093 | toc_relocs = NULL; | ||
1094 | @@ -8091,7 +8091,7 @@ ppc64_elf_edit_toc (struct bfd_link_info *info) | ||
1095 | for (sec = ibfd->sections; sec != NULL; sec = sec->next) | ||
1096 | { | ||
1097 | if (sec->reloc_count == 0 | ||
1098 | - || !elf_discarded_section (sec) | ||
1099 | + || !discarded_section (sec) | ||
1100 | || get_opd_info (sec) | ||
1101 | || (sec->flags & SEC_ALLOC) == 0 | ||
1102 | || (sec->flags & SEC_DEBUGGING) != 0) | ||
1103 | @@ -8201,7 +8201,7 @@ ppc64_elf_edit_toc (struct bfd_link_info *info) | ||
1104 | goto error_ret; | ||
1105 | |||
1106 | if (sym_sec == NULL | ||
1107 | - || elf_discarded_section (sym_sec)) | ||
1108 | + || discarded_section (sym_sec)) | ||
1109 | continue; | ||
1110 | |||
1111 | if (!SYMBOL_CALLS_LOCAL (info, h)) | ||
1112 | @@ -8281,7 +8281,7 @@ ppc64_elf_edit_toc (struct bfd_link_info *info) | ||
1113 | int repeat; | ||
1114 | |||
1115 | if (sec->reloc_count == 0 | ||
1116 | - || elf_discarded_section (sec) | ||
1117 | + || discarded_section (sec) | ||
1118 | || get_opd_info (sec) | ||
1119 | || (sec->flags & SEC_ALLOC) == 0 | ||
1120 | || (sec->flags & SEC_DEBUGGING) != 0) | ||
1121 | @@ -8503,7 +8503,7 @@ ppc64_elf_edit_toc (struct bfd_link_info *info) | ||
1122 | for (sec = ibfd->sections; sec != NULL; sec = sec->next) | ||
1123 | { | ||
1124 | if (sec->reloc_count == 0 | ||
1125 | - || elf_discarded_section (sec)) | ||
1126 | + || discarded_section (sec)) | ||
1127 | continue; | ||
1128 | |||
1129 | relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, | ||
1130 | @@ -12036,7 +12036,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, | ||
1131 | } | ||
1132 | h = (struct ppc_link_hash_entry *) h_elf; | ||
1133 | |||
1134 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1135 | + if (sec != NULL && discarded_section (sec)) | ||
1136 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1137 | rel, relend, | ||
1138 | ppc64_elf_howto_table[r_type], | ||
1139 | @@ -13865,7 +13865,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, | ||
1140 | |||
1141 | |||
1142 | if (htab->glink_eh_frame != NULL | ||
1143 | - && htab->glink_eh_frame->sec_info_type == ELF_INFO_TYPE_EH_FRAME | ||
1144 | + && htab->glink_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME | ||
1145 | && !_bfd_elf_write_section_eh_frame (output_bfd, info, | ||
1146 | htab->glink_eh_frame, | ||
1147 | htab->glink_eh_frame->contents)) | ||
1148 | diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c | ||
1149 | index 9884da0..e9138a6 100644 | ||
1150 | --- a/bfd/elf64-s390.c | ||
1151 | +++ b/bfd/elf64-s390.c | ||
1152 | @@ -2270,7 +2270,7 @@ elf_s390_relocate_section (bfd *output_bfd, | ||
1153 | unresolved_reloc, warned); | ||
1154 | } | ||
1155 | |||
1156 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1157 | + if (sec != NULL && discarded_section (sec)) | ||
1158 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1159 | rel, relend, howto, contents); | ||
1160 | |||
1161 | diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c | ||
1162 | index bbef2a2..d8f2120 100644 | ||
1163 | --- a/bfd/elf64-sh64.c | ||
1164 | +++ b/bfd/elf64-sh64.c | ||
1165 | @@ -1514,7 +1514,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
1166 | _("Unexpected STO_SH5_ISA32 on local symbol is not handled"), | ||
1167 | input_bfd, input_section, rel->r_offset)); | ||
1168 | |||
1169 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1170 | + if (sec != NULL && discarded_section (sec)) | ||
1171 | /* Handled below. */ | ||
1172 | ; | ||
1173 | else if (info->relocatable) | ||
1174 | @@ -1657,7 +1657,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, | ||
1175 | } | ||
1176 | } | ||
1177 | |||
1178 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1179 | + if (sec != NULL && discarded_section (sec)) | ||
1180 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1181 | rel, relend, howto, contents); | ||
1182 | |||
1183 | diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c | ||
1184 | index bdb3ae6..9d826e7 100644 | ||
1185 | --- a/bfd/elf64-x86-64.c | ||
1186 | +++ b/bfd/elf64-x86-64.c | ||
1187 | @@ -3062,7 +3062,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, | ||
1188 | unresolved_reloc, warned); | ||
1189 | } | ||
1190 | |||
1191 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1192 | + if (sec != NULL && discarded_section (sec)) | ||
1193 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1194 | rel, relend, howto, contents); | ||
1195 | |||
1196 | @@ -4625,7 +4625,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, | ||
1197 | + PLT_FDE_START_OFFSET); | ||
1198 | } | ||
1199 | if (htab->plt_eh_frame->sec_info_type | ||
1200 | - == ELF_INFO_TYPE_EH_FRAME) | ||
1201 | + == SEC_INFO_TYPE_EH_FRAME) | ||
1202 | { | ||
1203 | if (! _bfd_elf_write_section_eh_frame (output_bfd, info, | ||
1204 | htab->plt_eh_frame, | ||
1205 | diff --git a/bfd/elflink.c b/bfd/elflink.c | ||
1206 | index 8556cec..da6be48 100644 | ||
1207 | --- a/bfd/elflink.c | ||
1208 | +++ b/bfd/elflink.c | ||
1209 | @@ -1,6 +1,6 @@ | ||
1210 | /* ELF linking support for BFD. | ||
1211 | Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | ||
1212 | - 2005, 2006, 2007, 2008, 2009, 2010, 2011 | ||
1213 | + 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 | ||
1214 | Free Software Foundation, Inc. | ||
1215 | |||
1216 | This file is part of BFD, the Binary File Descriptor library. | ||
1217 | @@ -937,7 +937,7 @@ _bfd_elf_merge_symbol (bfd *abfd, | ||
1218 | /* Silently discard TLS symbols from --just-syms. There's no way to | ||
1219 | combine a static TLS block with a new TLS block for this executable. */ | ||
1220 | if (ELF_ST_TYPE (sym->st_info) == STT_TLS | ||
1221 | - && sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) | ||
1222 | + && sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS) | ||
1223 | { | ||
1224 | *skip = TRUE; | ||
1225 | return TRUE; | ||
1226 | @@ -2708,7 +2708,7 @@ _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data) | ||
1227 | if ((h->root.type == bfd_link_hash_defined | ||
1228 | || h->root.type == bfd_link_hash_defweak) | ||
1229 | && ((sec = h->root.u.def.section)->flags & SEC_MERGE) | ||
1230 | - && sec->sec_info_type == ELF_INFO_TYPE_MERGE) | ||
1231 | + && sec->sec_info_type == SEC_INFO_TYPE_MERGE) | ||
1232 | { | ||
1233 | bfd *output_bfd = (bfd *) data; | ||
1234 | |||
1235 | @@ -3499,7 +3499,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) | ||
1236 | /* ld --just-symbols and dynamic objects don't mix very well. | ||
1237 | ld shouldn't allow it. */ | ||
1238 | if ((s = abfd->sections) != NULL | ||
1239 | - && s->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) | ||
1240 | + && s->sec_info_type == SEC_INFO_TYPE_JUST_SYMS) | ||
1241 | abort (); | ||
1242 | |||
1243 | /* If this dynamic lib was specified on the command line with | ||
1244 | @@ -3896,7 +3896,7 @@ error_free_dyn: | ||
1245 | sec = bfd_section_from_elf_index (abfd, isym->st_shndx); | ||
1246 | if (sec == NULL) | ||
1247 | sec = bfd_abs_section_ptr; | ||
1248 | - else if (elf_discarded_section (sec)) | ||
1249 | + else if (discarded_section (sec)) | ||
1250 | { | ||
1251 | /* Symbols from discarded section are undefined. We keep | ||
1252 | its visibility. */ | ||
1253 | @@ -4861,7 +4861,7 @@ error_free_dyn: | ||
1254 | &string_offset)) | ||
1255 | goto error_return; | ||
1256 | if (secdata->sec_info) | ||
1257 | - stab->sec_info_type = ELF_INFO_TYPE_STABS; | ||
1258 | + stab->sec_info_type = SEC_INFO_TYPE_STABS; | ||
1259 | } | ||
1260 | } | ||
1261 | } | ||
1262 | @@ -6644,25 +6644,14 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) | ||
1263 | return TRUE; | ||
1264 | } | ||
1265 | |||
1266 | -/* Indicate that we are only retrieving symbol values from this | ||
1267 | - section. */ | ||
1268 | - | ||
1269 | -void | ||
1270 | -_bfd_elf_link_just_syms (asection *sec, struct bfd_link_info *info) | ||
1271 | -{ | ||
1272 | - if (is_elf_hash_table (info->hash)) | ||
1273 | - sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS; | ||
1274 | - _bfd_generic_link_just_syms (sec, info); | ||
1275 | -} | ||
1276 | - | ||
1277 | /* Make sure sec_info_type is cleared if sec_info is cleared too. */ | ||
1278 | |||
1279 | static void | ||
1280 | merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED, | ||
1281 | asection *sec) | ||
1282 | { | ||
1283 | - BFD_ASSERT (sec->sec_info_type == ELF_INFO_TYPE_MERGE); | ||
1284 | - sec->sec_info_type = ELF_INFO_TYPE_NONE; | ||
1285 | + BFD_ASSERT (sec->sec_info_type == SEC_INFO_TYPE_MERGE); | ||
1286 | + sec->sec_info_type = SEC_INFO_TYPE_NONE; | ||
1287 | } | ||
1288 | |||
1289 | /* Finish SHF_MERGE section merging. */ | ||
1290 | @@ -6690,7 +6679,7 @@ _bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info) | ||
1291 | sec, &secdata->sec_info)) | ||
1292 | return FALSE; | ||
1293 | else if (secdata->sec_info) | ||
1294 | - sec->sec_info_type = ELF_INFO_TYPE_MERGE; | ||
1295 | + sec->sec_info_type = SEC_INFO_TYPE_MERGE; | ||
1296 | } | ||
1297 | |||
1298 | if (elf_hash_table (info)->merge_info != NULL) | ||
1299 | @@ -8708,7 +8697,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data) | ||
1300 | else if ((h->root.type == bfd_link_hash_defined | ||
1301 | || h->root.type == bfd_link_hash_defweak) | ||
1302 | && ((finfo->info->strip_discarded | ||
1303 | - && elf_discarded_section (h->root.u.def.section)) | ||
1304 | + && discarded_section (h->root.u.def.section)) | ||
1305 | || (h->root.u.def.section->owner != NULL | ||
1306 | && (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0))) | ||
1307 | strip = TRUE; | ||
1308 | @@ -9007,8 +8996,8 @@ elf_section_ignore_discarded_relocs (asection *sec) | ||
1309 | |||
1310 | switch (sec->sec_info_type) | ||
1311 | { | ||
1312 | - case ELF_INFO_TYPE_STABS: | ||
1313 | - case ELF_INFO_TYPE_EH_FRAME: | ||
1314 | + case SEC_INFO_TYPE_STABS: | ||
1315 | + case SEC_INFO_TYPE_EH_FRAME: | ||
1316 | return TRUE; | ||
1317 | default: | ||
1318 | break; | ||
1319 | @@ -9193,7 +9182,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) | ||
1320 | *ppsection = NULL; | ||
1321 | continue; | ||
1322 | } | ||
1323 | - else if (isec->sec_info_type == ELF_INFO_TYPE_MERGE | ||
1324 | + else if (isec->sec_info_type == SEC_INFO_TYPE_MERGE | ||
1325 | && ELF_ST_TYPE (isym->st_info) != STT_SECTION) | ||
1326 | isym->st_value = | ||
1327 | _bfd_merged_section_offset (output_bfd, &isec, | ||
1328 | @@ -9537,7 +9526,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) | ||
1329 | { | ||
1330 | /* Complain if the definition comes from a | ||
1331 | discarded section. */ | ||
1332 | - if ((sec = *ps) != NULL && elf_discarded_section (sec)) | ||
1333 | + if ((sec = *ps) != NULL && discarded_section (sec)) | ||
1334 | { | ||
1335 | BFD_ASSERT (r_symndx != STN_UNDEF); | ||
1336 | if (action_discarded & COMPLAIN) | ||
1337 | @@ -9874,19 +9863,19 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) | ||
1338 | } | ||
1339 | else switch (o->sec_info_type) | ||
1340 | { | ||
1341 | - case ELF_INFO_TYPE_STABS: | ||
1342 | + case SEC_INFO_TYPE_STABS: | ||
1343 | if (! (_bfd_write_section_stabs | ||
1344 | (output_bfd, | ||
1345 | &elf_hash_table (finfo->info)->stab_info, | ||
1346 | o, &elf_section_data (o)->sec_info, contents))) | ||
1347 | return FALSE; | ||
1348 | break; | ||
1349 | - case ELF_INFO_TYPE_MERGE: | ||
1350 | + case SEC_INFO_TYPE_MERGE: | ||
1351 | if (! _bfd_write_merged_section (output_bfd, o, | ||
1352 | elf_section_data (o)->sec_info)) | ||
1353 | return FALSE; | ||
1354 | break; | ||
1355 | - case ELF_INFO_TYPE_EH_FRAME: | ||
1356 | + case SEC_INFO_TYPE_EH_FRAME: | ||
1357 | { | ||
1358 | if (! _bfd_elf_write_section_eh_frame (output_bfd, finfo->info, | ||
1359 | o, contents)) | ||
1360 | @@ -12415,7 +12404,7 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie) | ||
1361 | |||
1362 | if ((h->root.type == bfd_link_hash_defined | ||
1363 | || h->root.type == bfd_link_hash_defweak) | ||
1364 | - && elf_discarded_section (h->root.u.def.section)) | ||
1365 | + && discarded_section (h->root.u.def.section)) | ||
1366 | return TRUE; | ||
1367 | else | ||
1368 | return FALSE; | ||
1369 | @@ -12431,7 +12420,7 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie) | ||
1370 | /* Need to: get the symbol; get the section. */ | ||
1371 | isym = &rcookie->locsyms[r_symndx]; | ||
1372 | isec = bfd_section_from_elf_index (rcookie->abfd, isym->st_shndx); | ||
1373 | - if (isec != NULL && elf_discarded_section (isec)) | ||
1374 | + if (isec != NULL && discarded_section (isec)) | ||
1375 | return TRUE; | ||
1376 | } | ||
1377 | return FALSE; | ||
1378 | @@ -12482,7 +12471,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) | ||
1379 | if (stab != NULL | ||
1380 | && (stab->size == 0 | ||
1381 | || bfd_is_abs_section (stab->output_section) | ||
1382 | - || stab->sec_info_type != ELF_INFO_TYPE_STABS)) | ||
1383 | + || stab->sec_info_type != SEC_INFO_TYPE_STABS)) | ||
1384 | stab = NULL; | ||
1385 | |||
1386 | if (stab == NULL | ||
1387 | diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c | ||
1388 | index 3e2ee0b..0f6b720 100644 | ||
1389 | --- a/bfd/elfnn-ia64.c | ||
1390 | +++ b/bfd/elfnn-ia64.c | ||
1391 | @@ -530,7 +530,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec, | ||
1392 | symtype = h->type; | ||
1393 | } | ||
1394 | |||
1395 | - if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE) | ||
1396 | + if (tsec->sec_info_type == SEC_INFO_TYPE_MERGE) | ||
1397 | { | ||
1398 | /* At this stage in linking, no SEC_MERGE symbol has been | ||
1399 | adjusted, so all references to such symbols need to be | ||
1400 | @@ -3861,7 +3861,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, | ||
1401 | if (!info->relocatable | ||
1402 | && (sym_sec->flags & SEC_MERGE) != 0 | ||
1403 | && ELF_ST_TYPE (sym->st_info) == STT_SECTION | ||
1404 | - && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE) | ||
1405 | + && sym_sec->sec_info_type == SEC_INFO_TYPE_MERGE) | ||
1406 | { | ||
1407 | struct elfNN_ia64_local_hash_entry *loc_h; | ||
1408 | |||
1409 | @@ -3919,7 +3919,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, | ||
1410 | continue; | ||
1411 | } | ||
1412 | |||
1413 | - if (sym_sec != NULL && elf_discarded_section (sym_sec)) | ||
1414 | + if (sym_sec != NULL && discarded_section (sym_sec)) | ||
1415 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1416 | rel, relend, howto, contents); | ||
1417 | |||
1418 | diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c | ||
1419 | index fa906cd..7911050 100644 | ||
1420 | --- a/bfd/elfxx-mips.c | ||
1421 | +++ b/bfd/elfxx-mips.c | ||
1422 | @@ -9385,7 +9385,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
1423 | sec = h->root.u.def.section; | ||
1424 | } | ||
1425 | |||
1426 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1427 | + if (sec != NULL && discarded_section (sec)) | ||
1428 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1429 | rel, relend, howto, contents); | ||
1430 | |||
1431 | diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c | ||
1432 | index 9a15124..f3c631e 100644 | ||
1433 | --- a/bfd/elfxx-sparc.c | ||
1434 | +++ b/bfd/elfxx-sparc.c | ||
1435 | @@ -2970,7 +2970,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, | ||
1436 | } | ||
1437 | } | ||
1438 | |||
1439 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1440 | + if (sec != NULL && discarded_section (sec)) | ||
1441 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1442 | rel, relend, howto, contents); | ||
1443 | |||
1444 | diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c | ||
1445 | index c484562..e1c8946 100644 | ||
1446 | --- a/bfd/elfxx-tilegx.c | ||
1447 | +++ b/bfd/elfxx-tilegx.c | ||
1448 | @@ -2908,7 +2908,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, | ||
1449 | } | ||
1450 | } | ||
1451 | |||
1452 | - if (sec != NULL && elf_discarded_section (sec)) | ||
1453 | + if (sec != NULL && discarded_section (sec)) | ||
1454 | RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, | ||
1455 | rel, relend, howto, contents); | ||
1456 | |||
1457 | diff --git a/bfd/linker.c b/bfd/linker.c | ||
1458 | index 7a01e11..e5d20b2 100644 | ||
1459 | --- a/bfd/linker.c | ||
1460 | +++ b/bfd/linker.c | ||
1461 | @@ -1,6 +1,6 @@ | ||
1462 | /* linker.c -- BFD linker routines | ||
1463 | Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
1464 | - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 | ||
1465 | + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 | ||
1466 | Free Software Foundation, Inc. | ||
1467 | Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support | ||
1468 | |||
1469 | @@ -810,6 +810,7 @@ void | ||
1470 | _bfd_generic_link_just_syms (asection *sec, | ||
1471 | struct bfd_link_info *info ATTRIBUTE_UNUSED) | ||
1472 | { | ||
1473 | + sec->sec_info_type = SEC_INFO_TYPE_JUST_SYMS; | ||
1474 | sec->output_section = bfd_abs_section_ptr; | ||
1475 | sec->output_offset = sec->vma; | ||
1476 | } | ||
1477 | diff --git a/bfd/reloc.c b/bfd/reloc.c | ||
1478 | index ef55cc3..e3f0343 100644 | ||
1479 | --- a/bfd/reloc.c | ||
1480 | +++ b/bfd/reloc.c | ||
1481 | @@ -6235,7 +6235,7 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, | ||
1482 | bfd_reloc_status_type r; | ||
1483 | |||
1484 | symbol = *(*parent)->sym_ptr_ptr; | ||
1485 | - if (symbol->section && elf_discarded_section (symbol->section)) | ||
1486 | + if (symbol->section && discarded_section (symbol->section)) | ||
1487 | { | ||
1488 | bfd_byte *p; | ||
1489 | static reloc_howto_type none_howto | ||
1490 | diff --git a/bfd/section.c b/bfd/section.c | ||
1491 | index 7c1f750..e60f247 100644 | ||
1492 | --- a/bfd/section.c | ||
1493 | +++ b/bfd/section.c | ||
1494 | @@ -382,11 +382,11 @@ CODE_FRAGMENT | ||
1495 | . | ||
1496 | . {* Type of sec_info information. *} | ||
1497 | . unsigned int sec_info_type:3; | ||
1498 | -.#define ELF_INFO_TYPE_NONE 0 | ||
1499 | -.#define ELF_INFO_TYPE_STABS 1 | ||
1500 | -.#define ELF_INFO_TYPE_MERGE 2 | ||
1501 | -.#define ELF_INFO_TYPE_EH_FRAME 3 | ||
1502 | -.#define ELF_INFO_TYPE_JUST_SYMS 4 | ||
1503 | +.#define SEC_INFO_TYPE_NONE 0 | ||
1504 | +.#define SEC_INFO_TYPE_STABS 1 | ||
1505 | +.#define SEC_INFO_TYPE_MERGE 2 | ||
1506 | +.#define SEC_INFO_TYPE_EH_FRAME 3 | ||
1507 | +.#define SEC_INFO_TYPE_JUST_SYMS 4 | ||
1508 | . | ||
1509 | . {* Nonzero if this section uses RELA relocations, rather than REL. *} | ||
1510 | . unsigned int use_rela_p:1; | ||
1511 | diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em | ||
1512 | index d29da59..7631474 100644 | ||
1513 | --- a/ld/emultempl/armelf.em | ||
1514 | +++ b/ld/emultempl/armelf.em | ||
1515 | @@ -240,7 +240,7 @@ build_section_lists (lang_statement_union_type *statement) | ||
1516 | { | ||
1517 | asection *i = statement->input_section.section; | ||
1518 | |||
1519 | - if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag | ||
1520 | + if (i->sec_info_type != SEC_INFO_TYPE_JUST_SYMS | ||
1521 | && (i->flags & SEC_EXCLUDE) == 0 | ||
1522 | && i->output_section != NULL | ||
1523 | && i->output_section->owner == link_info.output_bfd) | ||
1524 | @@ -299,7 +299,7 @@ gld${EMULATION_NAME}_after_allocation (void) | ||
1525 | && elf_section_type (sec) == SHT_PROGBITS | ||
1526 | && (elf_section_flags (sec) & SHF_EXECINSTR) != 0 | ||
1527 | && (sec->flags & SEC_EXCLUDE) == 0 | ||
1528 | - && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS | ||
1529 | + && sec->sec_info_type != SEC_INFO_TYPE_JUST_SYMS | ||
1530 | && out_sec != bfd_abs_section_ptr) | ||
1531 | { | ||
1532 | if (sec_count == list_size) | ||
1533 | diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em | ||
1534 | index 1137ba2..6258bf4 100644 | ||
1535 | --- a/ld/emultempl/hppaelf.em | ||
1536 | +++ b/ld/emultempl/hppaelf.em | ||
1537 | @@ -229,7 +229,7 @@ build_section_lists (lang_statement_union_type *statement) | ||
1538 | { | ||
1539 | asection *i = statement->input_section.section; | ||
1540 | |||
1541 | - if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag | ||
1542 | + if (i->sec_info_type != SEC_INFO_TYPE_JUST_SYMS | ||
1543 | && (i->flags & SEC_EXCLUDE) == 0 | ||
1544 | && i->output_section != NULL | ||
1545 | && i->output_section->owner == link_info.output_bfd) | ||
1546 | diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em | ||
1547 | index 92a468f..52b9f05 100644 | ||
1548 | --- a/ld/emultempl/ppc64elf.em | ||
1549 | +++ b/ld/emultempl/ppc64elf.em | ||
1550 | @@ -428,7 +428,7 @@ build_toc_list (lang_statement_union_type *statement) | ||
1551 | { | ||
1552 | asection *i = statement->input_section.section; | ||
1553 | |||
1554 | - if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag | ||
1555 | + if (i->sec_info_type != SEC_INFO_TYPE_JUST_SYMS | ||
1556 | && (i->flags & SEC_EXCLUDE) == 0 | ||
1557 | && i->output_section == toc_section) | ||
1558 | { | ||
1559 | @@ -446,7 +446,7 @@ build_section_lists (lang_statement_union_type *statement) | ||
1560 | { | ||
1561 | asection *i = statement->input_section.section; | ||
1562 | |||
1563 | - if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag | ||
1564 | + if (i->sec_info_type != SEC_INFO_TYPE_JUST_SYMS | ||
1565 | && (i->flags & SEC_EXCLUDE) == 0 | ||
1566 | && i->output_section != NULL | ||
1567 | && i->output_section->owner == link_info.output_bfd) | ||
1568 | diff --git a/ld/emultempl/tic6xdsbt.em b/ld/emultempl/tic6xdsbt.em | ||
1569 | index e287005..fd7a12b 100644 | ||
1570 | --- a/ld/emultempl/tic6xdsbt.em | ||
1571 | +++ b/ld/emultempl/tic6xdsbt.em | ||
1572 | @@ -122,7 +122,7 @@ gld${EMULATION_NAME}_after_allocation (void) | ||
1573 | && elf_section_type (sec) == SHT_PROGBITS | ||
1574 | && (elf_section_flags (sec) & SHF_EXECINSTR) != 0 | ||
1575 | && (sec->flags & SEC_EXCLUDE) == 0 | ||
1576 | - && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS | ||
1577 | + && sec->sec_info_type != SEC_INFO_TYPE_JUST_SYMS | ||
1578 | && out_sec != bfd_abs_section_ptr) | ||
1579 | { | ||
1580 | if (sec_count == list_size) | ||
1581 | diff --git a/ld/ldlang.c b/ld/ldlang.c | ||
1582 | index 2c56b56..7ecbae2 100644 | ||
1583 | --- a/ld/ldlang.c | ||
1584 | +++ b/ld/ldlang.c | ||
1585 | @@ -4648,7 +4648,7 @@ size_input_section | ||
1586 | lang_input_section_type *is = &((*this_ptr)->input_section); | ||
1587 | asection *i = is->section; | ||
1588 | |||
1589 | - if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag | ||
1590 | + if (i->sec_info_type != SEC_INFO_TYPE_JUST_SYMS | ||
1591 | && (i->flags & SEC_EXCLUDE) == 0) | ||
1592 | { | ||
1593 | unsigned int alignment_needed; | ||
1594 | diff --git a/ld/ldwrite.c b/ld/ldwrite.c | ||
1595 | index b7a1469..2503d1f 100644 | ||
1596 | --- a/ld/ldwrite.c | ||
1597 | +++ b/ld/ldwrite.c | ||
1598 | @@ -1,6 +1,6 @@ | ||
1599 | /* ldwrite.c -- write out the linked file | ||
1600 | Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002, | ||
1601 | - 2003, 2004, 2005, 2006, 2007, 2008, 2010 | ||
1602 | + 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012 | ||
1603 | Free Software Foundation, Inc. | ||
1604 | Written by Steve Chamberlain sac@cygnus.com | ||
1605 | |||
1606 | @@ -240,7 +240,7 @@ build_link_order (lang_statement_union_type *statement) | ||
1607 | attached */ | ||
1608 | asection *i = statement->input_section.section; | ||
1609 | |||
1610 | - if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag | ||
1611 | + if (i->sec_info_type != SEC_INFO_TYPE_JUST_SYMS | ||
1612 | && (i->flags & SEC_EXCLUDE) == 0) | ||
1613 | { | ||
1614 | asection *output_section = i->output_section; | ||
1615 | -- | ||
1616 | 1.7.9.5 | ||
1617 | |||