rework crossref test
authorIan Lance Taylor <ian@airs.com>
Thu, 1 Aug 1996 18:33:47 +0000 (18:33 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 1 Aug 1996 18:33:47 +0000 (18:33 +0000)
ld/testsuite/ChangeLog
ld/testsuite/ld-scripts/.Sanitize
ld/testsuite/ld-scripts/cross2.t [new file with mode: 0644]
ld/testsuite/ld-scripts/cross3.c [new file with mode: 0644]
ld/testsuite/ld-scripts/crossref.exp
ld/testsuite/ld-scripts/crossref.t [deleted file]

index ed29e3021a7bf95c509285793fff287a8916b72c..5633621d1a50e439fbfd501d53048f3f93c7bac7 100644 (file)
@@ -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>
 
index 176af22e97ab64df19852253ec761f6c8ac6c92c..2305cf80bfa061d50d646a8e53eb746fe3fcd4ca 100644 (file)
@@ -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 (file)
index 0000000..c3ae118
--- /dev/null
@@ -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 (file)
index 0000000..1848c32
--- /dev/null
@@ -0,0 +1,7 @@
+int i = 4;
+
+int
+foo ()
+{
+  return i;
+}
index 4c53d5dd1498a43140dfbed1de921258feb66774..2404adbe0391667ff80bae7f38920c3caac79999 100644 (file)
@@ -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 (file)
index e1948c9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-NOCROSSREFS ( .text .data )
-SECTIONS
-{
-  .text : { tmpdir/cross1.o }
-  .data : { tmpdir/cross2.o }
-}
This page took 0.027447 seconds and 4 git commands to generate.