sim: testsuite: replace global_ld_options with LDFLAGS_FOR_TARGET

Only a few tests actually use global_ld_options, but we can replace the
sim-specific settings with the dejagnu common LDFLAGS_FOR_TARGET and get
the same result.
This commit is contained in:
Mike Frysinger 2021-11-21 23:12:39 -05:00
parent fd02ad8772
commit d07ada6f5a
6 changed files with 14 additions and 30 deletions

View File

@ -9,10 +9,8 @@ if [istarget bpf-unknown-none] {
set global_sim_options "--memory-size=4Mb"
}
global global_ld_options
if ![info exists global_ld_options] {
set global_ld_options "-Ttext=0x0"
}
global LDFLAGS_FOR_TARGET
set LDFLAGS_FOR_TARGET "-Ttext=0x0"
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.s]] {
# If we're only testing specific files and this isn't one of them,

View File

@ -21,7 +21,6 @@
proc sim_has_rv_and_cris {} {
global srcdir
global subdir
global global_ld_options
global global_sim_options
# We need to assemble and link a trivial program and pass that, in
@ -31,9 +30,6 @@ proc sim_has_rv_and_cris {} {
# what we want to do it to run the simulator without affecting the
# PASS/FAIL counters, and we can use e.g. run_sim_test for that.
if ![info exists global_ld_options] {
set global_ld_options ""
}
if ![info exists global_sim_options] {
set global_sim_options ""
}
@ -47,7 +43,7 @@ proc sim_has_rv_and_cris {} {
return 0
}
set comp_output [target_link quit.o quit.x "$global_ld_options"]
set comp_output [target_link quit.o quit.x ""]
if ![string match "" $comp_output] {
verbose -log "$comp_output" 3
@ -114,12 +110,11 @@ proc slurp_rv { file } {
if [istarget cris*-*-*] {
global ASFLAGS_FOR_TARGET
global LDFLAGS_FOR_TARGET
set has_rv_and_cris [sim_has_rv_and_cris]
global global_ld_options
global global_sim_options
set saved_global_sim_options $global_sim_options
set saved_global_ld_options $global_ld_options
# See the logic in sim-defs.exp for more details.
set sim [board_info target sim]
@ -162,7 +157,7 @@ if [istarget cris*-*-*] {
}
set sim_defaults "--hw-file $srcdir/$subdir/std.dev"
set ld_defaults "--section-start=.text=0"
set LDFLAGS_FOR_TARGET "--section-start=.text=0"
# We parse options an extra time besides in run_sim_test,
# to determine if our defaults should be overridden.
@ -178,10 +173,6 @@ if [istarget cris*-*-*] {
if { $opt_name == "sim" && $opt_machs == "" } {
set sim_defaults ""
}
if { $opt_name == "ld" && $opt_machs == "" } {
set ld_defaults ""
}
}
set rvdummy_id -1
@ -220,10 +211,8 @@ if [istarget cris*-*-*] {
# Unfortunately this seems like the only way to pass
# additional sim, ld etc. options to run_sim_test.
set global_sim_options "$saved_global_sim_options $sim_defaults"
set global_ld_options "$saved_global_ld_options $ld_defaults"
run_sim_test $src $mach
set global_sim_options $saved_global_sim_options
set global_ld_options $saved_global_ld_options
# Stop the rvdummy, if it's still running. We need to
# wait on it anyway to avoid it turning into a zombie.

View File

@ -4,7 +4,8 @@ if [istarget *] {
# All machines.
set all_machs "example"
set global_ld_options "-Ttext=0"
global LDFLAGS_FOR_TARGET
set LDFLAGS_FOR_TARGET "-Ttext=0"
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.s]] {
# If we're only testing specific files and this isn't one of them,
@ -15,5 +16,5 @@ if [istarget *] {
run_sim_test $src $all_machs
}
unset global_ld_options
unset LDFLAGS_FOR_TARGET
}

View File

@ -185,7 +185,6 @@ proc run_sim_test { name requested_machs } {
global opts
global cpu_option
global cpu_option_sep
global global_ld_options
global global_sim_options
if ![file exists [sim_tool_path]] {
@ -220,9 +219,6 @@ proc run_sim_test { name requested_machs } {
set opts(kfail) ""
set seen_output 0
if ![info exists global_ld_options] {
set global_ld_options ""
}
if ![info exists global_sim_options] {
set global_sim_options ""
}
@ -325,7 +321,7 @@ proc run_sim_test { name requested_machs } {
if ![info exists opts(ld,$mach)] {
set opts(ld,$mach) $opts(ld)
}
regsub {(^ *| +)([^ ]+)} "$opts(ld,$mach) $global_ld_options" { -Wl,\2} c_ld_options
regsub {(^ *| +)([^ ]+)} "$opts(ld,$mach)" { -Wl,\2} c_ld_options
if ![info exists opts(cc,$mach)] {
set opts(cc,$mach) $opts(cc)
@ -351,7 +347,7 @@ proc run_sim_test { name requested_machs } {
continue
}
set comp_output [target_link ${name}.o ${name}.x "$opts(ld,$mach) $global_ld_options"]
set comp_output [target_link ${name}.o ${name}.x "$opts(ld,$mach)"]
set method "linking"
}

View File

@ -18,8 +18,8 @@
if [istarget or1k*-*-*] {
set all_machs "or1k"
global global_ld_options
set global_ld_options "-T $srcdir/$subdir/or1k-test.ld"
global LDFLAGS_FOR_TARGET
set LDFLAGS_FOR_TARGET "-T $srcdir/$subdir/or1k-test.ld"
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.S]] {

View File

@ -3,12 +3,12 @@
set all_machs "sh shdsp"
global ASFLAGS_FOR_TARGET
set global_ld_options ""
global LDFLAGS_FOR_TARGET
foreach opt $board_variant_list {
switch "x$opt" {
x-ml { set ASFLAGS_FOR_TARGET "-little --defsym LITTLE=1"
set global_ld_options "-EL" }
set LDFLAGS_FOR_TARGET "-EL" }
}
}