Use run_host_cmd to run $CC and other no-section-header test fixes
We should be using run_host_cmd everywhere we invoke a compiler in the ld testsuite, if we want to use ld/ld-new just built. run_host_cmd properly inserts $gcc_B_opt in cases where a user wants to test binutils with a newly built compiler, ie. when $CC specifies -B itself. Also, it is not good practice to exclude tests when non-native except of course those tests that run a target binary. Compiling and linking often shows up problems. * testsuite/ld-elf/no-section-header.exp (binutils_run_test): Use run_host_cmd to invoke $CC_FOR_TARGET. Run all tests non-native too, except for attempting to run the binaries. Run tests for ELF in general, not just linux. * testsuite/ld-elf/pr25617-1-no-sec-hdr.rd: Allow localentry symbol decoration, and support either sorting of symbols. * testsuite/ld-elf/pr25617-1a-no-sec-hdr.rd: Likewise. * testsuite/ld-elf/pr25617-1a-sec-hdr.rd: Likewise. * testsuite/ld-elf/pr25617-1a-no-sec-hdr.nd: Accept D function syms. * testsuite/ld-elf/start-shared-noheader-sysv.rd: Accept mips-sgi-irix symbol output. * testsuite/ld-elf/start-shared-noheader.nd: Likewise.
This commit is contained in:
parent
5f60df9974
commit
46f51ac38b
7 changed files with 53 additions and 53 deletions
|
@ -21,9 +21,7 @@
|
|||
# Written by H.J. Lu (hongjiu.lu@intel.com)
|
||||
#
|
||||
|
||||
# Make sure that binutils can correctly handle ld output in ELF.
|
||||
|
||||
if { ![istarget *-*-linux*] } {
|
||||
if { ![is_elf_format] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -129,14 +127,13 @@ binutils_test strip "--hash-style=gnu -shared" start \
|
|||
binutils_test strip "--hash-style=sysv -shared" start \
|
||||
start-shared-noheader-sysv.rd start-shared-noheader.nd
|
||||
|
||||
# Skip non-native targets or -shared is not supported.
|
||||
if { ![isnative] || ![check_shared_lib_support] } {
|
||||
|
||||
if { ![check_compiler_available] || ![check_shared_lib_support] } {
|
||||
return
|
||||
}
|
||||
|
||||
proc binutils_run_test { prog } {
|
||||
global CC
|
||||
global gcc_B_opt
|
||||
global CC_FOR_TARGET
|
||||
global READELF
|
||||
global NM
|
||||
global objcopy
|
||||
|
@ -286,20 +283,22 @@ proc binutils_run_test { prog } {
|
|||
return
|
||||
}
|
||||
|
||||
send_log "tmpdir/pr25617-1-no-sec-hdr > tmpdir/pr25617-1.out\n"
|
||||
catch "exec tmpdir/pr25617-1-no-sec-hdr > tmpdir/pr25617-1.out" got
|
||||
if ![string match "" $got] then {
|
||||
send_log "$got\n"
|
||||
unresolved "Update pr25617-1a-no-sec-hdr.so ($prog_name)"
|
||||
return
|
||||
}
|
||||
if { [isnative] } {
|
||||
send_log "tmpdir/pr25617-1-no-sec-hdr > tmpdir/pr25617-1.out\n"
|
||||
catch "exec tmpdir/pr25617-1-no-sec-hdr > tmpdir/pr25617-1.out" got
|
||||
if ![string match "" $got] then {
|
||||
send_log "$got\n"
|
||||
unresolved "Update pr25617-1a-no-sec-hdr.so ($prog_name)"
|
||||
return
|
||||
}
|
||||
|
||||
send_log "diff tmpdir/pr25617-1.out $srcdir/$subdir/pass.out\n"
|
||||
catch "exec diff tmpdir/pr25617-1.out $srcdir/$subdir/pass.out" got
|
||||
if ![string match "" $got] then {
|
||||
send_log "$got\n"
|
||||
fail "Update pr25617-1a-no-sec-hdr.so ($prog_name)"
|
||||
return
|
||||
send_log "diff tmpdir/pr25617-1.out $srcdir/$subdir/pass.out\n"
|
||||
catch "exec diff tmpdir/pr25617-1.out $srcdir/$subdir/pass.out" got
|
||||
if ![string match "" $got] then {
|
||||
send_log "$got\n"
|
||||
fail "Update pr25617-1a-no-sec-hdr.so ($prog_name)"
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
pass "Update pr25617-1a-no-sec-hdr.so ($prog_name)"
|
||||
|
@ -338,24 +337,25 @@ proc binutils_run_test { prog } {
|
|||
return
|
||||
}
|
||||
|
||||
send_log "tmpdir/pr25617-1-pie-no-sec-hdr > tmpdir/pr25617-1-pie.out\n"
|
||||
catch "exec tmpdir/pr25617-1-pie-no-sec-hdr > tmpdir/pr25617-1-pie.out" got
|
||||
if ![string match "" $got] then {
|
||||
send_log "$got\n"
|
||||
unresolved "Update pr25617-1a-now-no-sec-hdr.so ($prog_name)"
|
||||
return
|
||||
if { [isnative] } {
|
||||
send_log "tmpdir/pr25617-1-pie-no-sec-hdr > tmpdir/pr25617-1-pie.out\n"
|
||||
catch "exec tmpdir/pr25617-1-pie-no-sec-hdr > tmpdir/pr25617-1-pie.out" got
|
||||
if ![string match "" $got] then {
|
||||
send_log "$got\n"
|
||||
unresolved "Update pr25617-1a-now-no-sec-hdr.so ($prog_name)"
|
||||
return
|
||||
}
|
||||
|
||||
send_log "diff tmpdir/pr25617-1-pie.out $srcdir/$subdir/pass.out\n"
|
||||
catch "exec diff tmpdir/pr25617-1-pie.out $srcdir/$subdir/pass.out" got
|
||||
if ![string match "" $got] then {
|
||||
send_log "$got\n"
|
||||
fail "Update pr25617-1a-now-no-sec-hdr.so ($prog_name)"
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
send_log "diff tmpdir/pr25617-1-pie.out $srcdir/$subdir/pass.out\n"
|
||||
catch "exec diff tmpdir/pr25617-1-pie.out $srcdir/$subdir/pass.out" got
|
||||
if ![string match "" $got] then {
|
||||
send_log "$got\n"
|
||||
fail "Update pr25617-1a-now-no-sec-hdr.so ($prog_name)"
|
||||
return
|
||||
}
|
||||
|
||||
send_log "$CC $gcc_B_opt -o tmpdir/pr25617-1 tmpdir/pr25617-1b.o tmpdir/pr25617-1a-now-no-sec-hdr.so\n"
|
||||
catch "exec $CC $gcc_B_opt -o tmpdir/pr25617-1 tmpdir/pr25617-1b.o tmpdir/pr25617-1a-now-no-sec-hdr.so" got
|
||||
set got [run_host_cmd $CC_FOR_TARGET "-o tmpdir/pr25617-1 tmpdir/pr25617-1b.o tmpdir/pr25617-1a-now-no-sec-hdr.so"]
|
||||
if ![string match "*pr25617-1a-now-no-sec-hdr.so*file in wrong format*" $got] then {
|
||||
send_log "$got\n"
|
||||
fail "Update pr25617-1a-now-no-sec-hdr.so ($prog_name)"
|
||||
|
|
|
@ -14,7 +14,7 @@ Program Headers:
|
|||
+Num: +Value +Size Type +Bind +Vis +Ndx Name
|
||||
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0 +FUNC +GLOBAL +DEFAULT +UND +__libc_start_main(@.*|)
|
||||
.* FUNC +GLOBAL +DEFAULT.* UND +(__libc_start_main(@.*|)|_?test)
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0+ +FUNC +GLOBAL +DEFAULT +UND +_?test
|
||||
.* FUNC +GLOBAL +DEFAULT.* UND +(__libc_start_main(@.*|)|_?test)
|
||||
#pass
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#...
|
||||
+ U _?puts(@.*|)
|
||||
[0-9a-z]+ T _?test
|
||||
[0-9a-z]+ [TD] _?test
|
||||
|
|
|
@ -14,7 +14,7 @@ Program Headers:
|
|||
+Num: +Value +Size Type +Bind +Vis +Ndx Name
|
||||
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0 +FUNC +GLOBAL +DEFAULT +UND +_?puts(@.*|)
|
||||
.* FUNC +GLOBAL +DEFAULT.* (UND +_?puts(@.*|)|[0-9]+ +_?test)
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +_?test
|
||||
.* FUNC +GLOBAL +DEFAULT.* (UND +_?puts(@.*|)|[0-9]+ +_?test)
|
||||
#pass
|
||||
|
|
|
@ -13,7 +13,7 @@ Program Headers:
|
|||
+Num: +Value +Size Type +Bind +Vis +Ndx Name
|
||||
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0 +FUNC +GLOBAL +DEFAULT +UND +_?puts(@.*|)
|
||||
.* FUNC +GLOBAL +DEFAULT.* (UND +_?puts(@.*|)|[0-9]+ +_?test)
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +_?test
|
||||
.* FUNC +GLOBAL +DEFAULT.* (UND +_?puts(@.*|)|[0-9]+ +_?test)
|
||||
#pass
|
||||
|
|
|
@ -14,13 +14,13 @@ Program Headers:
|
|||
+Num: +Value +Size Type +Bind +Vis +Ndx Name
|
||||
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +__start
|
||||
.* GLOBAL +DEFAULT.* __start
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_start
|
||||
.* GLOBAL +DEFAULT.* _start
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +main
|
||||
.* GLOBAL +DEFAULT.* main
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +start
|
||||
.* GLOBAL +DEFAULT.* start
|
||||
#...
|
||||
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +_main
|
||||
.* GLOBAL +DEFAULT.* _main
|
||||
#pass
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#...
|
||||
[0-9a-z]+ A __start
|
||||
[0-9a-z]+ [AD] __start
|
||||
#...
|
||||
[0-9a-z]+ A _main
|
||||
[0-9a-z]+ [AD] _main
|
||||
#...
|
||||
[0-9a-z]+ A _start
|
||||
[0-9a-z]+ [AD] _start
|
||||
#...
|
||||
[0-9a-z]+ A main
|
||||
[0-9a-z]+ [AD] main
|
||||
#...
|
||||
[0-9a-z]+ A start
|
||||
[0-9a-z]+ [AD] start
|
||||
#pass
|
||||
|
|
Loading…
Add table
Reference in a new issue