binutils-gdb/ld/testsuite/ld-i386/pr20244-1a.d
H.J. Lu 74d7f0aa5b Subtract GOT base only with a base register
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.
2016-06-11 21:24:01 -07:00

27 lines
522 B
Makefile

#source: pr20244-1.s
#as: --32
#ld: -m elf_i386
#objdump: --sym -dw
#notarget: i?86-*-nacl* x86_64-*-nacl*
.*: +file format .*
SYMBOL TABLE:
#...
0+80490a0 l O .data 00000001 bar
#...
0+8048074 g F .text 00000000 _start
#...
0+80490a1 g O .data 00000001 foo
#...
Disassembly of section .text:
0+8048074 <_start>:
+[a-f0-9]+: c7 05 8c 90 04 08 00 00 00 00 movl \$0x0,0x804908c
+[a-f0-9]+: 83 3d 90 90 04 08 00 cmpl \$0x0,0x8049090
+[a-f0-9]+: b9 f8 ff ff ff mov \$0xfffffff8,%ecx
#pass