From: Ian Lance Taylor Date: Thu, 1 Aug 1996 18:12:22 +0000 (+0000) Subject: * ld-scripts/crossref.exp: New test. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc4c9b927b51cb5ea6902b1545a70aaf242d6665;p=binutils-gdb.git * ld-scripts/crossref.exp: New test. * ld-scripts/cross1.c, ld-scripts/cross2.c: New files. * ld-scripts/crossref.t: New file. --- diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 2e6f9149307..ed29e3021a7 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,18 @@ +Thu Aug 1 14:10:27 1996 Ian Lance Taylor + + * ld-scripts/crossref.exp: New test. + * ld-scripts/cross1.c, ld-scripts/cross2.c: New files. + * ld-scripts/crossref.t: New file. + +Sat Jun 29 13:40:11 1996 Ian Lance Taylor + + * ld-sh/sh.exp: Fix debugging messages. + * ld-sh/sh1.s: Use .align 4. + +Wed May 1 16:45:13 1996 Ian Lance Taylor + + * ld-sh/sh.exp: Use -O when compiling with -mrelax. + Mon Apr 29 10:33:10 1996 Andreas Schwab * ld-shared/shared.exp: Run the shared library tests on diff --git a/ld/testsuite/ld-scripts/.Sanitize b/ld/testsuite/ld-scripts/.Sanitize index 97524820b45..176af22e97a 100644 --- a/ld/testsuite/ld-scripts/.Sanitize +++ b/ld/testsuite/ld-scripts/.Sanitize @@ -23,6 +23,10 @@ Do-first: Things-to-keep: +cross1.c +cross2.c +crossref.exp +crossref.t defined.exp defined.s defined.t diff --git a/ld/testsuite/ld-scripts/cross1.c b/ld/testsuite/ld-scripts/cross1.c new file mode 100644 index 00000000000..56789452a5b --- /dev/null +++ b/ld/testsuite/ld-scripts/cross1.c @@ -0,0 +1,6 @@ +extern int foo (); +int +func () +{ + return foo (); +} diff --git a/ld/testsuite/ld-scripts/cross2.c b/ld/testsuite/ld-scripts/cross2.c new file mode 100644 index 00000000000..414317712d1 --- /dev/null +++ b/ld/testsuite/ld-scripts/cross2.c @@ -0,0 +1,5 @@ +int +foo () +{ + return 1; +} diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp new file mode 100644 index 00000000000..4c53d5dd149 --- /dev/null +++ b/ld/testsuite/ld-scripts/crossref.exp @@ -0,0 +1,33 @@ +# Test NOCROSSREFS in a linker script. +# By Ian Lance Taylor, Cygnus Support. + +set testname "NOCROSSREFS" + +if { [which $CC] == 0 } { + untested $testname + return +} + +if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \ + || ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } { + unresolved $testname + return +} + +verbose -log "$ld -o tmpdir/crossref -T $srcdir/$subdir/crossref.t tmpdir/cross1.o tmpdir/cross2.o" + +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 +} else { + verbose -log "$exec_output" + if [regexp "prohibited cross reference from .* to `foo' in" $exec_output] { + pass $testname + } else { + fail $testname + } +} diff --git a/ld/testsuite/ld-scripts/crossref.t b/ld/testsuite/ld-scripts/crossref.t new file mode 100644 index 00000000000..e1948c9e09f --- /dev/null +++ b/ld/testsuite/ld-scripts/crossref.t @@ -0,0 +1,6 @@ +NOCROSSREFS ( .text .data ) +SECTIONS +{ + .text : { tmpdir/cross1.o } + .data : { tmpdir/cross2.o } +}