mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-03-07 13:39:43 +08:00
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.
56 lines
2.4 KiB
Makefile
56 lines
2.4 KiB
Makefile
#source: load1.s
|
|
#as: --64 -mrelax-relocations=yes
|
|
#ld: -melf_x86_64
|
|
#objdump: -dw --sym
|
|
#notarget: x86_64-*-nacl*
|
|
|
|
.*: +file format .*
|
|
|
|
SYMBOL TABLE:
|
|
#...
|
|
0+6001b8 l O .data 0+1 bar
|
|
#...
|
|
0+6001b9 g O .data 0+1 foo
|
|
#...
|
|
|
|
Disassembly of section .text:
|
|
|
|
0+4000b0 <_start>:
|
|
[ ]*[a-f0-9]+: 81 d0 b8 01 60 00 adc \$0x6001b8,%eax
|
|
[ ]*[a-f0-9]+: 81 c3 b8 01 60 00 add \$0x6001b8,%ebx
|
|
[ ]*[a-f0-9]+: 81 e1 b8 01 60 00 and \$0x6001b8,%ecx
|
|
[ ]*[a-f0-9]+: 81 fa b8 01 60 00 cmp \$0x6001b8,%edx
|
|
[ ]*[a-f0-9]+: 81 ce b8 01 60 00 or \$0x6001b8,%esi
|
|
[ ]*[a-f0-9]+: 81 df b8 01 60 00 sbb \$0x6001b8,%edi
|
|
[ ]*[a-f0-9]+: 81 ed b8 01 60 00 sub \$0x6001b8,%ebp
|
|
[ ]*[a-f0-9]+: 41 81 f0 b8 01 60 00 xor \$0x6001b8,%r8d
|
|
[ ]*[a-f0-9]+: 41 f7 c7 b8 01 60 00 test \$0x6001b8,%r15d
|
|
[ ]*[a-f0-9]+: 48 81 d0 b8 01 60 00 adc \$0x6001b8,%rax
|
|
[ ]*[a-f0-9]+: 48 81 c3 b8 01 60 00 add \$0x6001b8,%rbx
|
|
[ ]*[a-f0-9]+: 48 81 e1 b8 01 60 00 and \$0x6001b8,%rcx
|
|
[ ]*[a-f0-9]+: 48 81 fa b8 01 60 00 cmp \$0x6001b8,%rdx
|
|
[ ]*[a-f0-9]+: 48 81 cf b8 01 60 00 or \$0x6001b8,%rdi
|
|
[ ]*[a-f0-9]+: 48 81 de b8 01 60 00 sbb \$0x6001b8,%rsi
|
|
[ ]*[a-f0-9]+: 48 81 ed b8 01 60 00 sub \$0x6001b8,%rbp
|
|
[ ]*[a-f0-9]+: 49 81 f0 b8 01 60 00 xor \$0x6001b8,%r8
|
|
[ ]*[a-f0-9]+: 49 f7 c7 b8 01 60 00 test \$0x6001b8,%r15
|
|
[ ]*[a-f0-9]+: 81 d0 b9 01 60 00 adc \$0x6001b9,%eax
|
|
[ ]*[a-f0-9]+: 81 c3 b9 01 60 00 add \$0x6001b9,%ebx
|
|
[ ]*[a-f0-9]+: 81 e1 b9 01 60 00 and \$0x6001b9,%ecx
|
|
[ ]*[a-f0-9]+: 81 fa b9 01 60 00 cmp \$0x6001b9,%edx
|
|
[ ]*[a-f0-9]+: 81 ce b9 01 60 00 or \$0x6001b9,%esi
|
|
[ ]*[a-f0-9]+: 81 df b9 01 60 00 sbb \$0x6001b9,%edi
|
|
[ ]*[a-f0-9]+: 81 ed b9 01 60 00 sub \$0x6001b9,%ebp
|
|
[ ]*[a-f0-9]+: 41 81 f0 b9 01 60 00 xor \$0x6001b9,%r8d
|
|
[ ]*[a-f0-9]+: 41 f7 c7 b9 01 60 00 test \$0x6001b9,%r15d
|
|
[ ]*[a-f0-9]+: 48 81 d0 b9 01 60 00 adc \$0x6001b9,%rax
|
|
[ ]*[a-f0-9]+: 48 81 c3 b9 01 60 00 add \$0x6001b9,%rbx
|
|
[ ]*[a-f0-9]+: 48 81 e1 b9 01 60 00 and \$0x6001b9,%rcx
|
|
[ ]*[a-f0-9]+: 48 81 fa b9 01 60 00 cmp \$0x6001b9,%rdx
|
|
[ ]*[a-f0-9]+: 48 81 cf b9 01 60 00 or \$0x6001b9,%rdi
|
|
[ ]*[a-f0-9]+: 48 81 de b9 01 60 00 sbb \$0x6001b9,%rsi
|
|
[ ]*[a-f0-9]+: 48 81 ed b9 01 60 00 sub \$0x6001b9,%rbp
|
|
[ ]*[a-f0-9]+: 49 81 f0 b9 01 60 00 xor \$0x6001b9,%r8
|
|
[ ]*[a-f0-9]+: 49 f7 c7 b9 01 60 00 test \$0x6001b9,%r15
|
|
#pass
|