update copyright dates
[deliverable/binutils-gdb.git] / ld / testsuite / ld-scripts / sizeof.exp
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, 2005, 2007
5 # Free Software Foundation, Inc.
6 #
7 # This file is part of the GNU Binutils.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13 #
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.
18 #
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
21 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 # MA 02110-1301, USA.
23
24 set testname "SIZEOF"
25
26 if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] {
27 unresolved $testname
28 return
29 }
30
31 if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] {
32 fail $testname
33 return
34 }
35
36 if ![ld_nm $nm "" tmpdir/sizeof] {
37 unresolved $testname
38 return
39 }
40
41 if {![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
53 if {$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
60 if {$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
67 if {$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
74 pass $testname
This page took 0.033379 seconds and 5 git commands to generate.