Subtract GOT base only with a base register
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 12 Jun 2016 03:44:24 +0000 (20:44 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 12 Jun 2016 04:24:01 +0000 (21:24 -0700)
commit74d7f0aa5b1e27da215349fb32337e1d83aca7d7
tree87a0960c2945a4840eee0fa1be88e8c9db639f1c
parent0a41a307caca19383b05c8b558c25cf888c1c3f0
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.
bfd/ChangeLog
bfd/elf32-i386.c
ld/ChangeLog
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pr20244-1.s [new file with mode: 0644]
ld/testsuite/ld-i386/pr20244-1a.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr20244-1b.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr20244-1c.d [new file with mode: 0644]