1 # Test basic linker script functionality
2 # By Ian Lance Taylor
, Cygnus Support
3 # Copyright
1999, 2000, 2001, 2002, 2004, 2006
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.
, 51 Franklin Street
- Fifth Floor
, Boston
, MA
02110-1301, USA.
22 if ![ld_assemble $as $srcdir
/$subdir
/script.s tmpdir
/script.o
] {
27 proc check_script
{ } {
32 if ![ld_nm $nm
"" tmpdir/script] {
37 if {![info exists nm_output
(text_start
)] \
38 ||
![info exists nm_output
(text_end
)] \
39 ||
![info exists nm_output
(data_start
)] \
40 ||
![info exists nm_output
(data_end
)]} {
41 send_log
"bad output from nm\n"
42 verbose
"bad output from nm"
51 if [istarget
*c4x
*-*-*] then {
56 if [istarget
*c54x
*-*-*] then {
61 if {$nm_output
(text_start
) != 0x100} {
62 send_log
"text_start == $nm_output(text_start)\n"
63 verbose
"text_start == $nm_output(text_start)"
67 if {$nm_output
(text_end
) < $text_end \
68 || $nm_output
(text_end
) > 0x110} {
69 send_log
"text_end == $nm_output(text_end)\n"
70 verbose
"text_end == $nm_output(text_end)"
74 if {$nm_output
(data_start
) != 0x1000} {
75 send_log
"data_start == $nm_output(data_start)\n"
76 verbose
"data_start == $nm_output(data_start)"
80 if {$nm_output
(data_end
) < $data_end \
81 || $nm_output
(data_end
) > 0x1010} {
82 send_log
"data_end == $nm_output(data_end)\n"
83 verbose
"data_end == $nm_output(data_end)"
94 # PE targets need to
set the image base to
0 to avoid complications from nm.
96 if {[istarget
"*-*-pe*"] \
97 ||
[istarget
"*-*-cygwin*"] \
98 ||
[istarget
"*-*-mingw*"] \
99 ||
[istarget
"*-*-winnt*"] \
100 ||
[istarget
"*-*-nt"] \
101 ||
[istarget
"*-*-interix*"] } then {
102 set flags
"--image-base 0"
105 if ![ld_simple_link $
ld tmpdir
/script
"$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
111 set testname
"MRI script"
113 if ![ld_simple_link $
ld tmpdir
/script
"$flags -c $srcdir/$subdir/scriptm.t"] {
119 set testname
"MEMORY"
121 if ![ld_simple_link $
ld tmpdir
/script
"$flags -T $srcdir/$subdir/memory.t tmpdir/script.o"] {