rework crossref test
This commit is contained in:
parent
bc4c9b927b
commit
c1ebd1ce17
6 changed files with 56 additions and 17 deletions
|
@ -1,8 +1,8 @@
|
|||
Thu Aug 1 14:10:27 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* ld-scripts/crossref.exp: New test.
|
||||
* ld-scripts/cross1.c, ld-scripts/cross2.c: New files.
|
||||
* ld-scripts/crossref.t: New file.
|
||||
* ld-scripts/{cross1.c, cross2.c, cross3.c}: New files.
|
||||
* ld-scripts/{cross1.t, cross2.t}: New files.
|
||||
|
||||
Sat Jun 29 13:40:11 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
|
|
|
@ -24,9 +24,11 @@ Do-first:
|
|||
Things-to-keep:
|
||||
|
||||
cross1.c
|
||||
cross1.t
|
||||
cross2.c
|
||||
cross2.t
|
||||
cross3.c
|
||||
crossref.exp
|
||||
crossref.t
|
||||
defined.exp
|
||||
defined.s
|
||||
defined.t
|
||||
|
|
6
ld/testsuite/ld-scripts/cross2.t
Normal file
6
ld/testsuite/ld-scripts/cross2.t
Normal file
|
@ -0,0 +1,6 @@
|
|||
NOCROSSREFS ( .text .data )
|
||||
SECTIONS
|
||||
{
|
||||
.text : { *(.text) }
|
||||
.data : { *(.data) *(.sdata) }
|
||||
}
|
7
ld/testsuite/ld-scripts/cross3.c
Normal file
7
ld/testsuite/ld-scripts/cross3.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
int i = 4;
|
||||
|
||||
int
|
||||
foo ()
|
||||
{
|
||||
return i;
|
||||
}
|
|
@ -1,33 +1,63 @@
|
|||
# Test NOCROSSREFS in a linker script.
|
||||
# By Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
set testname "NOCROSSREFS"
|
||||
set test1 "NOCROSSREFS 1"
|
||||
set test2 "NOCROSSREFS 2"
|
||||
|
||||
if { [which $CC] == 0 } {
|
||||
untested $testname
|
||||
untested $test1
|
||||
untested $test2
|
||||
return
|
||||
}
|
||||
|
||||
if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \
|
||||
|| ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } {
|
||||
unresolved $testname
|
||||
unresolved $test1
|
||||
unresolved $test2
|
||||
return
|
||||
}
|
||||
|
||||
verbose -log "$ld -o tmpdir/crossref -T $srcdir/$subdir/crossref.t tmpdir/cross1.o tmpdir/cross2.o"
|
||||
verbose -log "$ld -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"
|
||||
|
||||
catch "exec $ld -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" exec_output
|
||||
|
||||
catch "exec $ld -o tmpdir/crossref -T $srcdir/$subdir/crossref.t tmpdir/cross1.o tmpdir/cross2.o" exec_output
|
||||
set exec_output [prune_system_crud $host_triplet $exec_output]
|
||||
|
||||
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
|
||||
|
||||
if [string match "" $exec_output] then {
|
||||
fail $testname
|
||||
fail $test1
|
||||
} else {
|
||||
verbose -log "$exec_output"
|
||||
if [regexp "prohibited cross reference from .* to `foo' in" $exec_output] {
|
||||
pass $testname
|
||||
pass $test1
|
||||
} else {
|
||||
fail $testname
|
||||
fail $test1
|
||||
}
|
||||
}
|
||||
|
||||
# Check cross references within a single object.
|
||||
|
||||
if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
|
||||
unresolved $test2
|
||||
return
|
||||
}
|
||||
|
||||
verbose -log "$ld -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"
|
||||
|
||||
catch "exec $ld -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o" exec_output
|
||||
|
||||
set exec_output [prune_system_crud $host_triplet $exec_output]
|
||||
|
||||
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
|
||||
|
||||
if [string match "" $exec_output] then {
|
||||
fail $test2
|
||||
} else {
|
||||
verbose -log "$exec_output"
|
||||
if [regexp "prohibited cross reference from .* to `.*' in" $exec_output] {
|
||||
pass $test2
|
||||
} else {
|
||||
fail $test2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
NOCROSSREFS ( .text .data )
|
||||
SECTIONS
|
||||
{
|
||||
.text : { tmpdir/cross1.o }
|
||||
.data : { tmpdir/cross2.o }
|
||||
}
|
Loading…
Reference in a new issue