Fix ld action in run_dump_test
authorThomas Preud'homme <thomas.preudhomme@linaro.org>
Thu, 1 Nov 2018 17:18:24 +0000 (17:18 +0000)
committerThomas Preud'homme <thomas.preudhomme@linaro.org>
Thu, 1 Nov 2018 17:19:17 +0000 (17:19 +0000)
run_dump_test proposes an ld action but when trying to make use of it in
a gas test it gave me some Tcl error. It turns out that it references
the check_shared_lib_support procedure and ld_elf_shared_opt variable
both only available in ld-lib.exp. I've thus moved the procedure in
binutils-common.exp and defined the variable needed in the various
default.exp of testsuite that seem to be using run_dump_test.

Since check_shared_lib_support itself references the ld variable not
defined in binutils-common I've defined it from LD in run_dump_test and
fixed LD and LDFLAGS to be defined as expected by run_dump_test in the
various default.exp of testsuite using run_dump_test.

2018-11-01  Thomas Preud'homme  <thomas.preudhomme@linaro.org>

binutils/
* testsuite/config/default.exp: Define LD, LDFLAGS and
ld_elf_shared_opt.
* testsuite/lib/binutils-common.exp (check_shared_lib_support): Moved
from ld-lib.exp.
(run_dump_test): Set ld to $LD.

gas/
* testsuite/config/default.exp: Define LD, LDFLAGS and
ld_elf_shared_opt.

ld/
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Moved to
binutils-common.exp.

binutils/ChangeLog
binutils/testsuite/config/default.exp
binutils/testsuite/lib/binutils-common.exp
gas/ChangeLog
gas/testsuite/config/default.exp
ld/ChangeLog
ld/testsuite/lib/ld-lib.exp

index e3bbbc3a84f97bf6bb5995661bcda1c317fab4ff..8404b670c99cb9d46673ed8934efc0fc8044b3e0 100644 (file)
@@ -1,3 +1,11 @@
+2018-11-01  Thomas Preud'homme  <thomas.preudhomme@linaro.org>
+
+       * testsuite/config/default.exp: Define LD, LDFLAGS and
+       ld_elf_shared_opt.
+       * testsuite/lib/binutils-common.exp (check_shared_lib_support): Moved
+       from ld-lib.exp.
+       (run_dump_test): Set ld to $LD.
+
 2018-10-18  Nick Clifton  <nickc@redhat.com>
 
        * doc/binutils.texi (readelf): Document alternatives to the
index 6c55be66f550561a8f09df0d7af34785e4eee3ca..1bfe72e8c8526ff45062a1a519ed2a7911409529 100644 (file)
@@ -28,6 +28,14 @@ if ![info exists ASFLAGS] then {
     set ASFLAGS ""
 }
 
+if ![info exists LD] then {
+    set LD [findfile $base_dir/../ld/ld-new $base_dir/../ld/ld-new [transform ld]]
+}
+if ![info exists LDFLAGS] then {
+    set LDFLAGS ""
+}
+set ld_elf_shared_opt "-z norelro"
+
 if ![info exists NM] then {
     set NM [findfile $base_dir/nm-new $base_dir/nm-new [transform nm]]
 }
index 08d57ae9638d6670077cc4fda347e79753fffc1c..fcd2c8ee0c743445002c97d9984d1d111b9bc3eb 100644 (file)
@@ -248,6 +248,23 @@ proc is_bad_symtab {} {
     return 0;
 }
 
+# Returns true if -shared is supported on the target
+
+proc check_shared_lib_support { } {
+    global shared_available_saved
+    global ld
+
+    if {![info exists shared_available_saved]} {
+       set ld_output [remote_exec host $ld "-shared"]
+       if { [ string first "not supported" $ld_output ] >= 0 } {
+           set shared_available_saved 0
+       } else {
+           set shared_available_saved 1
+       }
+    }
+    return $shared_available_saved
+}
+
 # Compare two files line-by-line.  FILE_1 is the actual output and FILE_2
 # is the expected output.  Ignore blank lines in either file.
 #
@@ -1002,6 +1019,8 @@ proc run_dump_test { name {extra_options {}} } {
        catch "exec rm -f $objfile" exec_output
 
        set ld_extra_opt ""
+       global ld
+       set ld "$LD"
        if { [is_elf_format] && [check_shared_lib_support] } {
            set ld_extra_opt "$ld_elf_shared_opt"
        }
index 86eb344a61e8c68240ef2cc25789d1f88ca42733..eef02b863d26a5d01c51b55bb2b9a3bedc95a078 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-01  Thomas Preud'homme  <thomas.preudhomme@linaro.org>
+
+       * testsuite/config/default.exp: Define LD, LDFLAGS and
+       ld_elf_shared_opt.
+
 2018-10-31  Andre Vieira  <andre.simoesdiasvieira@arm.com>
 
        * testsuite/gas/arm/armv8-a+rdma-warning.d: Remove objdump execution.
index 888e90d178a75f5a0000d3db03a6aad5bcbb9ff6..b76c5baa4401461d60499011eb2149a53ec8d119 100644 (file)
@@ -26,6 +26,14 @@ if ![info exists ASFLAGS] then {
     set ASFLAGS ""
 }
 
+if ![info exists LD] then {
+    set LD [findfile $base_dir/../../ld/ld-new $base_dir/../../ld/ld-new [transform ld]]
+}
+if ![info exists LDFLAGS] then {
+    set LDFLAGS ""
+}
+set ld_elf_shared_opt "-z norelro"
+
 if ![info exists OBJDUMP] then {
     set OBJDUMP [findfile $base_dir/../../binutils/objdump \
                          $base_dir/../../binutils/objdump \
index 0453e2e8ee8d5734c33d6a617ef120ca0ca7078a..7fee0dd690bbda18eb8d0b74615ecc01210bdba4 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-01  Thomas Preud'homme  <thomas.preudhomme@linaro.org>
+
+       * testsuite/lib/ld-lib.exp (check_shared_lib_support): Moved to
+       binutils-common.exp.
+
 2018-10-29  Alan Modra  <amodra@gmail.com>
 
        * ldlang.c (load_symbols): When -t, print file names for script
index d6453f199584597fcb7f99ce4d309b29c636c845..3fb1e58a0c959a3ec6cf3d1a8f7aeecd3156f5ba 100644 (file)
@@ -1069,23 +1069,6 @@ proc check_gc_sections_available { } {
     return $gc_sections_available_saved
 }
 
-# Returns true if -shared is supported on the target
-
-proc check_shared_lib_support { } {
-    global shared_available_saved
-    global ld
-
-    if {![info exists shared_available_saved]} {
-       set ld_output [remote_exec host $ld "-shared"]
-       if { [ string first "not supported" $ld_output ] >= 0 } {
-           set shared_available_saved 0
-       } else {
-           set shared_available_saved 1
-       }
-    }
-    return $shared_available_saved
-}
-
 # Return true if target uses genelf.em (assuming it is ELF).
 proc is_generic_elf { } {
     if { [istarget "d30v-*-*"]
This page took 0.041686 seconds and 4 git commands to generate.