]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-scripts/sizeof.exp
* gdbint.texinfo (Host Definition): Remove description of
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-scripts / sizeof.exp
CommitLineData
252b5132
RH
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.
a2b64bed
NC
4# Copyright 2001
5# Free Software Foundation, Inc.
6#
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.
11#
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.
16#
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.
252b5132
RH
20
21set testname "SIZEOF"
22
23if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] {
24 unresolved $testname
25 return
26}
27
28if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] {
29 fail $testname
30 return
31}
32
33if ![ld_nm $nm tmpdir/sizeof] {
34 unresolved $testname
35 return
36}
37
38if {![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
48}
49
50if {$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
55}
56
57if {$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
62}
63
64if {$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
69}
70
71pass $testname