OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [ld/] [testsuite/] [ld-scripts/] [crossref.exp] - Blame information for rev 38

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
# Test NOCROSSREFS in a linker script.
2
# By Ian Lance Taylor, Cygnus Support.
3
#   Copyright 2000, 2001, 2002, 2003, 2004, 2007
4
#   Free Software Foundation, Inc.
5
#
6
# This file is part of the GNU Binutils.
7
#
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21
# MA 02110-1301, USA.
22
 
23
set test1 "NOCROSSREFS 1"
24
set test2 "NOCROSSREFS 2"
25
set test3 "NOCROSSREFS 3"
26
 
27
if { ![is_remote host] && [which $CC] == 0 } {
28
    untested $test1
29
    untested $test2
30
    untested $test3
31
    return
32
}
33
 
34
# Xtensa targets currently default to putting literal values in a separate
35
# section and that requires linker script support, so put literals in text.
36
global CFLAGS
37
if [istarget xtensa*-*-*] {
38
    set CFLAGS "$CFLAGS -mtext-section-literals"
39
}
40
 
41
# If we have a compiler that doesn't use/reference dot-symbols, then
42
# calls to functions reference the .opd section function descriptor.
43
# This makes NOCROSSREFS rather useless on powerpc64.
44
if [istarget powerpc64*-*-*] {
45
    set CFLAGS "$CFLAGS -mcall-aixdesc"
46
}
47
 
48
# Prevent the use of the MeP's small data area which references a symbol
49
# called __sdabase which will not be defined by our test linker scripts.
50
if [istarget mep*-*-elf] {
51
    set CFLAGS "-mtiny=0"
52
}
53
 
54
if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \
55
     || ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } {
56
    unresolved $test1
57
    unresolved $test2
58
    return
59
}
60
 
61
set flags [big_or_little_endian]
62
 
63
if [istarget sh64*-*-elf] {
64
    # This is what gcc passes to ld by default.
65
    set flags "-mshelf32"
66
}
67
 
68
# IA64 has both ordered and unordered sections in an input file.
69
setup_xfail ia64-*-*
70
 
71
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"]
72
 
73
set exec_output [prune_warnings $exec_output]
74
 
75
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
76
 
77
if [string match "" $exec_output] then {
78
    fail $test1
79
} else {
80
    verbose -log "$exec_output"
81
    if [regexp "prohibited cross reference from .* to `.*foo' in" $exec_output] {
82
        pass $test1
83
    } else {
84
        fail $test1
85
    }
86
}
87
 
88
# Check cross references within a single object.
89
 
90
if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
91
    unresolved $test2
92
    return
93
}
94
 
95
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"]
96
set exec_output [prune_warnings $exec_output]
97
 
98
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
99
 
100
if [string match "" $exec_output] then {
101
    fail $test2
102
} else {
103
    verbose -log "$exec_output"
104
    if [regexp "prohibited cross reference from .* to `.*' in" $exec_output] {
105
        pass $test2
106
    } else {
107
        fail $test2
108
    }
109
}
110
 
111
# Check cross references for ld -r
112
 
113
if { ![ld_compile $CC "$srcdir/$subdir/cross4.c" tmpdir/cross4.o] } {
114
    unresolved $test3
115
    return
116
}
117
 
118
if ![ld_relocate $ld tmpdir/cross3-partial.o "tmpdir/cross1.o tmpdir/cross4.o"] {
119
    unresolved $test3
120
    return
121
}
122
 
123
set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o"]
124
 
125
set exec_output [prune_warnings $exec_output]
126
 
127
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
128
 
129
if [string match "" $exec_output] then {
130
    pass $test3
131
} else {
132
    verbose -log "$exec_output"
133
    fail $test3
134
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.