+2020-06-20 Alan Modra <amodra@gmail.com>
+
+ * testsuite/lib/ld-lib.exp (default_ld_compile): Don't perror on
+ a compiler error.
+ (default_ld_assemble): Similarly for an assembler error.
+ (default_ld_nm): Similarly for an nm error.
+ (run_ld_link_tests): Report ld_assemble errors as a fail.
+ (check_as_cfi): Remove now unnecessary perror substitution.
+ * testsuite/ld-elf/exclude.exp: Report ld_nm error return as test
+ fails rather then unresolved.
+ * testsuite/ld-gc/gc.exp: Likewise.
+ * testsuite/ld-scripts/alignof.exp: Likewise.
+ * testsuite/ld-scripts/defined.exp: Likewise.
+ * testsuite/ld-scripts/script.exp: Likewise.
+ * testsuite/ld-scripts/sizeof.exp: Likewise.
+ * testsuite/ld-selective/selective.exp: Likewise.
+ * testsuite/ld-scripts/extern.exp: Likewise. Return on ld_link
+ failure.
+ * testsuite/ld-elfweak/elfweak.exp: Report compiler errors as
+ test unresolved.
+ * testsuite/ld-fastcall/fastcall.exp: Report assember errors as
+ test fails.
+ * testsuite/ld-i386/i386.exp (iamcu_tests): Likewise.
+ * testsuite/ld-ia64/line.exp: Likewise.
+ * testsuite/ld-mep/mep.exp: Likewise.
+ * testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise.
+ * testsuite/ld-nios2/nios2.exp: Likewise.
+ * testsuite/ld-scripts/alignof.exp: Likewise.
+ * testsuite/ld-x86-64/line.exp: Likewise.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+ * testsuite/ld-scripts/log2.exp: Formatting.
+ * testsuite/ld-tic6x/tic6x.exp: Report ld_link errors as a test fail.
+
2020-06-20 Alan Modra <amodra@gmail.com>
* testsuite/ld-alpha/alpha.exp: Exclude *ecoff targets.
return
}
-if ![ld_nm $nm "-D" tmpdir/exclude.so] {
- unresolved $test2
-} elseif { [info exists nm_output(exclude_common)]
- && [info exists nm_output(exclude_sym)] } {
+if { [ld_nm $nm "-D" tmpdir/exclude.so]
+ && [info exists nm_output(exclude_common)]
+ && [info exists nm_output(exclude_sym)] } {
pass $test2
} else {
fail $test2
fail $test3
}
-if ![ld_nm $nm "-D" tmpdir/exclude.so] {
- unresolved $test4
-} elseif { ! [info exists nm_output(exclude_common)]
- && ! [info exists nm_output(exclude_sym)] } {
+if { [ld_nm $nm "-D" tmpdir/exclude.so]
+ && ! [info exists nm_output(exclude_common)]
+ && ! [info exists nm_output(exclude_sym)] } {
pass $test4
} else {
fail $test4
|| ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/bar1a.c $tmpdir/bar1a.o]
|| ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/bar1b.c $tmpdir/bar1b.o]
|| ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/bar1c.c $tmpdir/bar1c.o]
- || ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/main1.c $tmpdir/main1.o]
- || ![ld_link $CC $tmpdir/libfoo1a.so "$shared $tmpdir/foo1a.o"]
- || ![ld_link $CC $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]
- || ![ld_link $CC $tmpdir/libbar1a.so "$shared $tmpdir/bar1a.o $tmpdir/libfoo1a.so"]} then {
+ || ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/main1.c $tmpdir/main1.o]} then {
+ unresolved "ELF weak"
+} elseif {![ld_link $CC $tmpdir/libfoo1a.so "$shared $tmpdir/foo1a.o"]
+ || ![ld_link $CC $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]
+ || ![ld_link $CC $tmpdir/libbar1a.so "$shared $tmpdir/bar1a.o $tmpdir/libfoo1a.so"]} then {
fail "ELF weak"
} else {
build_lib "ELF DSO weak func first" libfoo "foo.o bar.o" dso.dsym
if ![ld_assemble $as $srcdir/$subdir/export.s tmpdir/export.o] {
verbose "Unable to assemble test file!" 1
- unresolved $testname
+ fail $testname
return
}
if ![ld_assemble $as $srcdir/$subdir/import.s tmpdir/import.o] {
verbose "Unable to assemble test file!" 1
- unresolved $testname
+ fail $testname
return
}
return
}
if ![ld_nm $nm "" $outfile] {
- unresolved $testname
+ fail $testname
return
}
if {![info exists nm_output(used_func)] \
global subdir
if ![ld_assemble $as "--32 -march=iamcu $srcdir/$subdir/start.s" tmpdir/startiamcu.o] {
- unresolved "Build Intel MCU start.o"
+ fail "Build Intel MCU start.o"
return
}
if ![ld_assemble $as "--32 $srcdir/$subdir/start.s" tmpdir/start32.o] {
- unresolved "Build ia32 start.o"
+ fail "Build ia32 start.o"
return
}
if ![ld_assemble $as "--32 -march=iamcu $srcdir/$subdir/foo.s" tmpdir/fooiamcu.o] {
- unresolved "Build Intel MCU foo.o"
+ fail "Build Intel MCU foo.o"
return
}
if ![ld_assemble $as "--32 $srcdir/$subdir/foo.s" tmpdir/foo32.o] {
- unresolved "Build ia32 foo.o"
+ fail "Build ia32 foo.o"
return
}
if ![ld_assemble $as "-x $srcdir/$subdir/undefined.s" tmpdir/undefined.o] {
verbose "Unable to assemble test file!" 1
- unresolved $testline
+ fail $testline
return
}
set testbsrweak "MeP bsr to undefined weak function"
if ![ld_assemble $as "$srcdir/$subdir/mep1.s" tmpdir/mep1.o] {
- unresolved $testbsrweak
+ fail $testbsrweak
} else { if ![ld_link $ld tmpdir/mep1 "-T$srcdir/$subdir/mep1.ld tmpdir/mep1.o"] {
fail $testbsrweak
} else {
}
if {$objs == ""} {
- unresolved $testname
+ fail $testname
} elseif {![ld_link "$ld $ldemul" $finalobj "-r $objs"]} {
fail $testname
} else {
}
if {$objs == ""} {
- unresolved $testname
+ fail $testname
} elseif {[ld_link "$ld $ldemul" $finalobj "-r $objs"]
|| [string first $message $link_output] < 0} {
fail $testname
set test mixed1
if ![ld_assemble $as "-march=r1 $srcdir/$subdir/${test}a.s" tmpdir/${test}a.o] {
- unresolved "Build mixed1a.o"
+ fail "Build mixed1a.o"
return
}
if ![ld_assemble $as "-march=r2 $srcdir/$subdir/${test}b.s" tmpdir/${test}b.o] {
- unresolved "Build mixed1b.o"
+ fail "Build mixed1b.o"
return
}
set testname "ALIGNOF"
if ![ld_assemble $as $srcdir/$subdir/alignof.s tmpdir/alignof.o] {
- unresolved $testname
+ fail $testname
return
}
}
if ![ld_nm $nm "" tmpdir/alignof] {
- unresolved $testname
+ fail $testname
return
}
set LDFLAGS "$LDFLAGS --image-base 0"
}
-if ![ld_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] {
+if { ![ld_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] } {
+ fail $testname
+} elseif { ![ld_nm $nm "" tmpdir/def] } {
+ fail $testname
+} elseif { ![info exists nm_output(value1)]
+ || ![info exists nm_output(value2)]} {
+ send_log "bad output from nm\n"
+ verbose "bad output from nm"
+ fail $testname
+} elseif {$nm_output(value1) != 1} {
+ send_log "value1 == $nm_output(value1)\n"
+ verbose "value1 == $nm_output(value1)"
+ fail $testname
+} elseif {$nm_output(value2) != 2} {
+ send_log "value2 == $nm_output(value2)\n"
+ verbose "value2 == $nm_output(value2)"
fail $testname
} else {
- if ![ld_nm $nm "" tmpdir/def] {
- unresolved $testname
- } else {
- if {![info exists nm_output(value1)] \
- || ![info exists nm_output(value2)]} {
- send_log "bad output from nm\n"
- verbose "bad output from nm"
- fail $testname
- } else {
- if {$nm_output(value1) != 1} {
- send_log "value1 == $nm_output(value1)\n"
- verbose "value1 == $nm_output(value1)"
- fail $testname
- } else {
- if {$nm_output(value2) != 2} {
- send_log "value2 == $nm_output(value2)\n"
- verbose "value2 == $nm_output(value2)"
- fail $testname
- } else {
- pass $testname
- }
- }
- }
- }
+ pass $testname
}
set saved_ASFLAGS "$ASFLAGS"
if ![ld_link $ld tmpdir/extern "-T $srcdir/$subdir/extern.t tmpdir/extern.o"] {
fail $testname
+ return
}
if ![ld_nm $nm "" tmpdir/extern] {
- unresolved $testname
+ fail $testname
return
}
set testname "binary logarithm"
if {![ld_assemble $as $srcdir/$subdir/log2.s tmpdir/log2.o]} {
- unresolved $testname
- return
+ unresolved $testname
+ return
}
if {![ld_link $ld tmpdir/log2 "-T $srcdir/$subdir/log2.t tmpdir/log2.o"]} {
- fail $testname
+ fail $testname
} else {
- pass $testname
+ pass $testname
}
global nm_output
if ![ld_nm $nm "" tmpdir/script] {
- unresolved $testname
+ fail $testname
return
}
}
if ![ld_nm $nm "" tmpdir/sizeof] {
- unresolved $testname
+ fail $testname
return
}
}
if ![ld_nm $nm --demangle $ldfile] {
- unresolved $testname
+ fail $testname
continue
}
|| ![ld_link $ld tmpdir/shlibb.o "-r -EB tmpdir/shlib-1b.o tmpdir/shlib-2b.o"]
|| ![ld_link $ld tmpdir/dynapp-1 "tmpdir/libtest.so tmpdir/shlib-app-1.o"]
|| ![ld_link $ld tmpdir/dynapp-1b "-EB tmpdir/libtestb.so tmpdir/shlib-app-1b.o"] } {
- unresolved "TIC6X OSABI tests"
+ fail "TIC6X OSABI tests"
return
}
if ![ld_assemble $as "--64 $srcdir/$subdir/undefined.s" tmpdir/undefined.o] {
verbose "Unable to assemble test file!" 1
- unresolved $testline
+ fail $testline
return
}
}
if ![ld_assemble $as "--x32 $srcdir/$subdir/start.s" tmpdir/startx32.o] {
- unresolved "Build ILP32 start.o"
+ fail "Build ILP32 start.o"
return
}
if ![ld_assemble $as "--32 $srcdir/$subdir/start.s" tmpdir/start32.o] {
- unresolved "Build ia32 start.o"
+ fail "Build ia32 start.o"
return
}
if ![ld_assemble $as "--64 $srcdir/$subdir/start.s" tmpdir/start64.o] {
- unresolved "Build LP64 start.o"
+ fail "Build LP64 start.o"
return
}
if ![ld_assemble $as "--x32 $srcdir/$subdir/foo.s" tmpdir/foox32.o] {
- unresolved "Build ILP32 foo.o"
+ fail "Build ILP32 foo.o"
return
}
if ![ld_assemble $as "--32 $srcdir/$subdir/foo.s" tmpdir/foo32.o] {
- unresolved "Build ia32 foo.o"
+ fail "Build ia32 foo.o"
return
}
if ![ld_assemble $as "--64 $srcdir/$subdir/foo.s" tmpdir/foo64.o] {
- unresolved "Build LP64 foo.o"
+ fail "Build LP64 foo.o"
return
}
return 1
} else {
verbose -log "$exec_output"
- perror "$source: compilation failed"
return 0
}
}
if [string match "" $exec_output] then {
return 1
} else {
- perror "$source: assembly failed"
return 0
}
}
return 1
} else {
verbose -log "$exec_output"
- perror "$object: nm failed"
return 0
}
}
set as_file "$srcdir/$subdir/$src_file"
}
if ![ld_assemble $as "$as_options $as_file" $objfile] {
- set is_unresolved 1
+ set failed 1
break
}
}
# Catch assembler errors.
+ if { $failed } {
+ fail $testname
+ continue
+ }
+ # Catch compiler errors.
if { $is_unresolved } {
unresolved $testname
continue
close $as_fh
remote_download host $as_file
verbose -log "Checking CFI support:"
- rename "perror" "check_as_cfi_perror"
- proc perror { args } { }
set success [ld_assemble $as $as_file "/dev/null"]
- rename "perror" ""
- rename "check_as_cfi_perror" "perror"
#remote_file host delete $as_file
set check_as_cfi_result $success
return $success