This is the mail archive of the binutils@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]

[PATCH] Link tmpdir/copyreloc-main.o before tmpdir/copyreloc-lib.so


Since compiler may pass --as-needed to ld by default, link
tmpdir/copyreloc-main.o before tmpdir/copyreloc-lib.so.

	* testsuite/ld-i386/i386.exp: Link tmpdir/copyreloc-main.o
	before tmpdir/copyreloc-lib.so and test --as-needed.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
---
 ld/ChangeLog                      |  6 ++++++
 ld/testsuite/ld-i386/i386.exp     | 20 ++++++++++++++------
 ld/testsuite/ld-x86-64/x86-64.exp | 20 ++++++++++++++------
 3 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2b25adb..d325c81 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* testsuite/ld-i386/i386.exp: Link tmpdir/copyreloc-main.o
+	before tmpdir/copyreloc-lib.so and test --as-needed.
+	* testsuite/ld-x86-64/x86-64.exp: Likewise.
+
 2016-03-04  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/19579
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index e5f4aaa..bf8e6b6 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -514,18 +514,26 @@ if { [isnative]
 	    "copyreloc-lib.so" \
 	] \
 	[list \
-	    "Build copyreloc-main with PIE and GOTOFF (1)" \
-	    "tmpdir/copyreloc-lib.so -pie" \
+	    "Build libcopyreloc-main.a" \
+	    "" \
 	    "" \
 	    { copyreloc-main.S } \
+	    {} \
+	    "libcopyreloc-main.a" \
+	] \
+	[list \
+	    "Build copyreloc-main with PIE and GOTOFF (1)" \
+	    "tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \
+	    "" \
+	    { dummy.s } \
 	    {{readelf {-Wr} copyreloc-main1.rd}} \
 	    "copyreloc-main" \
 	] \
 	[list \
 	    "Build copyreloc-main with PIE and GOTOFF (2)" \
-	    "tmpdir/copyreloc-lib.so -pie" \
+	    "tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \
 	    "" \
-	    { copyreloc-main.S } \
+	    { dummy.s } \
 	    {{readelf {-Wr} copyreloc-main2.rd}} \
 	    "copyreloc-main" \
 	] \
@@ -681,9 +689,9 @@ if { [isnative]
 	] \
 	[list \
 	    "Run copyreloc-main with PIE and GOTOFF" \
-	    "tmpdir/copyreloc-lib.so -pie" \
+	    "--as-needed tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \
 	    "" \
-	    { copyreloc-main.S } \
+	    { dummy.s } \
 	    "copyreloc-main" \
 	    "copyreloc-main.out" \
 	] \
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 4b4cf12..cac481e 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -571,18 +571,26 @@ if { [isnative] && [which $CC] != 0 } {
 	    "copyreloc-lib.so" \
 	] \
 	[list \
-	    "Build copyreloc-main with PIE without -fPIE (1)" \
-	    "tmpdir/copyreloc-lib.so -pie" \
+	    "Build libcopyreloc-main.a" \
+	    "" \
 	    "" \
 	    { copyreloc-main.S } \
+	    {} \
+	    "libcopyreloc-main.a" \
+	] \
+	[list \
+	    "Build copyreloc-main with PIE without -fPIE (1)" \
+	    "tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \
+	    "" \
+	    { dummy.s } \
 	    {{readelf {-Wr} copyreloc-main1.rd}} \
 	    "copyreloc-main" \
 	] \
 	[list \
 	    "Build copyreloc-main with PIE without -fPIE (2)" \
-	    "tmpdir/copyreloc-lib.so -pie" \
+	    "tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \
 	    "" \
-	    { copyreloc-main.S } \
+	    { dummy.s } \
 	    {{readelf {-Wr} copyreloc-main2.rd}} \
 	    "copyreloc-main" \
 	] \
@@ -714,9 +722,9 @@ if { [isnative] && [which $CC] != 0 } {
 	] \
 	[list \
 	    "Run copyreloc-main with PIE without -fPIE" \
-	    "tmpdir/copyreloc-lib.so -pie" \
+	    "--as-needed tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \
 	    "" \
-	    { copyreloc-main.S } \
+	    { dummy.s } \
 	    "copyreloc-main" \
 	    "copyreloc-main.out" \
 	] \
-- 
2.5.0


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