daily update
[binutils.git] / ld / testsuite / ld-scripts / sizeof.exp
blob5bb957a9505de3abe536f0c1ee3b1fbb0aa44c80
1 # Test SIZEOF in a linker script.
2 # By Ian Lance Taylor, Cygnus Support
3 # Based on a bug report from anders.blomdell@control.lth.se.
4 # Copyright 2001
5 # Free Software Foundation, Inc.
7 # This file is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 set testname "SIZEOF"
23 if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] {
24 unresolved $testname
25 return
28 if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] {
29 fail $testname
30 return
33 if ![ld_nm $nm "" tmpdir/sizeof] {
34 unresolved $testname
35 return
38 if {![info exists nm_output(text_start)] \
39 || ![info exists nm_output(text_end)] \
40 || ![info exists nm_output(data_start)] \
41 || ![info exists nm_output(data_end)] \
42 || ![info exists nm_output(sizeof_text)] \
43 || ![info exists nm_output(sizeof_data)]} {
44 send_log "bad output from nm\n"
45 verbose "bad output from nm"
46 fail $testname
47 return
50 if {$nm_output(text_end) - $nm_output(text_start) != $nm_output(sizeof_text)} {
51 send_log "text_end - text_start != sizeof_text\n"
52 verbose "text_end - text_start != sizeof_text"
53 fail $testname
54 return
57 if {$nm_output(data_end) - $nm_output(data_start) != $nm_output(sizeof_data)} {
58 send_log "data_end - data_start != sizeof_data\n"
59 verbose "data_end - data_start != sizeof_data"
60 fail $testname
61 return
64 if {$nm_output(sizeof_text) != $nm_output(sizeof_data)} {
65 send_log "sizeof_text != sizeof_data\n"
66 verbose "sizeof_text != sizeof_data"
67 fail $testname
68 return
71 pass $testname