diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-08-01 18:33:47 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-08-01 18:33:47 +0000 |
commit | c1ebd1ce1799a6068f94039ec711a135223259e8 (patch) | |
tree | be997f9c26d02984b7980584e1858e4450069497 /ld/testsuite | |
parent | bc4c9b927b51cb5ea6902b1545a70aaf242d6665 (diff) | |
download | gdb-c1ebd1ce1799a6068f94039ec711a135223259e8.zip gdb-c1ebd1ce1799a6068f94039ec711a135223259e8.tar.gz gdb-c1ebd1ce1799a6068f94039ec711a135223259e8.tar.bz2 |
rework crossref test
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/.Sanitize | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/cross2.t | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/cross3.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/crossref.exp | 46 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/crossref.t | 6 |
6 files changed, 56 insertions, 17 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index ed29e30..5633621 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -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> diff --git a/ld/testsuite/ld-scripts/.Sanitize b/ld/testsuite/ld-scripts/.Sanitize index 176af22..2305cf8 100644 --- a/ld/testsuite/ld-scripts/.Sanitize +++ b/ld/testsuite/ld-scripts/.Sanitize @@ -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 diff --git a/ld/testsuite/ld-scripts/cross2.t b/ld/testsuite/ld-scripts/cross2.t new file mode 100644 index 0000000..c3ae118 --- /dev/null +++ b/ld/testsuite/ld-scripts/cross2.t @@ -0,0 +1,6 @@ +NOCROSSREFS ( .text .data ) +SECTIONS +{ + .text : { *(.text) } + .data : { *(.data) *(.sdata) } +} diff --git a/ld/testsuite/ld-scripts/cross3.c b/ld/testsuite/ld-scripts/cross3.c new file mode 100644 index 0000000..1848c32 --- /dev/null +++ b/ld/testsuite/ld-scripts/cross3.c @@ -0,0 +1,7 @@ +int i = 4; + +int +foo () +{ + return i; +} diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp index 4c53d5d..2404adb 100644 --- a/ld/testsuite/ld-scripts/crossref.exp +++ b/ld/testsuite/ld-scripts/crossref.exp @@ -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 $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 $testname + fail $test2 } } diff --git a/ld/testsuite/ld-scripts/crossref.t b/ld/testsuite/ld-scripts/crossref.t deleted file mode 100644 index e1948c9..0000000 --- a/ld/testsuite/ld-scripts/crossref.t +++ /dev/null @@ -1,6 +0,0 @@ -NOCROSSREFS ( .text .data ) -SECTIONS -{ - .text : { tmpdir/cross1.o } - .data : { tmpdir/cross2.o } -} |