* ld-scripts/crossref.exp: New test.
authorIan Lance Taylor <ian@airs.com>
Thu, 1 Aug 1996 18:12:22 +0000 (18:12 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 1 Aug 1996 18:12:22 +0000 (18:12 +0000)
* ld-scripts/cross1.c, ld-scripts/cross2.c: New files.
* ld-scripts/crossref.t: New file.

ld/testsuite/ChangeLog
ld/testsuite/ld-scripts/.Sanitize
ld/testsuite/ld-scripts/cross1.c [new file with mode: 0644]
ld/testsuite/ld-scripts/cross2.c [new file with mode: 0644]
ld/testsuite/ld-scripts/crossref.exp [new file with mode: 0644]
ld/testsuite/ld-scripts/crossref.t [new file with mode: 0644]

index 2e6f9149307138572612d604bbf92dd8772b85f9..ed29e3021a7bf95c509285793fff287a8916b72c 100644 (file)
@@ -1,3 +1,18 @@
+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.
+
+Sat Jun 29 13:40:11 1996  Ian Lance Taylor  <ian@cygnus.com>
+
+       * ld-sh/sh.exp: Fix debugging messages.
+       * ld-sh/sh1.s: Use .align 4.
+
+Wed May  1 16:45:13 1996  Ian Lance Taylor  <ian@cygnus.com>
+
+       * ld-sh/sh.exp: Use -O when compiling with -mrelax.
+
 Mon Apr 29 10:33:10 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
        * ld-shared/shared.exp: Run the shared library tests on
index 97524820b45999398726d07c9fb089271113a183..176af22e97ab64df19852253ec761f6c8ac6c92c 100644 (file)
@@ -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 (file)
index 0000000..5678945
--- /dev/null
@@ -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 (file)
index 0000000..4143177
--- /dev/null
@@ -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 (file)
index 0000000..4c53d5d
--- /dev/null
@@ -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 (file)
index 0000000..e1948c9
--- /dev/null
@@ -0,0 +1,6 @@
+NOCROSSREFS ( .text .data )
+SECTIONS
+{
+  .text : { tmpdir/cross1.o }
+  .data : { tmpdir/cross2.o }
+}