[binutils-gdb] ld: Add -Bsymbolic-functions tests

H.J. Lu hjl@sourceware.org
Sun May 24 03:56:45 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=309cae1f7bbb6c4de0234e9f592d7dad3d6c61ba

commit 309cae1f7bbb6c4de0234e9f592d7dad3d6c61ba
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 23 20:49:16 2020 -0700

    ld: Add -Bsymbolic-functions tests
    
            PR ld/26018
            * testsuite/ld-i386/i386.exp: Add a -Bsymbolic-functions test.
            * testsuite/ld-x86-64/x86-64.exp: Likewise.
            * testsuite/ld-i386/pr26018.d: New file.
            * testsuite/ld-x86-64/pr26018.d: Likewise.
            * testsuite/ld-x86-64/pr26018.s: Likewise.

Diff:
---
 ld/ChangeLog                      |  9 +++++++++
 ld/testsuite/ld-i386/i386.exp     |  1 +
 ld/testsuite/ld-i386/pr26018.d    | 16 ++++++++++++++++
 ld/testsuite/ld-x86-64/pr26018.d  | 15 +++++++++++++++
 ld/testsuite/ld-x86-64/pr26018.s  |  7 +++++++
 ld/testsuite/ld-x86-64/x86-64.exp |  1 +
 6 files changed, 49 insertions(+)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index d12f3727ff1..0a2efa13053 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2020-05-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/26018
+	* testsuite/ld-i386/i386.exp: Add a -Bsymbolic-functions test.
+	* testsuite/ld-x86-64/x86-64.exp: Likewise.
+	* testsuite/ld-i386/pr26018.d: New file.
+	* testsuite/ld-x86-64/pr26018.d: Likewise.
+	* testsuite/ld-x86-64/pr26018.s: Likewise.
+
 2020-05-21  Alan Modra  <amodra@gmail.com>
 
 	* deffilep.y: Replace "if (x) free (x)" with "free (x)" thoughout.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 7bb3636d3b0..e3a5f8b1959 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -496,6 +496,7 @@ run_dump_test "pr23930"
 run_dump_test "pr24322a"
 run_dump_test "pr24322b"
 run_dump_test "align-branch-1"
+run_dump_test "pr26018"
 
 if { !([istarget "i?86-*-linux*"]
        || [istarget "i?86-*-gnu*"]
diff --git a/ld/testsuite/ld-i386/pr26018.d b/ld/testsuite/ld-i386/pr26018.d
new file mode 100644
index 00000000000..9ff16c13434
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr26018.d
@@ -0,0 +1,16 @@
+#source: ../ld-x86-64/pr26018.s
+#as: --32
+#ld: -shared -Bsymbolic-functions -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[0-9a-f]+ <_start>:
+ +[a-f0-9]+:	e8 00 00 00 00       	call   [0-9a-f]+ <foo>
+
+[0-9a-f]+ <foo>:
+ +[a-f0-9]+:	c3                   	ret    
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr26018.d b/ld/testsuite/ld-x86-64/pr26018.d
new file mode 100644
index 00000000000..c2003aa7905
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr26018.d
@@ -0,0 +1,15 @@
+#as: --64
+#ld: -shared -Bsymbolic-functions -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[0-9a-f]+ <_start>:
+ +[a-f0-9]+:	e8 00 00 00 00       	callq  [0-9a-f]+ <foo>
+
+[0-9a-f]+ <foo>:
+ +[a-f0-9]+:	c3                   	retq   
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr26018.s b/ld/testsuite/ld-x86-64/pr26018.s
new file mode 100644
index 00000000000..0b36f2bb117
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr26018.s
@@ -0,0 +1,7 @@
+	.global _start, foo
+	.type foo, %function
+	.text
+_start:
+	call foo@PLT
+foo:
+	ret
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index d2e5ac72059..9db16c6b6e0 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -467,6 +467,7 @@ run_dump_test "pr25416-2a"
 run_dump_test "pr25416-2b"
 run_dump_test "pr25416-3"
 run_dump_test "pr25416-4"
+run_dump_test "pr26018"
 
 if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
     return


More information about the Binutils-cvs mailing list