update copyright dates
[deliverable/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.
aa820537 4# Copyright 2001, 2005, 2007
a2b64bed
NC
5# Free Software Foundation, Inc.
6#
f96b4a7b
NC
7# This file is part of the GNU Binutils.
8#
9# This program is free software; you can redistribute it and/or modify
a2b64bed 10# it under the terms of the GNU General Public License as published by
f96b4a7b 11# the Free Software Foundation; either version 3 of the License, or
a2b64bed 12# (at your option) any later version.
f96b4a7b 13#
a2b64bed
NC
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
f96b4a7b 18#
a2b64bed
NC
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
f96b4a7b
NC
21# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22# MA 02110-1301, USA.
252b5132
RH
23
24set testname "SIZEOF"
25
26if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] {
27 unresolved $testname
28 return
29}
30
31if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] {
32 fail $testname
33 return
34}
35
992c450d 36if ![ld_nm $nm "" tmpdir/sizeof] {
252b5132
RH
37 unresolved $testname
38 return
39}
40
41if {![info exists nm_output(text_start)] \
42 || ![info exists nm_output(text_end)] \
43 || ![info exists nm_output(data_start)] \
44 || ![info exists nm_output(data_end)] \
45 || ![info exists nm_output(sizeof_text)] \
46 || ![info exists nm_output(sizeof_data)]} {
47 send_log "bad output from nm\n"
48 verbose "bad output from nm"
49 fail $testname
50 return
51}
52
53if {$nm_output(text_end) - $nm_output(text_start) != $nm_output(sizeof_text)} {
54 send_log "text_end - text_start != sizeof_text\n"
55 verbose "text_end - text_start != sizeof_text"
56 fail $testname
57 return
58}
59
60if {$nm_output(data_end) - $nm_output(data_start) != $nm_output(sizeof_data)} {
61 send_log "data_end - data_start != sizeof_data\n"
62 verbose "data_end - data_start != sizeof_data"
63 fail $testname
64 return
65}
66
67if {$nm_output(sizeof_text) != $nm_output(sizeof_data)} {
68 send_log "sizeof_text != sizeof_data\n"
69 verbose "sizeof_text != sizeof_data"
70 fail $testname
71 return
72}
73
74pass $testname
This page took 0.430242 seconds and 4 git commands to generate.