* frame.c (get_prev_frame): Disable call to inside_entry_file().
[deliverable/binutils-gdb.git] / ld / testsuite / ld-scripts / crossref.exp
CommitLineData
252b5132
RH
1# Test NOCROSSREFS in a linker script.
2# By Ian Lance Taylor, Cygnus Support.
a2b64bed
NC
3# Copyright 2001
4# Free Software Foundation, Inc.
5#
6# This file is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
252b5132
RH
19
20set test1 "NOCROSSREFS 1"
21set test2 "NOCROSSREFS 2"
22
23if { [which $CC] == 0 } {
24 untested $test1
25 untested $test2
26 return
27}
28
29if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \
30 || ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } {
31 unresolved $test1
32 unresolved $test2
33 return
34}
35
1688b748 36set flags [big_or_little_endian]
252b5132
RH
37
38# The a29k compiled code calls V_SPILL and V_FILL. Since we don't
39# need to run this code, but we don't have definitions for those
40# functions, we just define them out.
41if [istarget a29k*-*-*] {
42 set flags "$flags --defsym V_SPILL=0 --defsym V_FILL=0"
43}
44
1b19eb81
AO
45if [istarget sh64*-*-elf] {
46 # This is what gcc passes to ld by default.
47 set flags "-mshelf32"
48}
49
252b5132
RH
50verbose -log "$ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"
51
52catch "exec $ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" exec_output
53
54set exec_output [prune_warnings $exec_output]
55
56regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
57
58if [string match "" $exec_output] then {
59 fail $test1
60} else {
61 verbose -log "$exec_output"
dbc37f89 62 if [regexp "prohibited cross reference from .* to `.*foo' in" $exec_output] {
252b5132
RH
63 pass $test1
64 } else {
65 fail $test1
66 }
67}
68
69# Check cross references within a single object.
70
71if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
72 unresolved $test2
73 return
74}
75
76verbose -log "$ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"
77
78catch "exec $ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o" exec_output
79
80set exec_output [prune_warnings $exec_output]
81
82regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
83
84if [string match "" $exec_output] then {
85 fail $test2
86} else {
87 verbose -log "$exec_output"
88 if [regexp "prohibited cross reference from .* to `.*' in" $exec_output] {
89 pass $test2
90 } else {
91 fail $test2
92 }
93}
This page took 0.156707 seconds and 4 git commands to generate.