From b9519cfe9828b9ee5a73e74b4be83d46f33e6886 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 19 Dec 2018 12:21:56 -0800 Subject: x86: Properly handle PLT expression in directive For PLT expressions, we should subtract the PLT relocation size only for jump instructions. Since PLT relocations are PC relative, we only allow "symbol@PLT" in PLT expression. gas/ PR gas/23997 * config/tc-i386.c (x86_cons): Check for invalid PLT expression. (md_apply_fix): Subtract the PLT relocation size only for jump instructions. * testsuite/gas/i386/reloc32.s: Add test for invalid PLT expression. * testsuite/gas/i386/reloc64.s: Likewise. * testsuite/gas/i386/ilp32/reloc64.s: Likewise. * testsuite/gas/i386/reloc32.l: Updated. * testsuite/gas/i386/reloc64.l: Likewise. * testsuite/gas/i386/ilp32/reloc64.l: Likewise. ld/ PR gas/23997 * testsuite/ld-i386/i386.exp: Run PR gas/23997 test. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/pr23997a.s: New file. * testsuite/ld-x86-64/pr23997b.c: Likewise. * testsuite/ld-x86-64/pr23997c.c: Likewise. --- ld/testsuite/ld-i386/i386.exp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ld/testsuite/ld-i386') diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index f86a54d..b3c489a 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -1420,6 +1420,15 @@ if { [isnative] "pr22842" \ "pass.out" \ ] \ + [list \ + "Run pr23997" \ + "" \ + "" \ + { ../ld-x86-64/pr23997a.s ../ld-x86-64/pr23997b.c \ + ../ld-x86-64/pr23997c.c } \ + "pr23997" \ + "pass.out" \ + ] \ ] if { [at_least_gcc_version 5 0] } { -- cgit v1.1