1 # Test basic linker script functionality
2 # By Ian Lance Taylor, Cygnus Support
4 # Free Software Foundation, Inc.
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.
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.
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.
22 if ![ld_assemble $as $srcdir/$subdir/script.s tmpdir/script.o] {
27 proc check_script { } {
32 if ![ld_nm $nm tmpdir/script] {
35 if {![info exists nm_output(text_start)] \
36 || ![info exists nm_output(text_end)] \
37 || ![info exists nm_output(data_start)] \
38 || ![info exists nm_output(data_end)]} {
39 send_log "bad output from nm\n"
40 verbose "bad output from nm"
45 if [istarget *c54x*-*-*] then {
49 if {$nm_output(text_start) != 0x100} {
50 send_log "text_start == $nm_output(text_start)\n"
51 verbose "text_start == $nm_output(text_start)"
53 } else { if {$nm_output(text_end) < $text_end \
54 || $nm_output(text_end) > 0x110} {
55 send_log "text_end == $nm_output(text_end)\n"
56 verbose "text_end == $nm_output(text_end)"
58 } else { if {$nm_output(data_start) != 0x1000} {
59 send_log "data_start == $nm_output(data_start)\n"
60 verbose "data_start == $nm_output(data_start)"
62 } else { if {$nm_output(data_end) < $data_end \
63 || $nm_output(data_end) > 0x1010} {
64 send_log "data_end == $nm_output(data_end)\n"
65 verbose "data_end == $nm_output(data_end)"
74 # PE targets need to set the image base to 0 to avoid complications from nm.
76 if {[istarget "*-*-pe*"] \
77 || [istarget "*-*-cygwin*"] \
78 || [istarget "*-*-mingw32*"] \
79 || [istarget "*-*-winnt*"] \
80 || [istarget "*-*-nt*"] \
81 || [istarget "*-*-interix*"] } then {
82 set flags "--image-base 0"
85 if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
91 set testname "MRI script"
93 if ![ld_simple_link $ld tmpdir/script "$flags -c $srcdir/$subdir/scriptm.t"] {