aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-scripts/crossref.exp
diff options
context:
space:
mode:
authorMatthew Fortune <matthew.fortune@imgtec.com>2016-04-14 11:49:53 +0100
committerMatthew Fortune <matthew.fortune@imgtec.com>2016-04-18 12:45:46 +0100
commitcdf969539c718acb1f3f031b2c55d5274a538717 (patch)
tree003ffa5726fcc2217dc4aafcdeb1efa46ff88b04 /ld/testsuite/ld-scripts/crossref.exp
parent5947319ef398728052a22575e1d0de0e94e4220f (diff)
downloadgdb-cdf969539c718acb1f3f031b2c55d5274a538717.zip
gdb-cdf969539c718acb1f3f031b2c55d5274a538717.tar.gz
gdb-cdf969539c718acb1f3f031b2c55d5274a538717.tar.bz2
Add new NOCROSSREFS_TO linker script command
NOCROSSREFS_TO is similar to the existing NOCROSSREFS command but only checks one direction of cross referencing. ld/ChangeLog * ld.texinfo: Document NOCROSSREFS_TO script command. * ldlang.h (struct lang_nocrossrefs): Add onlyfirst field. (lang_add_nocrossref_to): New prototype. * ldcref.c (check_local_sym_xref): Use onlyfirst to only look for symbols defined in the first section. (check_nocrossref): Likewise. * ldgram.y (NOCROSSREFS_TO): New script command. * ldlang.c (lang_add_nocrossref): Set onlyfirst to FALSE. (lang_add_nocrossref_to): New function. * ldlex.l (NOCROSSREFS_TO): New token. * NEWS: Mention NOCROSSREFS_TO. * testsuite/ld-scripts/cross4.t: New file. * testsuite/ld-scripts/cross5.t: Likewise. * testsuite/ld-scripts/cross6.t: Likewise. * testsuite/ld-scripts/cross7.t: Likewise. * testsuite/ld-scripts/crossref.exp: Run 4 new NOCROSSREFS_TO tests.
Diffstat (limited to 'ld/testsuite/ld-scripts/crossref.exp')
-rw-r--r--ld/testsuite/ld-scripts/crossref.exp64
1 files changed, 64 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp
index 7244b90..4371320 100644
--- a/ld/testsuite/ld-scripts/crossref.exp
+++ b/ld/testsuite/ld-scripts/crossref.exp
@@ -22,11 +22,19 @@
set test1 "NOCROSSREFS 1"
set test2 "NOCROSSREFS 2"
set test3 "NOCROSSREFS 3"
+set test4 "NOCROSSREFS_TO 1"
+set test5 "NOCROSSREFS_TO 2"
+set test6 "NOCROSSREFS_TO 3"
+set test7 "NOCROSSREFS_TO 4"
if { ![is_remote host] && [which $CC] == 0 } {
untested $test1
untested $test2
untested $test3
+ untested $test4
+ untested $test5
+ untested $test6
+ untested $test7
return
}
@@ -158,5 +166,61 @@ if [string match "" $exec_output] then {
fail $test3
}
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross4 -T $srcdir/$subdir/cross4.t tmpdir/cross4.o"]
+set exec_output [prune_warnings $exec_output]
+
+regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
+
+if [string match "" $exec_output] then {
+ pass $test4
+} else {
+ verbose -log "$exec_output"
+ fail $test4
+}
+
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross5 -T $srcdir/$subdir/cross5.t tmpdir/cross4.o"]
+set exec_output [prune_warnings $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 $test5
+} else {
+ verbose -log "$exec_output"
+ if [regexp "prohibited cross reference from .* to `.*' in" $exec_output] {
+ pass $test5
+ } else {
+ fail $test5
+ }
+}
+
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross6 -T $srcdir/$subdir/cross6.t tmpdir/cross3.o"]
+set exec_output [prune_warnings $exec_output]
+
+regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
+
+if [string match "" $exec_output] then {
+ pass $test6
+} else {
+ verbose -log "$exec_output"
+ fail $test6
+}
+
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross7 -T $srcdir/$subdir/cross7.t tmpdir/cross3.o"]
+set exec_output [prune_warnings $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 $test7
+} else {
+ verbose -log "$exec_output"
+ if [regexp "prohibited cross reference from .* to `.*' in" $exec_output] {
+ pass $test7
+ } else {
+ fail $test7
+ }
+}
+
set CFLAGS "$old_CFLAGS"
set CC "$old_CC"