]>
Commit | Line | Data |
---|---|---|
41d8d165 PS |
1 | 2008-03-16 H.J. Lu <hongjiu.lu@intel.com> |
2 | ||
3 | PR ld/5789 | |
4 | PR ld/5943 | |
5 | * elf32-i386.c (elf_i386_relocate_section): Issue an error | |
6 | for R_386_GOTOFF relocaton against undefined hidden/internal | |
7 | symbols when building a shared object. | |
8 | ||
9 | * elf64-x86-64.c (elf64_x86_64_relocate_section): Issue an | |
10 | error for R_X86_64_PC8/R_X86_64_PC16/R_X86_64_PC32 | |
11 | relocaton against undefined hidden/internal symbols when | |
12 | building a shared object. | |
13 | (elf64_x86_64_finish_dynamic_symbol): Return FALSE when symbol | |
14 | is referenced locally, but isn't defined in a regular file. | |
15 | ||
16 | ld/testsuite/ | |
17 | ||
18 | 2008-03-16 H.J. Lu <hongjiu.lu@intel.com> | |
19 | ||
20 | PR ld/5789 | |
21 | PR ld/5943 | |
22 | * ld-i386/hidden1.d: New. | |
23 | * ld-i386/hidden1.s: Likewise. | |
24 | * ld-i386/hidden2.d: Likewise. | |
25 | * ld-i386/hidden2.s: Likewise. | |
26 | * ld-i386/hidden3.d: Likewise. | |
27 | * ld-i386/hidden4.s: Likewise. | |
28 | * ld-i386/protected1.d: Likewise. | |
29 | * ld-i386/protected1.s: Likewise. | |
30 | * ld-i386/protected2.d: Likewise. | |
31 | * ld-i386/protected2.s: Likewise. | |
32 | * ld-i386/protected3.d: Likewise. | |
33 | * ld-i386/protected3.s: Likewise. | |
34 | * ld-x86-64/hidden1.d: Likewise. | |
35 | * ld-x86-64/hidden1.s: Likewise. | |
36 | * ld-x86-64/hidden2.d: Likewise. | |
37 | * ld-x86-64/hidden2.s: Likewise. | |
38 | * ld-x86-64/hidden3.d: Likewise. | |
39 | * ld-x86-64/hidden3.s: Likewise. | |
40 | * ld-x86-64/protected1.d: Likewise. | |
41 | * ld-x86-64/protected1.s: Likewise. | |
42 | * ld-x86-64/protected2.d: Likewise. | |
43 | * ld-x86-64/protected2.s: Likewise. | |
44 | * ld-x86-64/protected3.d: Likewise. | |
45 | * ld-x86-64/protected3.s: Likewise. | |
46 | ||
47 | * ld-i386/i386.exp: Run hidden1, hidden2, hidden3, protected1, | |
48 | protected2 and protected3. | |
49 | * ld-x86-64/x86-64.exp: Likewise. | |
50 | ||
51 | --- binutils/bfd/elf32-i386.c.bad 2008-03-15 07:28:10.000000000 -0700 | |
52 | +++ binutils/bfd/elf32-i386.c 2008-03-16 09:54:26.000000000 -0700 | |
53 | @@ -2773,19 +2773,46 @@ elf_i386_relocate_section (bfd *output_b | |
54 | ||
55 | /* Check to make sure it isn't a protected function symbol | |
56 | for shared library since it may not be local when used | |
57 | - as function address. */ | |
58 | - if (info->shared | |
59 | - && !info->executable | |
60 | - && h | |
61 | - && h->def_regular | |
62 | - && h->type == STT_FUNC | |
63 | - && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED) | |
64 | + as function address. We also need to make sure that a | |
65 | + symbol is defined locally. */ | |
66 | + if (info->shared && h) | |
67 | { | |
68 | - (*_bfd_error_handler) | |
69 | - (_("%B: relocation R_386_GOTOFF against protected function `%s' can not be used when making a shared object"), | |
70 | - input_bfd, h->root.root.string); | |
71 | - bfd_set_error (bfd_error_bad_value); | |
72 | - return FALSE; | |
73 | + if (!h->def_regular) | |
74 | + { | |
75 | + const char *v; | |
76 | + | |
77 | + switch (ELF_ST_VISIBILITY (h->other)) | |
78 | + { | |
79 | + case STV_HIDDEN: | |
80 | + v = _("hidden symbol"); | |
81 | + break; | |
82 | + case STV_INTERNAL: | |
83 | + v = _("internal symbol"); | |
84 | + break; | |
85 | + case STV_PROTECTED: | |
86 | + v = _("protected symbol"); | |
87 | + break; | |
88 | + default: | |
89 | + v = _("symbol"); | |
90 | + break; | |
91 | + } | |
92 | + | |
93 | + (*_bfd_error_handler) | |
94 | + (_("%B: relocation R_386_GOTOFF against undefined %s `%s' can not be used when making a shared object"), | |
95 | + input_bfd, v, h->root.root.string); | |
96 | + bfd_set_error (bfd_error_bad_value); | |
97 | + return FALSE; | |
98 | + } | |
99 | + else if (!info->executable | |
100 | + && h->type == STT_FUNC | |
101 | + && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED) | |
102 | + { | |
103 | + (*_bfd_error_handler) | |
104 | + (_("%B: relocation R_386_GOTOFF against protected function `%s' can not be used when making a shared object"), | |
105 | + input_bfd, h->root.root.string); | |
106 | + bfd_set_error (bfd_error_bad_value); | |
107 | + return FALSE; | |
108 | + } | |
109 | } | |
110 | ||
111 | /* Note that sgot is not involved in this | |
112 | --- binutils/bfd/elf64-x86-64.c.bad 2008-03-15 07:28:10.000000000 -0700 | |
113 | +++ binutils/bfd/elf64-x86-64.c 2008-03-16 09:53:21.000000000 -0700 | |
114 | @@ -2615,30 +2615,63 @@ elf64_x86_64_relocate_section (bfd *outp | |
115 | case R_X86_64_PC16: | |
116 | case R_X86_64_PC32: | |
117 | if (info->shared | |
118 | - && !SYMBOL_REFERENCES_LOCAL (info, h) | |
119 | && (input_section->flags & SEC_ALLOC) != 0 | |
120 | && (input_section->flags & SEC_READONLY) != 0 | |
121 | - && (!h->def_regular | |
122 | - || r_type != R_X86_64_PC32 | |
123 | - || h->type != STT_FUNC | |
124 | - || ELF_ST_VISIBILITY (h->other) != STV_PROTECTED | |
125 | - || !is_32bit_relative_branch (contents, | |
126 | - rel->r_offset))) | |
127 | + && h != NULL) | |
128 | { | |
129 | - if (h->def_regular | |
130 | - && r_type == R_X86_64_PC32 | |
131 | - && h->type == STT_FUNC | |
132 | - && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED) | |
133 | - (*_bfd_error_handler) | |
134 | - (_("%B: relocation R_X86_64_PC32 against protected function `%s' can not be used when making a shared object"), | |
135 | - input_bfd, h->root.root.string); | |
136 | + bfd_boolean fail = FALSE; | |
137 | + bfd_boolean branch | |
138 | + = (r_type == R_X86_64_PC32 | |
139 | + && is_32bit_relative_branch (contents, rel->r_offset)); | |
140 | + | |
141 | + if (SYMBOL_REFERENCES_LOCAL (info, h)) | |
142 | + { | |
143 | + /* Symbol is referenced locally. Make sure it is | |
144 | + defined locally or for a branch. */ | |
145 | + fail = !h->def_regular && !branch; | |
146 | + } | |
147 | else | |
148 | - (*_bfd_error_handler) | |
149 | - (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), | |
150 | - input_bfd, x86_64_elf_howto_table[r_type].name, | |
151 | - h->root.root.string); | |
152 | - bfd_set_error (bfd_error_bad_value); | |
153 | - return FALSE; | |
154 | + { | |
155 | + /* Symbol isn't referenced locally. We only allow | |
156 | + branch to symbol with non-default visibility. */ | |
157 | + fail = (!branch | |
158 | + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT); | |
159 | + } | |
160 | + | |
161 | + if (fail) | |
162 | + { | |
163 | + const char *fmt; | |
164 | + const char *v; | |
165 | + const char *pic = ""; | |
166 | + | |
167 | + switch (ELF_ST_VISIBILITY (h->other)) | |
168 | + { | |
169 | + case STV_HIDDEN: | |
170 | + v = _("hidden symbol"); | |
171 | + break; | |
172 | + case STV_INTERNAL: | |
173 | + v = _("internal symbol"); | |
174 | + break; | |
175 | + case STV_PROTECTED: | |
176 | + v = _("protected symbol"); | |
177 | + break; | |
178 | + default: | |
179 | + v = _("symbol"); | |
180 | + pic = _("; recompile with -fPIC"); | |
181 | + break; | |
182 | + } | |
183 | + | |
184 | + if (h->def_regular) | |
185 | + fmt = _("%B: relocation %s against %s `%s' can not be used when making a shared object%s"); | |
186 | + else | |
187 | + fmt = _("%B: relocation %s against undefined %s `%s' can not be used when making a shared object%s"); | |
188 | + | |
189 | + (*_bfd_error_handler) (fmt, input_bfd, | |
190 | + x86_64_elf_howto_table[r_type].name, | |
191 | + v, h->root.root.string, pic); | |
192 | + bfd_set_error (bfd_error_bad_value); | |
193 | + return FALSE; | |
194 | + } | |
195 | } | |
196 | /* Fall through. */ | |
197 | ||
198 | @@ -3363,6 +3396,8 @@ elf64_x86_64_finish_dynamic_symbol (bfd | |
199 | if (info->shared | |
200 | && SYMBOL_REFERENCES_LOCAL (info, h)) | |
201 | { | |
202 | + if (!h->def_regular) | |
203 | + return FALSE; | |
204 | BFD_ASSERT((h->got.offset & 1) != 0); | |
205 | rela.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); | |
206 | rela.r_addend = (h->root.u.def.value | |
207 | --- binutils/ld/testsuite/ld-i386/hidden1.d.bad 2008-03-16 09:29:54.000000000 -0700 | |
208 | +++ binutils/ld/testsuite/ld-i386/hidden1.d 2008-03-16 09:21:52.000000000 -0700 | |
209 | @@ -0,0 +1,3 @@ | |
210 | +#as: --32 | |
211 | +#ld: -shared -melf_i386 | |
212 | +#error: .*relocation R_386_GOTOFF against undefined hidden symbol `foo' can not be used when making a shared object | |
213 | --- binutils/ld/testsuite/ld-i386/hidden1.s.bad 2008-03-16 09:29:54.000000000 -0700 | |
214 | +++ binutils/ld/testsuite/ld-i386/hidden1.s 2008-03-16 09:15:16.000000000 -0700 | |
215 | @@ -0,0 +1,9 @@ | |
216 | + .text | |
217 | +.globl bar | |
218 | + .type bar, @function | |
219 | +bar: | |
220 | + leal foo@GOTOFF(%ecx), %eax | |
221 | + ret | |
222 | + .size bar, .-bar | |
223 | + .weak foo | |
224 | + .hidden foo | |
225 | --- binutils/ld/testsuite/ld-i386/hidden2.d.bad 2008-03-16 09:29:54.000000000 -0700 | |
226 | +++ binutils/ld/testsuite/ld-i386/hidden2.d 2008-03-16 09:24:45.000000000 -0700 | |
227 | @@ -0,0 +1,13 @@ | |
228 | +#as: --32 | |
229 | +#ld: -shared -melf_i386 | |
230 | +#objdump: -drw | |
231 | + | |
232 | +.*: +file format .* | |
233 | + | |
234 | + | |
235 | +Disassembly of section .text: | |
236 | + | |
237 | +[a-f0-9]+ <bar>: | |
238 | +[ ]*[a-f0-9]+: e8 cf fe ff ff call 0 <bar-0x[a-f0-9]+> | |
239 | +[ ]*[a-f0-9]+: c3 ret | |
240 | +#pass | |
241 | --- binutils/ld/testsuite/ld-i386/hidden2.s.bad 2008-03-16 09:29:54.000000000 -0700 | |
242 | +++ binutils/ld/testsuite/ld-i386/hidden2.s 2008-03-16 09:15:28.000000000 -0700 | |
243 | @@ -0,0 +1,9 @@ | |
244 | + .text | |
245 | +.globl bar | |
246 | + .type bar, @function | |
247 | +bar: | |
248 | + call foo | |
249 | + ret | |
250 | + .size bar, .-bar | |
251 | + .weak foo | |
252 | + .hidden foo | |
253 | --- binutils/ld/testsuite/ld-i386/hidden3.d.bad 2008-03-16 09:29:54.000000000 -0700 | |
254 | +++ binutils/ld/testsuite/ld-i386/hidden3.d 2008-03-16 09:22:31.000000000 -0700 | |
255 | @@ -0,0 +1,3 @@ | |
256 | +#as: --32 | |
257 | +#ld: -shared -melf_i386 | |
258 | +#error: .*relocation R_386_GOTOFF against undefined hidden symbol `foo' can not be used when making a shared object | |
259 | --- binutils/ld/testsuite/ld-i386/hidden3.s.bad 2008-03-16 09:29:54.000000000 -0700 | |
260 | +++ binutils/ld/testsuite/ld-i386/hidden3.s 2008-03-16 09:15:44.000000000 -0700 | |
261 | @@ -0,0 +1,8 @@ | |
262 | + .text | |
263 | +.globl bar | |
264 | + .type bar, @function | |
265 | +bar: | |
266 | + leal foo@GOTOFF(%ecx), %eax | |
267 | + ret | |
268 | + .size bar, .-bar | |
269 | + .hidden foo | |
270 | --- binutils/ld/testsuite/ld-i386/i386.exp.bad 2007-08-25 07:35:38.000000000 -0700 | |
271 | +++ binutils/ld/testsuite/ld-i386/i386.exp 2008-03-16 09:29:49.000000000 -0700 | |
272 | @@ -132,3 +132,9 @@ run_dump_test "tlsie2" | |
273 | run_dump_test "tlsie3" | |
274 | run_dump_test "tlsie4" | |
275 | run_dump_test "tlsie5" | |
276 | +run_dump_test "hidden1" | |
277 | +run_dump_test "hidden2" | |
278 | +run_dump_test "hidden3" | |
279 | +run_dump_test "protected1" | |
280 | +run_dump_test "protected2" | |
281 | +run_dump_test "protected3" | |
282 | --- binutils/ld/testsuite/ld-i386/protected1.d.bad 2008-03-16 09:29:54.000000000 -0700 | |
283 | +++ binutils/ld/testsuite/ld-i386/protected1.d 2008-03-16 09:25:29.000000000 -0700 | |
284 | @@ -0,0 +1,3 @@ | |
285 | +#as: --32 | |
286 | +#ld: -shared -melf_i386 | |
287 | +#error: .*relocation R_386_GOTOFF against protected function `foo' can not be used when making a shared object | |
288 | --- binutils/ld/testsuite/ld-i386/protected1.s.bad 2008-03-16 09:29:54.000000000 -0700 | |
289 | +++ binutils/ld/testsuite/ld-i386/protected1.s 2008-03-16 09:16:13.000000000 -0700 | |
290 | @@ -0,0 +1,13 @@ | |
291 | + .text | |
292 | +.globl foo | |
293 | + .protected foo | |
294 | + .type foo, @function | |
295 | +foo: | |
296 | + ret | |
297 | + .size foo, .-foo | |
298 | +.globl bar | |
299 | + .type bar, @function | |
300 | +bar: | |
301 | + leal foo@GOTOFF(%ecx), %eax | |
302 | + ret | |
303 | + .size bar, .-bar | |
304 | --- binutils/ld/testsuite/ld-i386/protected2.d.bad 2008-03-16 09:29:54.000000000 -0700 | |
305 | +++ binutils/ld/testsuite/ld-i386/protected2.d 2008-03-16 09:25:50.000000000 -0700 | |
306 | @@ -0,0 +1,16 @@ | |
307 | +#as: --32 | |
308 | +#ld: -shared -melf_i386 | |
309 | +#objdump: -drw | |
310 | + | |
311 | +.*: +file format .* | |
312 | + | |
313 | + | |
314 | +Disassembly of section .text: | |
315 | + | |
316 | +0+[a-f0-9]+ <foo>: | |
317 | +[ ]*[a-f0-9]+: c3 ret | |
318 | + | |
319 | +0+[a-f0-9]+ <bar>: | |
320 | +[ ]*[a-f0-9]+: e8 fa ff ff ff call [a-f0-9]+ <foo> | |
321 | +[ ]*[a-f0-9]+: c3 ret | |
322 | +#pass | |
323 | --- binutils/ld/testsuite/ld-i386/protected2.s.bad 2008-03-16 09:29:54.000000000 -0700 | |
324 | +++ binutils/ld/testsuite/ld-i386/protected2.s 2008-03-16 09:16:23.000000000 -0700 | |
325 | @@ -0,0 +1,13 @@ | |
326 | + .text | |
327 | +.globl foo | |
328 | + .protected foo | |
329 | + .type foo, @function | |
330 | +foo: | |
331 | + ret | |
332 | + .size foo, .-foo | |
333 | +.globl bar | |
334 | + .type bar, @function | |
335 | +bar: | |
336 | + call foo | |
337 | + ret | |
338 | + .size bar, .-bar | |
339 | --- binutils/ld/testsuite/ld-i386/protected3.d.bad 2008-03-16 09:29:54.000000000 -0700 | |
340 | +++ binutils/ld/testsuite/ld-i386/protected3.d 2008-03-16 09:27:44.000000000 -0700 | |
341 | @@ -0,0 +1,13 @@ | |
342 | +#as: --32 | |
343 | +#ld: -shared -melf_i386 | |
344 | +#objdump: -drw | |
345 | + | |
346 | +.*: +file format .* | |
347 | + | |
348 | + | |
349 | +Disassembly of section .text: | |
350 | + | |
351 | +0+[a-f0-9]+ <bar>: | |
352 | +[ ]*[a-f0-9]+: 8b 81 0c 00 00 00 mov 0x[a-f0-9]+\(%ecx\),%eax | |
353 | +[ ]*[a-f0-9]+: c3 ret | |
354 | +#pass | |
355 | --- binutils/ld/testsuite/ld-i386/protected3.s.bad 2008-03-16 09:29:54.000000000 -0700 | |
356 | +++ binutils/ld/testsuite/ld-i386/protected3.s 2008-03-16 09:23:40.000000000 -0700 | |
357 | @@ -0,0 +1,15 @@ | |
358 | + .protected foo | |
359 | +.globl foo | |
360 | + .data | |
361 | + .align 4 | |
362 | + .type foo, @object | |
363 | + .size foo, 4 | |
364 | +foo: | |
365 | + .long 1 | |
366 | + .text | |
367 | +.globl bar | |
368 | + .type bar, @function | |
369 | +bar: | |
370 | + movl foo@GOTOFF(%ecx), %eax | |
371 | + ret | |
372 | + .size bar, .-bar | |
373 | --- binutils/ld/testsuite/ld-x86-64/hidden1.d.bad 2008-03-16 08:42:41.000000000 -0700 | |
374 | +++ binutils/ld/testsuite/ld-x86-64/hidden1.d 2008-03-16 08:30:02.000000000 -0700 | |
375 | @@ -0,0 +1,3 @@ | |
376 | +#as: --64 | |
377 | +#ld: -shared -melf_x86_64 | |
378 | +#error: .*relocation R_X86_64_PC32 against undefined hidden symbol `foo' can not be used when making a shared object | |
379 | --- binutils/ld/testsuite/ld-x86-64/hidden1.s.bad 2008-03-16 08:42:41.000000000 -0700 | |
380 | +++ binutils/ld/testsuite/ld-x86-64/hidden1.s 2008-03-16 08:26:19.000000000 -0700 | |
381 | @@ -0,0 +1,9 @@ | |
382 | + .text | |
383 | +.globl bar | |
384 | + .type bar, @function | |
385 | +bar: | |
386 | + leaq foo(%rip), %rax | |
387 | + ret | |
388 | + .size bar, .-bar | |
389 | + .weak foo | |
390 | + .hidden foo | |
391 | --- binutils/ld/testsuite/ld-x86-64/hidden2.d.bad 2008-03-16 08:42:41.000000000 -0700 | |
392 | +++ binutils/ld/testsuite/ld-x86-64/hidden2.d 2008-03-16 08:37:01.000000000 -0700 | |
393 | @@ -0,0 +1,13 @@ | |
394 | +#as: --64 | |
395 | +#ld: -shared -melf_x86_64 | |
396 | +#objdump: -drw | |
397 | + | |
398 | +.*: +file format .* | |
399 | + | |
400 | + | |
401 | +Disassembly of section .text: | |
402 | + | |
403 | +[a-f0-9]+ <bar>: | |
404 | +[ ]*[a-f0-9]+: e8 33 fe ff ff callq 0 <bar-0x[a-f0-9]+> | |
405 | +[ ]*[a-f0-9]+: c3 retq | |
406 | +#pass | |
407 | --- binutils/ld/testsuite/ld-x86-64/hidden2.s.bad 2008-03-16 08:42:41.000000000 -0700 | |
408 | +++ binutils/ld/testsuite/ld-x86-64/hidden2.s 2008-03-16 08:26:28.000000000 -0700 | |
409 | @@ -0,0 +1,9 @@ | |
410 | + .text | |
411 | +.globl bar | |
412 | + .type bar, @function | |
413 | +bar: | |
414 | + call foo | |
415 | + ret | |
416 | + .size bar, .-bar | |
417 | + .weak foo | |
418 | + .hidden foo | |
419 | --- binutils/ld/testsuite/ld-x86-64/hidden3.d.bad 2008-03-16 08:42:41.000000000 -0700 | |
420 | +++ binutils/ld/testsuite/ld-x86-64/hidden3.d 2008-03-16 08:30:14.000000000 -0700 | |
421 | @@ -0,0 +1,3 @@ | |
422 | +#as: --64 | |
423 | +#ld: -shared -melf_x86_64 | |
424 | +#error: .*relocation R_X86_64_PC32 against undefined hidden symbol `foo' can not be used when making a shared object | |
425 | --- binutils/ld/testsuite/ld-x86-64/hidden3.s.bad 2008-03-16 08:42:41.000000000 -0700 | |
426 | +++ binutils/ld/testsuite/ld-x86-64/hidden3.s 2008-03-16 08:26:37.000000000 -0700 | |
427 | @@ -0,0 +1,8 @@ | |
428 | + .text | |
429 | +.globl bar | |
430 | + .type bar, @function | |
431 | +bar: | |
432 | + leaq foo(%rip), %rax | |
433 | + ret | |
434 | + .size bar, .-bar | |
435 | + .hidden foo | |
436 | --- binutils/ld/testsuite/ld-x86-64/protected1.d.bad 2008-03-16 08:42:41.000000000 -0700 | |
437 | +++ binutils/ld/testsuite/ld-x86-64/protected1.d 2008-03-16 08:38:21.000000000 -0700 | |
438 | @@ -0,0 +1,3 @@ | |
439 | +#as: --64 | |
440 | +#ld: -shared -melf_x86_64 | |
441 | +#error: .*relocation R_X86_64_PC32 against protected symbol `foo' can not be used when making a shared object | |
442 | --- binutils/ld/testsuite/ld-x86-64/protected1.s.bad 2008-03-16 08:42:41.000000000 -0700 | |
443 | +++ binutils/ld/testsuite/ld-x86-64/protected1.s 2008-03-16 08:27:04.000000000 -0700 | |
444 | @@ -0,0 +1,13 @@ | |
445 | + .text | |
446 | +.globl foo | |
447 | + .protected foo | |
448 | + .type foo, @function | |
449 | +foo: | |
450 | + ret | |
451 | + .size foo, .-foo | |
452 | +.globl bar | |
453 | + .type bar, @function | |
454 | +bar: | |
455 | + leaq foo(%rip), %rax | |
456 | + ret | |
457 | + .size bar, .-bar | |
458 | --- binutils/ld/testsuite/ld-x86-64/protected2.d.bad 2008-03-16 08:42:41.000000000 -0700 | |
459 | +++ binutils/ld/testsuite/ld-x86-64/protected2.d 2008-03-16 08:40:09.000000000 -0700 | |
460 | @@ -0,0 +1,16 @@ | |
461 | +#as: --64 | |
462 | +#ld: -shared -melf_x86_64 | |
463 | +#objdump: -drw | |
464 | + | |
465 | +.*: +file format .* | |
466 | + | |
467 | + | |
468 | +Disassembly of section .text: | |
469 | + | |
470 | +0+[a-f0-9]+ <foo>: | |
471 | +[ ]*[a-f0-9]+: c3 retq | |
472 | + | |
473 | +0+[a-f0-9]+ <bar>: | |
474 | +[ ]*[a-f0-9]+: e8 fa ff ff ff callq [a-f0-9]+ <foo> | |
475 | +[ ]*[a-f0-9]+: c3 retq | |
476 | +#pass | |
477 | --- binutils/ld/testsuite/ld-x86-64/protected2.s.bad 2008-03-16 08:42:41.000000000 -0700 | |
478 | +++ binutils/ld/testsuite/ld-x86-64/protected2.s 2008-03-16 08:27:15.000000000 -0700 | |
479 | @@ -0,0 +1,13 @@ | |
480 | + .text | |
481 | +.globl foo | |
482 | + .protected foo | |
483 | + .type foo, @function | |
484 | +foo: | |
485 | + ret | |
486 | + .size foo, .-foo | |
487 | +.globl bar | |
488 | + .type bar, @function | |
489 | +bar: | |
490 | + call foo | |
491 | + ret | |
492 | + .size bar, .-bar | |
493 | --- binutils/ld/testsuite/ld-x86-64/protected3.d.bad 2008-03-16 08:42:41.000000000 -0700 | |
494 | +++ binutils/ld/testsuite/ld-x86-64/protected3.d 2008-03-16 08:42:03.000000000 -0700 | |
495 | @@ -0,0 +1,13 @@ | |
496 | +#as: --64 | |
497 | +#ld: -shared -melf_x86_64 | |
498 | +#objdump: -drw | |
499 | + | |
500 | +.*: +file format .* | |
501 | + | |
502 | + | |
503 | +Disassembly of section .text: | |
504 | + | |
505 | +0+[a-f0-9]+ <bar>: | |
506 | +[ ]*[a-f0-9]+: 8b 05 ce 00 20 00 mov 0x[a-f0-9]+\(%rip\),%eax # [a-f0-9]+ <foo> | |
507 | +[ ]*[a-f0-9]+: c3 retq | |
508 | +#pass | |
509 | --- binutils/ld/testsuite/ld-x86-64/protected3.s.bad 2008-03-16 08:42:41.000000000 -0700 | |
510 | +++ binutils/ld/testsuite/ld-x86-64/protected3.s 2008-03-16 08:27:29.000000000 -0700 | |
511 | @@ -0,0 +1,15 @@ | |
512 | + .protected foo | |
513 | +.globl foo | |
514 | + .data | |
515 | + .align 4 | |
516 | + .type foo, @object | |
517 | + .size foo, 4 | |
518 | +foo: | |
519 | + .long 1 | |
520 | + .text | |
521 | +.globl bar | |
522 | + .type bar, @function | |
523 | +bar: | |
524 | + movl foo(%rip), %eax | |
525 | + ret | |
526 | + .size bar, .-bar | |
527 | --- binutils/ld/testsuite/ld-x86-64/x86-64.exp.bad 2007-08-25 07:35:38.000000000 -0700 | |
528 | +++ binutils/ld/testsuite/ld-x86-64/x86-64.exp 2008-03-16 09:30:07.000000000 -0700 | |
529 | @@ -86,3 +86,9 @@ run_dump_test "tlsgd2" | |
530 | run_dump_test "tlsgd3" | |
531 | run_dump_test "tlsie2" | |
532 | run_dump_test "tlsie3" | |
533 | +run_dump_test "hidden1" | |
534 | +run_dump_test "hidden2" | |
535 | +run_dump_test "hidden3" | |
536 | +run_dump_test "protected1" | |
537 | +run_dump_test "protected2" | |
538 | +run_dump_test "protected3" | |
539 |