Run PR ld/17618 test only with 64-bit ELF linker
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 9 Aug 2017 22:04:05 +0000 (15:04 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 9 Aug 2017 22:04:05 +0000 (15:04 -0700)
PR ld/17618 test requires 64-bit linker to run.  Set LD_CLASS to "64bit"
for 64-bit ELF linker and run PR ld/17618 test only if $LD_CLASS is
"64bit".  More checks can be added to support 64-bit linkers in non-ELF
format.

* testsuite/config/default.exp (LD_CLASS): New.  Set to "64bit"
for 64-bit ELF linker.
* testsuite/ld-x86-64/pr17618.d (#notarget): Removed.
* testsuite/ld-x86-64/x86-64.exp: Run pr17618 only for 64-bit
linker.

ld/ChangeLog
ld/testsuite/config/default.exp
ld/testsuite/ld-x86-64/pr17618.d
ld/testsuite/ld-x86-64/x86-64.exp

index b6d378fed2aafb69278f65f331f25d7549fcf5ab..e4e6bfe5e326787c14bc0d2e128c755eb441abe4 100644 (file)
@@ -1,3 +1,11 @@
+2017-08-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * testsuite/config/default.exp (LD_CLASS): New.  Set to "64bit"
+       for 64-bit ELF linker.
+       * testsuite/ld-x86-64/pr17618.d (#notarget): Removed.
+       * testsuite/ld-x86-64/x86-64.exp: Run pr17618 only for 64-bit
+       linker.
+
 2017-08-08  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/21924
index f5cb188478af011d54226b3a952f33fddc101c2b..355d98f24a89fcdf0cc6b917a3c8bb5afe1b3bb6 100644 (file)
@@ -251,6 +251,16 @@ if ![info exists LDFLAGS] then {
     set LDFLAGS {}
 }
 
+# Set LD_CLASS to "64bit" for 64-bit LD.
+if { ![info exists LD_CLASS] } then {
+    set readelf_output [run_host_cmd "$READELF" "-h $LD"]
+    if { [regexp {[ \t]+Class:[ \t]+ELF64} $readelf_output] } then {
+       set LD_CLASS "64bit"
+    } else {
+       set LD_CLASS "32bit"
+    }
+}
+
 # Set PLT_CFLAGS to "-fplt" if target compiler supports it.
 
 if { ![info exists PLT_CFLAGS] } then {
index b090aa0e18c730e4a05f1052aefbe18ac0cb8e07..e640b4044ecd2e6474d0f86989f78b8d34b52335 100644 (file)
@@ -1,5 +1,4 @@
 #name: PLT PC-relative offset overflow check
 #as: --64
 #ld: -shared -melf_x86_64
-#notarget: x86_64-*-linux*-gnux32
 #error: .*PC-relative offset overflow in PLT entry for `bar'
index ce29cc863461da80909f9d4a3e3f6a0ea6ed48ef..0375da6aa64b932c51628709774cce6cb4a706b7 100644 (file)
@@ -1572,7 +1572,11 @@ run_ld_link_tests [list \
 ]
 
 # Linux only tests
-run_dump_test "pr17618"
+global LD_CLASS
+if { "$LD_CLASS" == "64bit" } then {
+    # This test needs 64-bit linker.
+    run_dump_test "pr17618"
+}
 run_dump_test "pltgot-1"
 run_dump_test "pltgot-2"
 run_dump_test "pr20830a"
This page took 0.02945 seconds and 4 git commands to generate.