* cxxfilt.c: Treat mangled names specified on the command line in the same way
[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.
aef6203b 3# Copyright 2000, 2001, 2002, 2003, 2004
a2b64bed
NC
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
75be928b 18# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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
e0001a05
NC
29# Xtensa targets currently default to putting literal values in a separate
30# section and that requires linker script support, so put literals in text.
31global CFLAGS
32if [istarget xtensa*-*-*] {
33 set CFLAGS "$CFLAGS -mtext-section-literals"
34}
35
252b5132
RH
36if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \
37 || ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } {
38 unresolved $test1
39 unresolved $test2
40 return
41}
42
1688b748 43set flags [big_or_little_endian]
252b5132 44
1b19eb81
AO
45if [istarget sh64*-*-elf] {
46 # This is what gcc passes to ld by default.
47 set flags "-mshelf32"
48}
49
08ccf96b
L
50# IA64 has both ordered and unordered sections in an input file.
51setup_xfail ia64-*-*
52
252b5132
RH
53verbose -log "$ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"
54
55catch "exec $ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" exec_output
56
57set exec_output [prune_warnings $exec_output]
58
59regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
60
61if [string match "" $exec_output] then {
62 fail $test1
63} else {
64 verbose -log "$exec_output"
dbc37f89 65 if [regexp "prohibited cross reference from .* to `.*foo' in" $exec_output] {
252b5132
RH
66 pass $test1
67 } else {
68 fail $test1
69 }
70}
71
72# Check cross references within a single object.
73
74if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
75 unresolved $test2
76 return
77}
78
79verbose -log "$ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"
80
81catch "exec $ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o" exec_output
82
83set exec_output [prune_warnings $exec_output]
84
85regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
86
87if [string match "" $exec_output] then {
88 fail $test2
89} else {
90 verbose -log "$exec_output"
91 if [regexp "prohibited cross reference from .* to `.*' in" $exec_output] {
92 pass $test2
93 } else {
94 fail $test2
95 }
96}
This page took 0.328992 seconds and 4 git commands to generate.