This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_26-branch] Support --as-needed in i386/x86-64 tests


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

commit 5975f54c03809c5c26ab2b1dfbdd20b47e4e09b4
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 7 09:03:24 2016 -0800

    Support --as-needed in i386/x86-64 tests
    
    Since compiler may pass --as-needed to ld by default, link .o file
    before .so file in i386/x86-64 tests.
    
    	PR ld/19774
    	* testsuite/ld-i386/i386.exp: Link tmpdir/pr18900.o before
    	tmpdir/pr18900.so and test --as-needed.  Link tmpdir/gotpc1.o
    	before tmpdir/got1d.so and test --as-needed.
    	* testsuite/ld-x86-64/x86-64.exp: Link tmpdir/pr18900.o before
    	tmpdir/pr18900.so and test --as-needed.

Diff:
---
 ld/ChangeLog                      | 12 ++++++++++++
 ld/testsuite/ld-i386/i386.exp     | 32 ++++++++++++++++++++++++--------
 ld/testsuite/ld-x86-64/x86-64.exp | 20 ++++++++++++++------
 3 files changed, 50 insertions(+), 14 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 5a6b5bd..2e5b80e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,15 @@
+2016-06-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+	Backport from master
+	2016-03-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/19774
+	* testsuite/ld-i386/i386.exp: Link tmpdir/pr18900.o before
+	tmpdir/pr18900.so and test --as-needed.  Link tmpdir/gotpc1.o
+	before tmpdir/got1d.so and test --as-needed.
+	* testsuite/ld-x86-64/x86-64.exp: Link tmpdir/pr18900.o before
+	tmpdir/pr18900.so and test --as-needed.
+
 2016-05-20  H.J. Lu  <hongjiu.lu@intel.com>
 
 	Backport from master
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index b1332ff..02e6769 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -511,18 +511,26 @@ if { [isnative]
 	    "pr18900.so" \
 	] \
 	[list \
-	    "Build pr18900a" \
-	    "tmpdir/pr18900.so" \
+	    "Build pr18900.o" \
+	    "-r -nostdlib" \
 	    "" \
 	    { pr18900b.c pr18900c.c } \
+	    "" \
+	    "pr18900.o" \
+	] \
+	[list \
+	    "Build pr18900a" \
+	    "tmpdir/pr18900.o tmpdir/pr18900.so" \
+	    "" \
+	    { dummy.s } \
 	    {{readelf {-Wrd} pr18900a.rd}} \
 	    "pr18900a" \
 	] \
 	[list \
 	    "Build pr18900b" \
-	    "tmpdir/pr18900.so" \
+	    "-Wl,--as-needed tmpdir/pr18900.o tmpdir/pr18900.so" \
 	    "" \
-	    { pr18900b.c pr18900c.c } \
+	    { dummy.s } \
 	    {{readelf {-Wrd} pr18900b.rd}} \
 	    "pr18900b" \
 	] \
@@ -543,10 +551,18 @@ if { [isnative]
 	    "got1d.so" \
 	] \
 	[list \
+	    "Build gotpc1.o" \
+	    "-r -nostdlib" \
+	    "" \
+	    { got1a.S got1b.c got1c.c } \
+	    "" \
+	    "gotpc1.o" \
+	] \
+	[list \
 	    "Build gotpc1" \
-	    "tmpdir/got1d.so" \
+	    "-Wl,--as-needed tmpdir/gotpc1.o tmpdir/got1d.so" \
 	    "-Wa,-mrelax-relocations=yes" \
-	    { got1a.S got1b.c got1c.c } \
+	    { dummy.s } \
 	    {{objdump {-dw} got1.dd}} \
 	    "got1" \
 	] \
@@ -622,9 +638,9 @@ if { [isnative]
 	] \
 	[list \
 	    "Run pr18900" \
-	    "tmpdir/pr18900.so" \
+	    "tmpdir/pr18900.o tmpdir/pr18900.so" \
 	    "" \
-	    { pr18900b.c pr18900c.c } \
+	    { dummy.s } \
 	    "pr18900" \
 	    "pr18900.out" \
 	] \
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index ac11531..92236fb 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -523,18 +523,26 @@ if { [isnative] && [which $CC] != 0 } {
 	    "pr18900.so" \
 	] \
 	[list \
-	    "Build pr18900a" \
-	    "tmpdir/pr18900.so" \
+	    "Build pr18900.o" \
+	    "-r -nostdlib" \
 	    "" \
 	    { pr18900b.c pr18900c.c } \
+	    "" \
+	    "pr18900.o" \
+	] \
+	[list \
+	    "Build pr18900a" \
+	    "tmpdir/pr18900.o tmpdir/pr18900.so" \
+	    "" \
+	    { dummy.s } \
 	    {{readelf {-Wrd} pr18900a.rd}} \
 	    "pr18900a" \
 	] \
 	[list \
 	    "Build pr18900b" \
-	    "tmpdir/pr18900.so" \
+	    "-Wl,--as-needed tmpdir/pr18900.o tmpdir/pr18900.so" \
 	    "" \
-	    { pr18900b.c pr18900c.c } \
+	    { dummy.s } \
 	    {{readelf {-Wrd} pr18900b.rd}} \
 	    "pr18900b" \
 	] \
@@ -626,9 +634,9 @@ if { [isnative] && [which $CC] != 0 } {
 	] \
 	[list \
 	    "Run pr18900" \
-	    "tmpdir/pr18900.so" \
+	    "tmpdir/pr18900.o tmpdir/pr18900.so" \
 	    "" \
-	    { pr18900b.c pr18900c.c } \
+	    { dummy.s } \
 	    "pr18900" \
 	    "pr18900.out" \
 	] \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]