1 # Test NOCROSSREFS in a linker script.
2 # By Ian Lance Taylor, Cygnus Support.
4 set test1 "NOCROSSREFS 1"
5 set test2 "NOCROSSREFS 2"
7 if { [which $CC] == 0 } {
13 if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \
14 || ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } {
22 # The a29k compiled code calls V_SPILL and V_FILL. Since we don't
23 # need to run this code, but we don't have definitions for those
24 # functions, we just define them out.
25 if [istarget a29k*-*-*] {
26 set flags "$flags --defsym V_SPILL=0 --defsym V_FILL=0"
29 # hppa-elf needs a definition for $global$.
30 if [istarget hppa*-*-*] {
31 set flags "$flags --defsym '\$global\$'=0"
34 verbose -log "$ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"
36 catch "exec $ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" exec_output
38 set exec_output [prune_warnings $exec_output]
40 regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
42 if [string match "" $exec_output] then {
45 verbose -log "$exec_output"
46 if [regexp "prohibited cross reference from .* to `foo' in" $exec_output] {
53 # Check cross references within a single object.
55 if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
60 verbose -log "$ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"
62 catch "exec $ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o" exec_output
64 set exec_output [prune_warnings $exec_output]
66 regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
68 if [string match "" $exec_output] then {
71 verbose -log "$exec_output"
72 if [regexp "prohibited cross reference from .* to `.*' in" $exec_output] {