proc default_ld_relocate { ld target objects } {
global HOSTING_EMU
global host_triplet
+ global exec_output
if { [which $ld] == 0 } then {
perror "$ld does not exist"
return 0
}
+ catch "exec rm -f $target" exec_output
+
verbose -log "$ld $HOSTING_EMU -o $target -r $objects"
catch "exec $ld $HOSTING_EMU -o $target -r $objects" exec_output
global LIBS
global host_triplet
global link_output
+ global exec_output
set objs "$HOSTING_CRT0 $objects"
set libs "$LIBS $HOSTING_LIBS"
} else {
set flags ""
}
+
+ catch "exec rm -f $target" exec_output
+
verbose -log "$ld $HOSTING_EMU $flags -o $target $objs $libs"
catch "exec $ld $HOSTING_EMU $flags -o $target $objs $libs" link_output
set exec_output [prune_warnings $link_output]
- if [string match "" $link_output] then {
+ if [string match "" $exec_output] then {
return 1
} else {
- verbose -log "$link_output"
+ verbose -log "$exec_output"
return 0
}
}
global host_triplet
global link_output
global gcc_ld_flag
+ global exec_output
if { [which $ld] == 0 } then {
perror "$ld does not exist"
set flags "$gcc_ld_flag $flags"
}
+ catch "exec rm -f $target" exec_output
+
verbose -log "$ld $flags -o $target $objects"
catch "exec $ld $flags -o $target $objects" link_output
# targets_to_xfail is a list of target triplets to be xfailed.
# ldtests contains test-items with 3 items followed by 1 lists, 2 items
-# and 2 optional items:
+# and 3 optional items:
# 0:name
# 1:ld options
# 2:assembler options
# 5:expected output
# 6:compiler flags (optional)
# 7:language (optional)
+# 8:linker warning (optional)
proc run_ld_link_exec_tests { targets_to_xfail ldtests } {
global ld
global CXX
global CFLAGS
global errcnt
+ global exec_output
foreach testitem $ldtests {
foreach target $targets_to_xfail {
set expfile [lindex $testitem 5]
set cflags [lindex $testitem 6]
set lang [lindex $testitem 7]
+ set warning [lindex $testitem 8]
set objfiles {}
set failed 0
set failed 1
} else {
set failed 0
+ }
+
+ # Check if exec_output is expected.
+ if { $warning != "" } then {
+ verbose -log "returned with: <$exec_output>, expected: <$warning>"
+ if { [regexp $warning $exec_output] } then {
+ set failed 0
+ } else {
+ set failed 1
+ }
+ }
+
+ if { $failed == 0 } {
send_log "Running: $binfile > $binfile.out\n"
verbose "Running: $binfile > $binfile.out"
catch "exec $binfile > $binfile.out" exec_output