GNU Binutils with patches for OS216
Revisión | 8dcea93252a9ea7dff57e85220a719e2a5e8ab41 (tree) |
---|---|
Tiempo | 2015-05-15 19:30:53 |
Autor | H.J. Lu <hjl.tools@gmai...> |
Commiter | H.J. Lu |
Add -mshared option to x86 ELF assembler
This patch adds -mshared option to x86 ELF assembler. By default,
assembler will optimize out non-PLT relocations against defined non-weak
global branch targets with default visibility. The -mshared option tells
the assembler to generate code which may go into a shared library
where all non-weak global branch targets with default visibility can
be preempted. The resulting code is slightly bigger. This option
only affects the handling of branch instructions.
This Linux kernel patch is needed to create a working x86 Linux kernel if
it hasn't been applied:
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index ae6588b..b91a00c 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -339,8 +339,8 @@ early_idt_handlers:
-/* This is global to keep gas from relaxing the jumps */
-ENTRY(early_idt_handler)
+/* This is weak to keep gas from relaxing the jumps */
+WEAK(early_idt_handler)
--
gas/
* config/tc-i386.c (shared): New.
(OPTION_MSHARED): Likewise.
(elf_symbol_resolved_in_segment_p): Add relocation argument.
Check PLT relocations and shared.
(md_estimate_size_before_relax): Pass fragP->fr_var to
elf_symbol_resolved_in_segment_p.
(md_longopts): Add -mshared.
(md_show_usage): Likewise.
(md_parse_option): Handle OPTION_MSHARED.
* doc/c-i386.texi: Document -mshared.
gas/testsuite/
* gas/i386/i386.exp: Don't run pcrel for ELF targets. Run
pcrel-elf, relax-4 and x86-64-relax-3 for ELF targets.
* gas/i386/pcrel-elf.d: New file.
* gas/i386/relax-4.d: Likewise.
* gas/i386/x86-64-relax-3.d: Likewise.
* gas/i386/relax-3.d: Pass -mshared to assembler. Updated.
* gas/i386/x86-64-relax-2.d: Likewise.
* gas/i386/relax-3.s: Add test for PLT relocation.
@@ -1,3 +1,16 @@ | ||
1 | +2015-05-15 H.J. Lu <hongjiu.lu@intel.com> | |
2 | + | |
3 | + * config/tc-i386.c (shared): New. | |
4 | + (OPTION_MSHARED): Likewise. | |
5 | + (elf_symbol_resolved_in_segment_p): Add relocation argument. | |
6 | + Check PLT relocations and shared. | |
7 | + (md_estimate_size_before_relax): Pass fragP->fr_var to | |
8 | + elf_symbol_resolved_in_segment_p. | |
9 | + (md_longopts): Add -mshared. | |
10 | + (md_show_usage): Likewise. | |
11 | + (md_parse_option): Handle OPTION_MSHARED. | |
12 | + * doc/c-i386.texi: Document -mshared. | |
13 | + | |
1 | 14 | 2015-05-14 H.J. Lu <hongjiu.lu@intel.com> |
2 | 15 | |
3 | 16 | * write.c (compress_debug): Don't write the zlib header, which |
@@ -524,6 +524,11 @@ static enum x86_elf_abi x86_elf_abi = I386_ABI; | ||
524 | 524 | static int use_big_obj = 0; |
525 | 525 | #endif |
526 | 526 | |
527 | +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) | |
528 | +/* 1 if generating code for a shared library. */ | |
529 | +static int shared = 0; | |
530 | +#endif | |
531 | + | |
527 | 532 | /* 1 for intel syntax, |
528 | 533 | 0 if att syntax. */ |
529 | 534 | static int intel_syntax = 0; |
@@ -8818,7 +8823,7 @@ i386_frag_max_var (fragS *frag) | ||
8818 | 8823 | |
8819 | 8824 | #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) |
8820 | 8825 | static int |
8821 | -elf_symbol_resolved_in_segment_p (symbolS *fr_symbol) | |
8826 | +elf_symbol_resolved_in_segment_p (symbolS *fr_symbol, offsetT fr_var) | |
8822 | 8827 | { |
8823 | 8828 | /* STT_GNU_IFUNC symbol must go through PLT. */ |
8824 | 8829 | if ((symbol_get_bfdsym (fr_symbol)->flags |
@@ -8829,9 +8834,24 @@ elf_symbol_resolved_in_segment_p (symbolS *fr_symbol) | ||
8829 | 8834 | /* Symbol may be weak or local. */ |
8830 | 8835 | return !S_IS_WEAK (fr_symbol); |
8831 | 8836 | |
8837 | + /* Global symbols with non-default visibility can't be preempted. */ | |
8838 | + if (ELF_ST_VISIBILITY (S_GET_OTHER (fr_symbol)) != STV_DEFAULT) | |
8839 | + return 1; | |
8840 | + | |
8841 | + if (fr_var != NO_RELOC) | |
8842 | + switch ((enum bfd_reloc_code_real) fr_var) | |
8843 | + { | |
8844 | + case BFD_RELOC_386_PLT32: | |
8845 | + case BFD_RELOC_X86_64_PLT32: | |
8846 | + /* Symbol with PLT relocatin may be preempted. */ | |
8847 | + return 0; | |
8848 | + default: | |
8849 | + abort (); | |
8850 | + } | |
8851 | + | |
8832 | 8852 | /* Global symbols with default visibility in a shared library may be |
8833 | 8853 | preempted by another definition. */ |
8834 | - return ELF_ST_VISIBILITY (S_GET_OTHER (fr_symbol)) != STV_DEFAULT; | |
8854 | + return !shared; | |
8835 | 8855 | } |
8836 | 8856 | #endif |
8837 | 8857 |
@@ -8858,7 +8878,8 @@ md_estimate_size_before_relax (fragS *fragP, segT segment) | ||
8858 | 8878 | if (S_GET_SEGMENT (fragP->fr_symbol) != segment |
8859 | 8879 | #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) |
8860 | 8880 | || (IS_ELF |
8861 | - && !elf_symbol_resolved_in_segment_p (fragP->fr_symbol)) | |
8881 | + && !elf_symbol_resolved_in_segment_p (fragP->fr_symbol, | |
8882 | + fragP->fr_var)) | |
8862 | 8883 | #endif |
8863 | 8884 | #if defined (OBJ_COFF) && defined (TE_PE) |
8864 | 8885 | || (OUTPUT_FLAVOR == bfd_target_coff_flavour |
@@ -9528,6 +9549,7 @@ const char *md_shortopts = "qn"; | ||
9528 | 9549 | #define OPTION_MBIG_OBJ (OPTION_MD_BASE + 18) |
9529 | 9550 | #define OPTION_OMIT_LOCK_PREFIX (OPTION_MD_BASE + 19) |
9530 | 9551 | #define OPTION_MEVEXRCIG (OPTION_MD_BASE + 20) |
9552 | +#define OPTION_MSHARED (OPTION_MD_BASE + 21) | |
9531 | 9553 | |
9532 | 9554 | struct option md_longopts[] = |
9533 | 9555 | { |
@@ -9538,6 +9560,7 @@ struct option md_longopts[] = | ||
9538 | 9560 | #endif |
9539 | 9561 | #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) |
9540 | 9562 | {"x32", no_argument, NULL, OPTION_X32}, |
9563 | + {"mshared", no_argument, NULL, OPTION_MSHARED}, | |
9541 | 9564 | #endif |
9542 | 9565 | {"divide", no_argument, NULL, OPTION_DIVIDE}, |
9543 | 9566 | {"march", required_argument, NULL, OPTION_MARCH}, |
@@ -9598,6 +9621,10 @@ md_parse_option (int c, char *arg) | ||
9598 | 9621 | /* -s: On i386 Solaris, this tells the native assembler to use |
9599 | 9622 | .stab instead of .stab.excl. We always use .stab anyhow. */ |
9600 | 9623 | break; |
9624 | + | |
9625 | + case OPTION_MSHARED: | |
9626 | + shared = 1; | |
9627 | + break; | |
9601 | 9628 | #endif |
9602 | 9629 | #if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \ |
9603 | 9630 | || defined (TE_PE) || defined (TE_PEP) || defined (OBJ_MACH_O)) |
@@ -10027,6 +10054,8 @@ md_show_usage (FILE *stream) | ||
10027 | 10054 | -mold-gcc support old (<= 2.8.1) versions of gcc\n")); |
10028 | 10055 | fprintf (stream, _("\ |
10029 | 10056 | -madd-bnd-prefix add BND prefix for all valid branches\n")); |
10057 | + fprintf (stream, _("\ | |
10058 | + -mshared disable branch optimization for shared code\n")); | |
10030 | 10059 | # if defined (TE_PE) || defined (TE_PEP) |
10031 | 10060 | fprintf (stream, _("\ |
10032 | 10061 | -mbig-obj generate big object files\n")); |
@@ -298,6 +298,17 @@ The @code{.att_syntax} and @code{.intel_syntax} directives will take precedent. | ||
298 | 298 | This option forces the assembler to add BND prefix to all branches, even |
299 | 299 | if such prefix was not explicitly specified in the source code. |
300 | 300 | |
301 | +@cindex @samp{-mshared} option, i386 | |
302 | +@cindex @samp{-mshared} option, x86-64 | |
303 | +@item -mno-shared | |
304 | +On ELF target, the assembler normally optimizes out non-PLT relocations | |
305 | +against defined non-weak global branch targets with default visibility. | |
306 | +The @samp{-mshared} option tells the assembler to generate code which | |
307 | +may go into a shared library where all non-weak global branch targets | |
308 | +with default visibility can be preempted. The resulting code is | |
309 | +slightly bigger. This option only affects the handling of branch | |
310 | +instructions. | |
311 | + | |
301 | 312 | @cindex @samp{-mbig-obj} option, x86-64 |
302 | 313 | @item -mbig-obj |
303 | 314 | On x86-64 PE/COFF target this option forces the use of big object file |
@@ -1,3 +1,14 @@ | ||
1 | +2015-05-15 H.J. Lu <hongjiu.lu@intel.com> | |
2 | + | |
3 | + * gas/i386/i386.exp: Don't run pcrel for ELF targets. Run | |
4 | + pcrel-elf, relax-4 and x86-64-relax-3 for ELF targets. | |
5 | + * gas/i386/pcrel-elf.d: New file. | |
6 | + * gas/i386/relax-4.d: Likewise. | |
7 | + * gas/i386/x86-64-relax-3.d: Likewise. | |
8 | + * gas/i386/relax-3.d: Pass -mshared to assembler. Updated. | |
9 | + * gas/i386/x86-64-relax-2.d: Likewise. | |
10 | + * gas/i386/relax-3.s: Add test for PLT relocation. | |
11 | + | |
1 | 12 | 2015-05-14 Peter Bergner <bergner@vnet.ibm.com> |
2 | 13 | |
3 | 14 | * gas/ppc/power4.d: Add a slbia test. |
@@ -352,8 +352,10 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] | ||
352 | 352 | # but the relocs we currently produce are slightly different |
353 | 353 | # from those produced for ELF/COFF based toolchains. |
354 | 354 | # So for now we ignore PE targets. |
355 | - run_dump_test "pcrel" | |
356 | 355 | run_dump_test "absrel" |
356 | + if {[istarget "*-*-coff*"]} then { | |
357 | + run_dump_test "pcrel" | |
358 | + } | |
357 | 359 | } |
358 | 360 | |
359 | 361 | # ELF specific tests |
@@ -361,6 +363,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] | ||
361 | 363 | # PIC is only supported on ELF targets. |
362 | 364 | run_dump_test "intelpic" |
363 | 365 | |
366 | + run_dump_test "pcrel-elf" | |
364 | 367 | run_dump_test "relax" |
365 | 368 | run_dump_test "gotpc" |
366 | 369 | run_dump_test "tlsd" |
@@ -396,6 +399,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] | ||
396 | 399 | run_dump_test "note" |
397 | 400 | |
398 | 401 | run_dump_test "relax-3" |
402 | + run_dump_test "relax-4" | |
399 | 403 | |
400 | 404 | if {![istarget "*-*-nacl*"]} then { |
401 | 405 | run_dump_test "iamcu-1" |
@@ -763,6 +767,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t | ||
763 | 767 | run_list_test "x86-64-size-inval-1" "-al" |
764 | 768 | |
765 | 769 | run_dump_test "x86-64-relax-2" |
770 | + run_dump_test "x86-64-relax-3" | |
766 | 771 | |
767 | 772 | run_dump_test "x86-64-jump" |
768 | 773 | } |
@@ -0,0 +1,52 @@ | ||
1 | +#source: pcrel.s | |
2 | +#as: -mshared | |
3 | +#objdump: -drw | |
4 | +#name: i386 pcrel ELF reloc | |
5 | + | |
6 | +.*: +file format .*i386.* | |
7 | + | |
8 | +Disassembly of section \.text: | |
9 | + | |
10 | +0+ <loc>: | |
11 | +[ ]*[a-f0-9]+: e9 30 12 00 00 jmp 1235 <abs\+0x1> 1: R_386_PC32 \*ABS\* | |
12 | + | |
13 | +0+5 <glob>: | |
14 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 6 <glob\+0x1> 6: R_386_PC32 ext | |
15 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp b <glob\+0x6> b: R_386_PC32 weak | |
16 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 10 <glob\+0xb> 10: R_386_PC32 comm | |
17 | +[ ]*[a-f0-9]+: eb ea jmp 0 <loc> | |
18 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 17 <glob\+0x12> 17: R_386_PC32 glob | |
19 | +[ ]*[a-f0-9]+: e9 72 98 00 00 jmp 9892 <abs2\+0x1c> 1c: R_386_PC32 \*ABS\* | |
20 | +[ ]*[a-f0-9]+: e9 db 00 00 00 jmp 100 <loc2> | |
21 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 26 <glob\+0x21> 26: R_386_PC32 glob2 | |
22 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 2b <glob\+0x26> 2b: R_386_PC32 .data | |
23 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 34 <glob\+0x2f> 30: R_386_PC32 .data | |
24 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 35 <glob\+0x30> 35: R_386_PC32 \*ABS\* | |
25 | +[ ]*[a-f0-9]+: e9 c8 ed ff ff jmp ffffee06 <abs2\+0xffff5590> 3a: R_386_PC32 ext | |
26 | +[ ]*[a-f0-9]+: e9 c8 ed ff ff jmp ffffee0b <abs2\+0xffff5595> 3f: R_386_PC32 weak | |
27 | +[ ]*[a-f0-9]+: e9 c8 ed ff ff jmp ffffee10 <abs2\+0xffff559a> 44: R_386_PC32 comm | |
28 | +[ ]*[a-f0-9]+: e9 7f ed ff ff jmp ffffedcc <abs2\+0xffff5556> | |
29 | +[ ]*[a-f0-9]+: e9 c8 ed ff ff jmp ffffee1a <abs2\+0xffff55a4> 4e: R_386_PC32 glob | |
30 | +[ ]*[a-f0-9]+: e9 3e 86 00 00 jmp 8695 <abs\+0x7461> 53: R_386_PC32 \*ABS\* | |
31 | +[ ]*[a-f0-9]+: e9 70 ee ff ff jmp ffffeecc <abs2\+0xffff5656> | |
32 | +[ ]*[a-f0-9]+: e9 c8 ed ff ff jmp ffffee29 <abs2\+0xffff55b3> 5d: R_386_PC32 glob2 | |
33 | +[ ]*[a-f0-9]+: e9 c8 ed ff ff jmp ffffee2e <abs2\+0xffff55b8> 62: R_386_PC32 .data | |
34 | +[ ]*[a-f0-9]+: e9 cc ed ff ff jmp ffffee37 <abs2\+0xffff55c1> 67: R_386_PC32 .data | |
35 | +[ ]*[a-f0-9]+: e9 ba 79 ff ff jmp ffff7a2a <abs2\+0xfffee1b4> 6c: R_386_PC32 \*ABS\* | |
36 | +[ ]*[a-f0-9]+: e9 86 67 ff ff jmp ffff67fb <abs2\+0xfffecf85> 71: R_386_PC32 ext | |
37 | +[ ]*[a-f0-9]+: e9 86 67 ff ff jmp ffff6800 <abs2\+0xfffecf8a> 76: R_386_PC32 weak | |
38 | +[ ]*[a-f0-9]+: e9 86 67 ff ff jmp ffff6805 <abs2\+0xfffecf8f> 7b: R_386_PC32 comm | |
39 | +[ ]*[a-f0-9]+: e9 06 67 ff ff jmp ffff678a <abs2\+0xfffecf14> | |
40 | +[ ]*[a-f0-9]+: e9 06 67 ff ff jmp ffff678f <abs2\+0xfffecf19> | |
41 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 8a <glob\+0x85> 8a: R_386_PC32 \*ABS\* | |
42 | +[ ]*[a-f0-9]+: e9 f7 67 ff ff jmp ffff688a <abs2\+0xfffed014> | |
43 | +[ ]*[a-f0-9]+: e9 f7 67 ff ff jmp ffff688f <abs2\+0xfffed019> | |
44 | +[ ]*[a-f0-9]+: e9 86 67 ff ff jmp ffff6823 <abs2\+0xfffecfad> 99: R_386_PC32 .data | |
45 | +[ ]*[a-f0-9]+: e9 8a 67 ff ff jmp ffff682c <abs2\+0xfffecfb6> 9e: R_386_PC32 .data | |
46 | +[ ]*[a-f0-9]+: e9 fc 00 00 00 jmp 1a3 <glob2\+0x9e> a3: R_386_PC32 \*ABS\* | |
47 | +[ ]*[a-f0-9]+: e9 01 00 00 00 jmp ad <glob\+0xa8> a8: R_386_PC32 \*ABS\* | |
48 | +[ ]*[a-f0-9]+: e9 01 ff ff ff jmp ffffffb2 <abs2\+0xffff673c> ad: R_386_PC32 \*ABS\* | |
49 | +[ ]*[a-f0-9]+: e9 01 01 00 00 jmp 1b7 <glob2\+0xb2> b2: R_386_PC32 \*ABS\* | |
50 | +[ ]*[a-f0-9]+: e9 01 00 00 00 jmp bc <glob\+0xb7> b7: R_386_PC32 \*ABS\* | |
51 | + ... | |
52 | +#pass |
@@ -1,3 +1,4 @@ | ||
1 | +#as: -mshared | |
1 | 2 | #objdump: -dwr |
2 | 3 | |
3 | 4 | .*: +file format .* |
@@ -5,26 +6,27 @@ | ||
5 | 6 | Disassembly of section .text: |
6 | 7 | |
7 | 8 | 0+ <foo>: |
8 | -[ ]*[a-f0-9]+: eb 1f jmp 21 <local> | |
9 | -[ ]*[a-f0-9]+: eb 19 jmp 1d <hidden_def> | |
10 | -[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 5 <foo\+0x5> 5: (R_386_PC)?(DISP)?32 global_def | |
11 | -[ ]*[a-f0-9]+: e9 fc ff ff ff jmp a <foo\+0xa> a: (R_386_PC)?(DISP)?32 weak_def | |
12 | -[ ]*[a-f0-9]+: e9 fc ff ff ff jmp f <foo\+0xf> f: (R_386_PC)?(DISP)?32 weak_hidden_undef | |
13 | -[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 14 <foo\+0x14> 14: (R_386_PC)?(DISP)?32 weak_hidden_def | |
14 | -[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 19 <foo\+0x19> 19: (R_386_PC)?(DISP)?32 hidden_undef | |
15 | - | |
16 | -0+1d <hidden_def>: | |
9 | +[ ]*[a-f0-9]+: eb 24 jmp 26 <local> | |
10 | +[ ]*[a-f0-9]+: eb 1e jmp 22 <hidden_def> | |
11 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 5 <foo\+0x5> 5: R_386_PC32 global_def | |
12 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp a <foo\+0xa> a: R_386_PLT32 global_def | |
13 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp f <foo\+0xf> f: R_386_PC32 weak_def | |
14 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 14 <foo\+0x14> 14: R_386_PC32 weak_hidden_undef | |
15 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 19 <foo\+0x19> 19: R_386_PC32 weak_hidden_def | |
16 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 1e <foo\+0x1e> 1e: R_386_PC32 hidden_undef | |
17 | + | |
18 | +0+22 <hidden_def>: | |
17 | 19 | [ ]*[a-f0-9]+: c3 ret |
18 | 20 | |
19 | -0+1e <weak_hidden_def>: | |
21 | +0+23 <weak_hidden_def>: | |
20 | 22 | [ ]*[a-f0-9]+: c3 ret |
21 | 23 | |
22 | -0+1f <global_def>: | |
24 | +0+24 <global_def>: | |
23 | 25 | [ ]*[a-f0-9]+: c3 ret |
24 | 26 | |
25 | -0+20 <weak_def>: | |
27 | +0+25 <weak_def>: | |
26 | 28 | [ ]*[a-f0-9]+: c3 ret |
27 | 29 | |
28 | -0+21 <local>: | |
30 | +0+26 <local>: | |
29 | 31 | [ ]*[a-f0-9]+: c3 ret |
30 | 32 | #pass |
@@ -4,6 +4,7 @@ foo: | ||
4 | 4 | jmp local |
5 | 5 | jmp hidden_def |
6 | 6 | jmp global_def |
7 | + jmp global_def@PLT | |
7 | 8 | jmp weak_def |
8 | 9 | jmp weak_hidden_undef |
9 | 10 | jmp weak_hidden_def |
@@ -0,0 +1,32 @@ | ||
1 | +#source: relax-3.s | |
2 | +#objdump: -dwr | |
3 | + | |
4 | +.*: +file format .* | |
5 | + | |
6 | +Disassembly of section .text: | |
7 | + | |
8 | +0+ <foo>: | |
9 | +[ ]*[a-f0-9]+: eb 21 jmp 23 <local> | |
10 | +[ ]*[a-f0-9]+: eb 1b jmp 1f <hidden_def> | |
11 | +[ ]*[a-f0-9]+: eb 1b jmp 21 <global_def> | |
12 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 7 <foo\+0x7> 7: R_386_PLT32 global_def | |
13 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp c <foo\+0xc> c: R_386_PC32 weak_def | |
14 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 11 <foo\+0x11> 11: R_386_PC32 weak_hidden_undef | |
15 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 16 <foo\+0x16> 16: R_386_PC32 weak_hidden_def | |
16 | +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 1b <foo\+0x1b> 1b: R_386_PC32 hidden_undef | |
17 | + | |
18 | +0+1f <hidden_def>: | |
19 | +[ ]*[a-f0-9]+: c3 ret | |
20 | + | |
21 | +0+20 <weak_hidden_def>: | |
22 | +[ ]*[a-f0-9]+: c3 ret | |
23 | + | |
24 | +0+21 <global_def>: | |
25 | +[ ]*[a-f0-9]+: c3 ret | |
26 | + | |
27 | +0+22 <weak_def>: | |
28 | +[ ]*[a-f0-9]+: c3 ret | |
29 | + | |
30 | +0+23 <local>: | |
31 | +[ ]*[a-f0-9]+: c3 ret | |
32 | +#pass |
@@ -1,4 +1,5 @@ | ||
1 | 1 | #source: relax-3.s |
2 | +#as: -mshared | |
2 | 3 | #objdump: -dwr |
3 | 4 | |
4 | 5 | .*: +file format .* |
@@ -7,26 +8,27 @@ | ||
7 | 8 | Disassembly of section .text: |
8 | 9 | |
9 | 10 | 0+ <foo>: |
10 | -[ ]*[a-f0-9]+: eb 1f jmp 21 <local> | |
11 | -[ ]*[a-f0-9]+: eb 19 jmp 1d <hidden_def> | |
11 | +[ ]*[a-f0-9]+: eb 24 jmp 26 <local> | |
12 | +[ ]*[a-f0-9]+: eb 1e jmp 22 <hidden_def> | |
12 | 13 | [ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 9 <foo\+0x9> 5: R_X86_64_PC32 global_def-0x4 |
13 | -[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq e <foo\+0xe> a: R_X86_64_PC32 weak_def-0x4 | |
14 | -[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 13 <foo\+0x13> f: R_X86_64_PC32 weak_hidden_undef-0x4 | |
15 | -[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 18 <foo\+0x18> 14: R_X86_64_PC32 weak_hidden_def-0x4 | |
16 | -[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 1d <hidden_def> 19: R_X86_64_PC32 hidden_undef-0x4 | |
14 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq e <foo\+0xe> a: R_X86_64_PLT32 global_def-0x4 | |
15 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 13 <foo\+0x13> f: R_X86_64_PC32 weak_def-0x4 | |
16 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 18 <foo\+0x18> 14: R_X86_64_PC32 weak_hidden_undef-0x4 | |
17 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 1d <foo\+0x1d> 19: R_X86_64_PC32 weak_hidden_def-0x4 | |
18 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 22 <hidden_def> 1e: R_X86_64_PC32 hidden_undef-0x4 | |
17 | 19 | |
18 | -0+1d <hidden_def>: | |
20 | +0+22 <hidden_def>: | |
19 | 21 | [ ]*[a-f0-9]+: c3 retq |
20 | 22 | |
21 | -0+1e <weak_hidden_def>: | |
23 | +0+23 <weak_hidden_def>: | |
22 | 24 | [ ]*[a-f0-9]+: c3 retq |
23 | 25 | |
24 | -0+1f <global_def>: | |
26 | +0+24 <global_def>: | |
25 | 27 | [ ]*[a-f0-9]+: c3 retq |
26 | 28 | |
27 | -0+20 <weak_def>: | |
29 | +0+25 <weak_def>: | |
28 | 30 | [ ]*[a-f0-9]+: c3 retq |
29 | 31 | |
30 | -0+21 <local>: | |
32 | +0+26 <local>: | |
31 | 33 | [ ]*[a-f0-9]+: c3 retq |
32 | 34 | #pass |
@@ -0,0 +1,33 @@ | ||
1 | +#source: relax-3.s | |
2 | +#objdump: -dwr | |
3 | + | |
4 | +.*: +file format .* | |
5 | + | |
6 | + | |
7 | +Disassembly of section .text: | |
8 | + | |
9 | +0+ <foo>: | |
10 | +[ ]*[a-f0-9]+: eb 21 jmp 23 <local> | |
11 | +[ ]*[a-f0-9]+: eb 1b jmp 1f <hidden_def> | |
12 | +[ ]*[a-f0-9]+: eb 1b jmp 21 <global_def> | |
13 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq b <foo\+0xb> 7: R_X86_64_PLT32 global_def-0x4 | |
14 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 10 <foo\+0x10> c: R_X86_64_PC32 weak_def-0x4 | |
15 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 15 <foo\+0x15> 11: R_X86_64_PC32 weak_hidden_undef-0x4 | |
16 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 1a <foo\+0x1a> 16: R_X86_64_PC32 weak_hidden_def-0x4 | |
17 | +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 1f <hidden_def> 1b: R_X86_64_PC32 hidden_undef-0x4 | |
18 | + | |
19 | +0+1f <hidden_def>: | |
20 | +[ ]*[a-f0-9]+: c3 retq | |
21 | + | |
22 | +0+20 <weak_hidden_def>: | |
23 | +[ ]*[a-f0-9]+: c3 retq | |
24 | + | |
25 | +0+21 <global_def>: | |
26 | +[ ]*[a-f0-9]+: c3 retq | |
27 | + | |
28 | +0+22 <weak_def>: | |
29 | +[ ]*[a-f0-9]+: c3 retq | |
30 | + | |
31 | +0+23 <local>: | |
32 | +[ ]*[a-f0-9]+: c3 retq | |
33 | +#pass |