mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-31 05:44:41 +08:00
Preserve addend for R_386_GOT32 and R_X86_64_GOT32
We should preserve addend for R_386_GOT32 and R_X86_64_GOT32 as in "movl $foo@GOT + 4, %eax" and "movq $foo@GOT + 4, %rax". PR gas/19600 * config/tc-i386.c (md_apply_fix): Preserve addend for BFD_RELOC_386_GOT32 and BFD_RELOC_X86_64_GOT32. * testsuite/gas/i386/addend.d: New file. * testsuite/gas/i386/addend.s: Likewise. * testsuite/gas/i386/x86-64-addend.d: Likewise. * testsuite/gas/i386/x86-64-addend.s: Likewise. * testsuite/gas/i386/i386.exp: Run addend and x86-64-addend. * testsuite/gas/i386/reloc32.d: Updated.
This commit is contained in:
@ -1,3 +1,15 @@
|
|||||||
|
2016-05-20 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR gas/19600
|
||||||
|
* config/tc-i386.c (md_apply_fix): Preserve addend for
|
||||||
|
BFD_RELOC_386_GOT32 and BFD_RELOC_X86_64_GOT32.
|
||||||
|
* testsuite/gas/i386/addend.d: New file.
|
||||||
|
* testsuite/gas/i386/addend.s: Likewise.
|
||||||
|
* testsuite/gas/i386/x86-64-addend.d: Likewise.
|
||||||
|
* testsuite/gas/i386/x86-64-addend.s: Likewise.
|
||||||
|
* testsuite/gas/i386/i386.exp: Run addend and x86-64-addend.
|
||||||
|
* testsuite/gas/i386/reloc32.d: Updated.
|
||||||
|
|
||||||
2016-05-20 Maciej W. Rozycki <macro@imgtec.com>
|
2016-05-20 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
* config/tc-mips.c (append_insn): Correct the encoding of a
|
* config/tc-mips.c (append_insn): Correct the encoding of a
|
||||||
|
@ -9341,11 +9341,6 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
|
|||||||
fixP->fx_done = 0;
|
fixP->fx_done = 0;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case BFD_RELOC_386_GOT32:
|
|
||||||
case BFD_RELOC_X86_64_GOT32:
|
|
||||||
value = 0; /* Fully resolved at runtime. No addend. */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BFD_RELOC_VTABLE_INHERIT:
|
case BFD_RELOC_VTABLE_INHERIT:
|
||||||
case BFD_RELOC_VTABLE_ENTRY:
|
case BFD_RELOC_VTABLE_ENTRY:
|
||||||
fixP->fx_done = 0;
|
fixP->fx_done = 0;
|
||||||
|
14
gas/testsuite/gas/i386/addend.d
Normal file
14
gas/testsuite/gas/i386/addend.d
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#as: -mrelax-relocations=yes
|
||||||
|
#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]+: b8 04 00 00 00 mov \$0x4,%eax 6: R_386_GOT32 foo
|
||||||
|
[ ]*[a-f0-9]+: b8 00 00 00 00 mov \$0x0,%eax b: R_386_GOT32 foo
|
||||||
|
[ ]*[a-f0-9]+: b8 04 00 00 00 mov \$0x4,%eax 10: R_386_GOT32 foo
|
||||||
|
#pass
|
9
gas/testsuite/gas/i386/addend.s
Normal file
9
gas/testsuite/gas/i386/addend.s
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.text
|
||||||
|
_start:
|
||||||
|
movl $foo@GOT, %eax
|
||||||
|
movl $foo@GOT + 4, %eax
|
||||||
|
|
||||||
|
.intel_syntax noprefix
|
||||||
|
|
||||||
|
mov eax, offset foo@got
|
||||||
|
mov eax, offset foo@got + 4
|
@ -412,6 +412,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
|
|||||||
run_dump_test "got"
|
run_dump_test "got"
|
||||||
run_dump_test "got-no-relax"
|
run_dump_test "got-no-relax"
|
||||||
|
|
||||||
|
run_dump_test "addend"
|
||||||
|
|
||||||
if {![istarget "*-*-nacl*"]} then {
|
if {![istarget "*-*-nacl*"]} then {
|
||||||
run_dump_test "iamcu-1"
|
run_dump_test "iamcu-1"
|
||||||
run_dump_test "iamcu-2"
|
run_dump_test "iamcu-2"
|
||||||
@ -797,6 +799,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
|
|||||||
|
|
||||||
run_dump_test "x86-64-gotpcrel"
|
run_dump_test "x86-64-gotpcrel"
|
||||||
run_dump_test "x86-64-gotpcrel-no-relax"
|
run_dump_test "x86-64-gotpcrel-no-relax"
|
||||||
|
|
||||||
|
run_dump_test "x86-64-addend"
|
||||||
}
|
}
|
||||||
|
|
||||||
set ASFLAGS "$old_ASFLAGS"
|
set ASFLAGS "$old_ASFLAGS"
|
||||||
|
@ -68,4 +68,6 @@ Disassembly of section \.data:
|
|||||||
.*[ ]+R_386_PC8[ ]+xtrn
|
.*[ ]+R_386_PC8[ ]+xtrn
|
||||||
#...
|
#...
|
||||||
.*[ ]+R_386_GOT32[ ]+xtrn
|
.*[ ]+R_386_GOT32[ ]+xtrn
|
||||||
|
#...
|
||||||
.*[ ]+R_386_GOT32[ ]+xtrn
|
.*[ ]+R_386_GOT32[ ]+xtrn
|
||||||
|
#pass
|
||||||
|
14
gas/testsuite/gas/i386/x86-64-addend.d
Normal file
14
gas/testsuite/gas/i386/x86-64-addend.d
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#as: -mrelax-relocations=yes
|
||||||
|
#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_GOT32 foo
|
||||||
|
[ ]*[a-f0-9]+: 48 c7 c0 00 00 00 00 mov \$0x0,%rax a: R_X86_64_GOT32 foo\+0x4
|
||||||
|
[ ]*[a-f0-9]+: 48 c7 c0 00 00 00 00 mov \$0x0,%rax 11: R_X86_64_GOT32 foo
|
||||||
|
[ ]*[a-f0-9]+: 48 c7 c0 00 00 00 00 mov \$0x0,%rax 18: R_X86_64_GOT32 foo\+0x4
|
||||||
|
#pass
|
9
gas/testsuite/gas/i386/x86-64-addend.s
Normal file
9
gas/testsuite/gas/i386/x86-64-addend.s
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.text
|
||||||
|
_start:
|
||||||
|
movq $foo@GOT, %rax
|
||||||
|
movq $foo@GOT + 4, %rax
|
||||||
|
|
||||||
|
.intel_syntax noprefix
|
||||||
|
|
||||||
|
mov rax, offset foo@got
|
||||||
|
mov rax, offset foo@got + 4
|
Reference in New Issue
Block a user