1 # Test basic linker script functionality
2 # By Ian Lance Taylor
, Cygnus Support
3 # Copyright
1999, 2000, 2001, 2002, 2004, 2006, 2007
4 # Free Software Foundation
, Inc.
6 # This file is part of the GNU Binutils.
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.
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.
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
,
25 if ![ld_assemble $as $srcdir
/$subdir
/script.s tmpdir
/script.o
] {
30 proc check_script
{ } {
35 if ![ld_nm $nm
"" tmpdir/script] {
40 if {![info exists nm_output
(text_start
)] \
41 ||
![info exists nm_output
(text_end
)] \
42 ||
![info exists nm_output
(data_start
)] \
43 ||
![info exists nm_output
(data_end
)]} {
44 send_log
"bad output from nm\n"
45 verbose
"bad output from nm"
54 if [istarget
*c4x
*-*-*] then {
59 if [istarget
*c54x
*-*-*] then {
64 if {$nm_output
(text_start
) != 0x100} {
65 send_log
"text_start == $nm_output(text_start)\n"
66 verbose
"text_start == $nm_output(text_start)"
70 if {$nm_output
(text_end
) < $text_end \
71 || $nm_output
(text_end
) > 0x110} {
72 send_log
"text_end == $nm_output(text_end)\n"
73 verbose
"text_end == $nm_output(text_end)"
77 if {$nm_output
(data_start
) != 0x1000} {
78 send_log
"data_start == $nm_output(data_start)\n"
79 verbose
"data_start == $nm_output(data_start)"
83 if {$nm_output
(data_end
) < $data_end \
84 || $nm_output
(data_end
) > 0x1010} {
85 send_log
"data_end == $nm_output(data_end)\n"
86 verbose
"data_end == $nm_output(data_end)"
97 # PE targets need to
set the image base to
0 to avoid complications from nm.
99 if {[istarget
"*-*-pe*"] \
100 ||
[istarget
"*-*-cygwin*"] \
101 ||
[istarget
"*-*-mingw*"] \
102 ||
[istarget
"*-*-winnt*"] \
103 ||
[istarget
"*-*-nt"] \
104 ||
[istarget
"*-*-interix*"] } then {
105 set flags
"--image-base 0"
108 if ![ld_simple_link $
ld tmpdir
/script
"$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
114 set testname
"MRI script"
116 if ![ld_simple_link $
ld tmpdir
/script
"$flags -c $srcdir/$subdir/scriptm.t"] {
122 set testname
"MEMORY"
124 if ![ld_simple_link $
ld tmpdir
/script
"$flags -T $srcdir/$subdir/memory.t tmpdir/script.o"] {