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] make ld-elf/eh[1-4] tests assume less about x86_64 targets


These test cases are written to apply to all x86_64-*-* targets,
but they assume details of file and address space layout that are
not true of all targets.  This makes them encode their assumptions
explicitly.  Regression tested on x86_64-linux-gnu native, and these
tests now pass for --target=x86_64-nacl as well.

Ok for trunk?


Thanks,
Roland


ld/testsuite/
2012-04-06  Roland McGrath  <mcgrathr@google.com>

	* ld-elf/eh1.d: Add explicit --64 to as options, and explicit
	-melf_x86_64 and -Ttext to ld options, so we don't assume every
	x86_64-*-* target uses --64 (vs --x32) by default or has the
	same address space layout.
	* ld-elf/eh2.d: Likewise.
	* ld-elf/eh3.d: Likewise.
	* ld-elf/eh4.d: Likewise.
	* ld-elf/elf.exp: For target *-*-nacl*, use options_regsub(ld) to
	map -melf_x86_64 to -melf_x86_64_nacl.

diff --git a/ld/testsuite/ld-elf/eh1.d b/ld/testsuite/ld-elf/eh1.d
index f0874f7..4455b0d 100644
--- a/ld/testsuite/ld-elf/eh1.d
+++ b/ld/testsuite/ld-elf/eh1.d
@@ -1,6 +1,7 @@
 #source: eh1.s
 #source: eh1a.s
-#ld:
+#as: --64
+#ld: -melf_x86_64 -Ttext 0x400078
 #readelf: -wf
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-elf/eh2.d b/ld/testsuite/ld-elf/eh2.d
index 1a05d7f..c5b5a73 100644
--- a/ld/testsuite/ld-elf/eh2.d
+++ b/ld/testsuite/ld-elf/eh2.d
@@ -1,6 +1,7 @@
 #source: eh1.s
 #source: eh2a.s
-#ld:
+#as: --64
+#ld: -melf_x86_64 -Ttext 0x400078
 #readelf: -wf
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-elf/eh3.d b/ld/testsuite/ld-elf/eh3.d
index 1f76b8c..b3bd756 100644
--- a/ld/testsuite/ld-elf/eh3.d
+++ b/ld/testsuite/ld-elf/eh3.d
@@ -1,6 +1,7 @@
 #source: eh3.s
 #source: eh3a.s
-#ld:
+#as: --64
+#ld: -melf_x86_64 -Ttext 0x400078
 #readelf: -wf
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-elf/eh4.d b/ld/testsuite/ld-elf/eh4.d
index b8f9865..ad4b008 100644
--- a/ld/testsuite/ld-elf/eh4.d
+++ b/ld/testsuite/ld-elf/eh4.d
@@ -1,6 +1,7 @@
 #source: eh4.s
 #source: eh4a.s
-#ld: -shared
+#as: --64
+#ld: -melf_x86_64 -shared -Ttext 0x400
 #readelf: -wf
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index e2050fc..e40078a 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -37,6 +37,13 @@ if { [istarget alpha*-*-* ] } {
     set LDFLAGS "$LDFLAGS -Ttext-segment 0x1000000"
 }
 
+if { [istarget "*-*-nacl*"] } {
+    # The eh[1-4] cases are written to expect ELFCLASS64 layout on x86-64.
+    # But the target default is ELFCLASS32.  So the cases explicitly use
+    # -melf_x86_64 to select that, but NaCl needs a different emulation name.
+    set options_regsub(ld) {-melf_x86_64 -melf_x86_64_nacl}
+}
+
 if { [is_remote host] } then {
     remote_download host merge.ld
 }


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