diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-02-03 08:25:15 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-02-03 08:25:15 -0800 |
commit | 0cb4071ef9e10f703220f5e731141bf438aca16e (patch) | |
tree | 273468cc997e953c37aff7edc3179a716ff3e372 /gas/testsuite | |
parent | 3d8efabf21cfeb2f6244fadcf915da4c7f51ed6f (diff) | |
download | gdb-0cb4071ef9e10f703220f5e731141bf438aca16e.zip gdb-0cb4071ef9e10f703220f5e731141bf438aca16e.tar.gz gdb-0cb4071ef9e10f703220f5e731141bf438aca16e.tar.bz2 |
Add -mrelax-relocations= to x86 assembler
The x86 relax relocations introduced in binutils 2.26 aren't supported
by linker on Solaris older than Solaris 12. To use x86 assembler with
older Solaris linker, this patch adds
1. A command line option -mrelax-relocations= to x86 assembler to
control whether to generate relax relocations.
2. A configure option --enable-x86-relax-relocations to decide whether
x86 assembler should generate relax relocations by default. It is
defaulted to yes, except for x86 Solaris targets older than Solaris 12.
gas/
PR gas/19520
* NEWS: Mention new command line option -mrelax-relocations and
new configure option --enable-x86-relax-relocations for x86
target.
* config.in: Regenerated.
* configure.ac: Add --enable-x86-relax-relocations.
(ac_default_x86_relax_relocations): New. Default to 1 except
for x86 Solaris targets older than Solaris 12.
(DEFAULT_GENERATE_X86_RELAX_RELOCATIONS): Define.
* configure: Likewise.
* config/tc-i386.c (generate_relax_relocations): New.
(OPTION_MRELAX_RELOCATIONS): Likewise.
(output_disp): Don't generate relax relocations if
generate_relax_relocations is 0.
(md_longopts): Add -mrelax-relocations.
(md_show_usage): Likewise.
(md_parse_option): Handle OPTION_MRELAX_RELOCATIONS.
* doc/c-i386.texi: Document -mrelax-relocations=.
* testsuite/gas/i386/got-no-relax.d: New file.
* testsuite/gas/i386/x86-64-gotpcrel-no-relax.d: Likewise.
* testsuite/gas/i386/got.d: Pass -mrelax-relocations=yes to as.
* testsuite/gas/i386/localpic.d: Likewise.
* testsuite/gas/i386/mixed-mode-reloc32.d: Likewise.
* testsuite/gas/i386/reloc32.d: Likewise.
* testsuite/gas/i386/x86-64-gotpcrel.d: Likewise.
* testsuite/gas/i386/x86-64-localpic.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-gotpcrel.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-localpic.d: Likewise.
* testsuite/gas/i386/i386.exp: Run got-no-relax and
x86-64-gotpcrel-no-relax.
ld/
PR gas/19520
* testsuite/ld-i386/branch1.d: Pass -mrelax-relocations=yes to as.
* testsuite/ld-i386/call1.d: Likewise.
* testsuite/ld-i386/call2.d: Likewise.
* testsuite/ld-i386/call3a.d: Likewise.
* testsuite/ld-i386/call3b.d: Likewise.
* testsuite/ld-i386/call3c.d: Likewise.
* testsuite/ld-i386/call3d.d: Likewise.
* testsuite/ld-i386/call3e.d: Likewise.
* testsuite/ld-i386/call3f.d: Likewise.
* testsuite/ld-i386/call3g.d: Likewise.
* testsuite/ld-i386/call3h.d: Likewise.
* testsuite/ld-i386/jmp1.d: Likewise.
* testsuite/ld-i386/jmp2.d: Likewise.
* testsuite/ld-i386/lea1c.d: Likewise.
* testsuite/ld-i386/load1.d: Likewise.
* testsuite/ld-i386/load2.d: Likewise.
* testsuite/ld-i386/load3.d: Likewise.
* testsuite/ld-i386/load4a.d: Likewise.
* testsuite/ld-i386/load5a.d: Likewise.
* testsuite/ld-i386/mov2b.d: Likewise.
* testsuite/ld-i386/mov3.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
* testsuite/ld-x86-64/call1a.d: Likewise.
* testsuite/ld-x86-64/call1b.d: Likewise.
* testsuite/ld-x86-64/call1c.d: Likewise.
* testsuite/ld-x86-64/call1d.d: Likewise.
* testsuite/ld-x86-64/call1e.d: Likewise.
* testsuite/ld-x86-64/call1f.d: Likewise.
* testsuite/ld-x86-64/call1h.d: Likewise.
* testsuite/ld-x86-64/call1i.d: Likewise.
* testsuite/ld-x86-64/load1a.d: Likewise.
* testsuite/ld-x86-64/load1b.d: Likewise.
* testsuite/ld-i386/got1a.S: Load GOT into %ecx and use it.
* testsuite/ld-i386/got1.dd: Updated.
* testsuite/ld-i386/got1d.S (1): Removed.
* testsuite/ld-i386/i386.exp: Add -Wa,-mrelax-relocations=yes.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/i386/got-no-relax.d | 31 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/got.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/ilp32/x86-64-gotpcrel.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/ilp32/x86-64-localpic.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/localpic.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/mixed-mode-reloc32.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/reloc32.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-gotpcrel-no-relax.d | 27 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-gotpcrel.d | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-localpic.d | 1 |
11 files changed, 68 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/got-no-relax.d b/gas/testsuite/gas/i386/got-no-relax.d new file mode 100644 index 0000000..6bf138a --- /dev/null +++ b/gas/testsuite/gas/i386/got-no-relax.d @@ -0,0 +1,31 @@ +#source: got.s +#as: -mrelax-relocations=no +#objdump: -dwr + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: b8 00 00 00 00 mov \$0x0,%eax 1: R_386_GOT32 foo +[ ]*[a-f0-9]+: 8b 05 00 00 00 00 mov 0x0,%eax 7: R_386_GOT32X foo +[ ]*[a-f0-9]+: 8b 80 00 00 00 00 mov 0x0\(%eax\),%eax d: R_386_GOT32 foo +[ ]*[a-f0-9]+: 05 00 00 00 00 add \$0x0,%eax 12: R_386_GOT32 foo +[ ]*[a-f0-9]+: 03 05 00 00 00 00 add 0x0,%eax 18: R_386_GOT32X foo +[ ]*[a-f0-9]+: 03 80 00 00 00 00 add 0x0\(%eax\),%eax 1e: R_386_GOT32 foo +[ ]*[a-f0-9]+: ff 15 00 00 00 00 call \*0x0 24: R_386_GOT32X foo +[ ]*[a-f0-9]+: ff 90 00 00 00 00 call \*0x0\(%eax\) 2a: R_386_GOT32 foo +[ ]*[a-f0-9]+: ff 25 00 00 00 00 jmp \*0x0 30: R_386_GOT32X foo +[ ]*[a-f0-9]+: ff a0 00 00 00 00 jmp \*0x0\(%eax\) 36: R_386_GOT32 foo +[ ]*[a-f0-9]+: b8 00 00 00 00 mov \$0x0,%eax 3b: R_386_GOT32 foo +[ ]*[a-f0-9]+: 8b 05 00 00 00 00 mov 0x0,%eax 41: R_386_GOT32X foo +[ ]*[a-f0-9]+: 8b 80 00 00 00 00 mov 0x0\(%eax\),%eax 47: R_386_GOT32 foo +[ ]*[a-f0-9]+: 05 00 00 00 00 add \$0x0,%eax 4c: R_386_GOT32 foo +[ ]*[a-f0-9]+: 03 05 00 00 00 00 add 0x0,%eax 52: R_386_GOT32X foo +[ ]*[a-f0-9]+: 03 80 00 00 00 00 add 0x0\(%eax\),%eax 58: R_386_GOT32 foo +[ ]*[a-f0-9]+: ff 90 00 00 00 00 call \*0x0\(%eax\) 5e: R_386_GOT32 foo +[ ]*[a-f0-9]+: ff 15 00 00 00 00 call \*0x0 64: R_386_GOT32X foo +[ ]*[a-f0-9]+: ff a0 00 00 00 00 jmp \*0x0\(%eax\) 6a: R_386_GOT32 foo +[ ]*[a-f0-9]+: ff 25 00 00 00 00 jmp \*0x0 70: R_386_GOT32X foo +#pass diff --git a/gas/testsuite/gas/i386/got.d b/gas/testsuite/gas/i386/got.d index f76ca47..7621cdf 100644 --- a/gas/testsuite/gas/i386/got.d +++ b/gas/testsuite/gas/i386/got.d @@ -1,3 +1,4 @@ +#as: -mrelax-relocations=yes #objdump: -dwr .*: +file format .* diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index b9144c4..22aca23 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -408,6 +408,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "relax-4" run_dump_test "got" + run_dump_test "got-no-relax" if {![istarget "*-*-nacl*"]} then { run_dump_test "iamcu-1" @@ -788,6 +789,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_list_test "x86-64-branch-3" "-al -mintel64" run_dump_test "x86-64-gotpcrel" + run_dump_test "x86-64-gotpcrel-no-relax" } set ASFLAGS "$old_ASFLAGS" diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-gotpcrel.d b/gas/testsuite/gas/i386/ilp32/x86-64-gotpcrel.d index e5a3b1c..1314e5b 100644 --- a/gas/testsuite/gas/i386/ilp32/x86-64-gotpcrel.d +++ b/gas/testsuite/gas/i386/ilp32/x86-64-gotpcrel.d @@ -1,4 +1,5 @@ #source: ../x86-64-gotpcrel.s +#as: --x32 -mrelax-relocations=yes #objdump: -dwr #name: x86-64 (ILP32) gotpcrel diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-localpic.d b/gas/testsuite/gas/i386/ilp32/x86-64-localpic.d index 0ca69c7..a9528a2 100644 --- a/gas/testsuite/gas/i386/ilp32/x86-64-localpic.d +++ b/gas/testsuite/gas/i386/ilp32/x86-64-localpic.d @@ -1,4 +1,5 @@ #source: ../x86-64-localpic.s +#as: --x32 -mrelax-relocations=yes #readelf: -rsW #name: x86-64 (ILP32) local PIC diff --git a/gas/testsuite/gas/i386/localpic.d b/gas/testsuite/gas/i386/localpic.d index 04fb5ce..0a5eec5 100644 --- a/gas/testsuite/gas/i386/localpic.d +++ b/gas/testsuite/gas/i386/localpic.d @@ -1,3 +1,4 @@ +#as: -mrelax-relocations=yes #readelf: -rs #name: i386 local PIC diff --git a/gas/testsuite/gas/i386/mixed-mode-reloc32.d b/gas/testsuite/gas/i386/mixed-mode-reloc32.d index 9affc36..a2ef6a0 100644 --- a/gas/testsuite/gas/i386/mixed-mode-reloc32.d +++ b/gas/testsuite/gas/i386/mixed-mode-reloc32.d @@ -1,3 +1,4 @@ +#as: -mrelax-relocations=yes #objdump: -r #source: mixed-mode-reloc.s #name: x86 mixed mode relocs (32-bit object) diff --git a/gas/testsuite/gas/i386/reloc32.d b/gas/testsuite/gas/i386/reloc32.d index 45c9cd2..b6e1bbd 100644 --- a/gas/testsuite/gas/i386/reloc32.d +++ b/gas/testsuite/gas/i386/reloc32.d @@ -1,3 +1,4 @@ +#as: -mrelax-relocations=yes #objdump: -Drw #name: i386 relocs diff --git a/gas/testsuite/gas/i386/x86-64-gotpcrel-no-relax.d b/gas/testsuite/gas/i386/x86-64-gotpcrel-no-relax.d new file mode 100644 index 0000000..a3f8943 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-gotpcrel-no-relax.d @@ -0,0 +1,27 @@ +#source: x86-64-gotpcrel.s +#as: -mrelax-relocations=no +#objdump: -dwr + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 48 c7 c0 00 00 00 00 mov \$0x0,%rax 3: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: 48 8b 04 25 00 00 00 00 mov 0x0,%rax b: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: 48 8b 05 00 00 00 00 mov 0x0\(%rip\),%rax # 16 <_start\+0x16> 12: R_X86_64_GOTPCREL foo-0x4 +[ ]*[a-f0-9]+: 48 8b 81 00 00 00 00 mov 0x0\(%rcx\),%rax 19: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: ff 15 00 00 00 00 callq \*0x0\(%rip\) # 23 <_start\+0x23> 1f: R_X86_64_GOTPCREL foo-0x4 +[ ]*[a-f0-9]+: ff 90 00 00 00 00 callq \*0x0\(%rax\) 25: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: ff 25 00 00 00 00 jmpq \*0x0\(%rip\) # 2f <_start\+0x2f> 2b: R_X86_64_GOTPCREL foo-0x4 +[ ]*[a-f0-9]+: ff a1 00 00 00 00 jmpq \*0x0\(%rcx\) 31: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: 48 c7 c0 00 00 00 00 mov \$0x0,%rax 38: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: 48 8b 04 25 00 00 00 00 mov 0x0,%rax 40: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: 48 8b 05 00 00 00 00 mov 0x0\(%rip\),%rax # 4b <_start\+0x4b> 47: R_X86_64_GOTPCREL foo-0x4 +[ ]*[a-f0-9]+: 48 8b 81 00 00 00 00 mov 0x0\(%rcx\),%rax 4e: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: ff 15 00 00 00 00 callq \*0x0\(%rip\) # 58 <_start\+0x58> 54: R_X86_64_GOTPCREL foo-0x4 +[ ]*[a-f0-9]+: ff 90 00 00 00 00 callq \*0x0\(%rax\) 5a: R_X86_64_GOTPCREL foo +[ ]*[a-f0-9]+: ff 25 00 00 00 00 jmpq \*0x0\(%rip\) # 64 <_start\+0x64> 60: R_X86_64_GOTPCREL foo-0x4 +[ ]*[a-f0-9]+: ff a1 00 00 00 00 jmpq \*0x0\(%rcx\) 66: R_X86_64_GOTPCREL foo +#pass diff --git a/gas/testsuite/gas/i386/x86-64-gotpcrel.d b/gas/testsuite/gas/i386/x86-64-gotpcrel.d index 6ca3fc7..fbe5e47 100644 --- a/gas/testsuite/gas/i386/x86-64-gotpcrel.d +++ b/gas/testsuite/gas/i386/x86-64-gotpcrel.d @@ -1,3 +1,4 @@ +#as: -mrelax-relocations=yes #objdump: -dwr .*: +file format .* diff --git a/gas/testsuite/gas/i386/x86-64-localpic.d b/gas/testsuite/gas/i386/x86-64-localpic.d index 0a07149..bafaa9c 100644 --- a/gas/testsuite/gas/i386/x86-64-localpic.d +++ b/gas/testsuite/gas/i386/x86-64-localpic.d @@ -1,3 +1,4 @@ +#as: -mrelax-relocations=yes #readelf: -rsW #name: x86-64 local PIC |