mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-18 23:03:29 +08:00
74d7f0aa5b
When relocating R_386_GOT32 in "op $0, bar@GOT", we shouldn't subtract GOT base without a base register and we should disallow it without a base register for PIC. bfd/ PR ld/20244 * elf32-i386.c (elf_i386_relocate_section): When relocating R_386_GOT32, return error without a base register for PIC and subtract the .got.plt section address only with a base register. ld/ PR ld/20244 * testsuite/ld-i386/i386.exp: Run pr20244-1a and pr20244-1b. * testsuite/ld-i386/pr20244-1.s: New file. * testsuite/ld-i386/pr20244-1a.d: Likewise. * testsuite/ld-i386/pr20244-1b.d: Likewise. * testsuite/ld-i386/pr20244-1c.d: Likewise.
18 lines
235 B
ArmAsm
18 lines
235 B
ArmAsm
.data
|
|
.type bar, @object
|
|
bar:
|
|
.byte 1
|
|
.size bar, .-bar
|
|
.globl foo
|
|
.type foo, @object
|
|
foo:
|
|
.byte 1
|
|
.size foo, .-foo
|
|
.text
|
|
.globl _start
|
|
.type _start, @function
|
|
_start:
|
|
movl $0, bar@GOT
|
|
cmpl $0, foo@GOT
|
|
movl $bar@GOT, %ecx
|