aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-01-13 05:42:11 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-01-13 05:42:27 -0800
commit844bf810cf9feebe50772c29d72256ec3c872270 (patch)
tree8f5b2e5910362329d797430702357726d8763e9a /gas/testsuite
parent5347ed60c50b79958f83963bd7d01da0372c339b (diff)
downloadbinutils-844bf810cf9feebe50772c29d72256ec3c872270.zip
binutils-844bf810cf9feebe50772c29d72256ec3c872270.tar.gz
binutils-844bf810cf9feebe50772c29d72256ec3c872270.tar.bz2
x86: Don't generate GOT_symbol for PLT relocations
Don't generate the _GLOBAL_OFFSET_TABLE_ symbol for PLT relocations since it isn't needed. PR gas/27178 * config/tc-i386.c (lex_got::gotrel): Add need_GOT_symbol. Don't generate GOT_symbol for PLT relocations. * testsuite/gas/i386/i386.exp: Run PR gas/27178 tests. * testsuite/gas/i386/no-got.d: New file. * testsuite/gas/i386/no-got.s: Likewise. * testsuite/gas/i386/x86-64-no-got.d: Likewise. * testsuite/gas/i386/x86-64-no-got.s: Likewise.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/i386/i386.exp4
-rw-r--r--gas/testsuite/gas/i386/no-got.d17
-rw-r--r--gas/testsuite/gas/i386/no-got.s5
-rw-r--r--gas/testsuite/gas/i386/x86-64-no-got.d17
-rw-r--r--gas/testsuite/gas/i386/x86-64-no-got.s5
5 files changed, 48 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 3b8a734..c9bca8a 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -645,6 +645,8 @@ if [gas_32_check] then {
run_dump_test "got"
run_dump_test "got-no-relax"
+ run_dump_test "no-got"
+
run_dump_test "addend"
run_dump_test "nop-3"
run_dump_test "nop-4"
@@ -1262,6 +1264,8 @@ if [gas_64_check] then {
run_dump_test "x86-64-gotpcrel-no-relax"
run_dump_test "x86-64-gotpcrel-2"
+ run_dump_test "x86-64-no-got"
+
run_dump_test "x86-64-addend"
run_dump_test "x86-64-nop-3"
run_dump_test "x86-64-nop-4"
diff --git a/gas/testsuite/gas/i386/no-got.d b/gas/testsuite/gas/i386/no-got.d
new file mode 100644
index 0000000..3dac832
--- /dev/null
+++ b/gas/testsuite/gas/i386/no-got.d
@@ -0,0 +1,17 @@
+#objdump: -drwt
+#name: i386 no-GOT
+
+.*: +file format .*
+
+SYMBOL TABLE:
+0+ g F .text 00000000 foo
+0+ \*UND\* 00000000 bar
+
+
+
+Disassembly of section .text:
+
+0+ <foo>:
+ +[a-f0-9]+: e9 fc ff ff ff jmp 1 <foo\+0x1> 1: R_386_PLT32 bar
+ +[a-f0-9]+: e8 fc ff ff ff call 6 <foo\+0x6> 6: R_386_PLT32 bar
+#pass
diff --git a/gas/testsuite/gas/i386/no-got.s b/gas/testsuite/gas/i386/no-got.s
new file mode 100644
index 0000000..9ffad27
--- /dev/null
+++ b/gas/testsuite/gas/i386/no-got.s
@@ -0,0 +1,5 @@
+ .global foo
+ .type foo, @function
+foo:
+ jmp bar@PLT
+ call bar@PLT
diff --git a/gas/testsuite/gas/i386/x86-64-no-got.d b/gas/testsuite/gas/i386/x86-64-no-got.d
new file mode 100644
index 0000000..f09f3b1
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-no-got.d
@@ -0,0 +1,17 @@
+#objdump: -drwt
+#name: x86-64 no-GOT
+
+.*: +file format .*
+
+SYMBOL TABLE:
+0+ g F .text 0000000000000000 foo
+0+ \*UND\* 0000000000000000 bar
+
+
+
+Disassembly of section .text:
+
+0+ <foo>:
+ +[a-f0-9]+: e9 00 00 00 00 jmp 5 <foo\+0x5> 1: R_X86_64_PLT32 bar-0x4
+ +[a-f0-9]+: e8 00 00 00 00 call a <foo\+0xa> 6: R_X86_64_PLT32 bar-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-no-got.s b/gas/testsuite/gas/i386/x86-64-no-got.s
new file mode 100644
index 0000000..9ffad27
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-no-got.s
@@ -0,0 +1,5 @@
+ .global foo
+ .type foo, @function
+foo:
+ jmp bar@PLT
+ call bar@PLT