2000-10-31 Philip Blundell <philb@gnu.org>
[binutils.git] / ld / testsuite / ld-scripts / sizeof.exp
blob3bdefd4f0dcba365f433b18cad6564ae6fa8b595
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.
5 set testname "SIZEOF"
7 if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] {
8 unresolved $testname
9 return
12 if ![ld_simple_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] {
13 fail $testname
14 return
17 if ![ld_nm $nm tmpdir/sizeof] {
18 unresolved $testname
19 return
22 if {![info exists nm_output(text_start)] \
23 || ![info exists nm_output(text_end)] \
24 || ![info exists nm_output(data_start)] \
25 || ![info exists nm_output(data_end)] \
26 || ![info exists nm_output(sizeof_text)] \
27 || ![info exists nm_output(sizeof_data)]} {
28 send_log "bad output from nm\n"
29 verbose "bad output from nm"
30 fail $testname
31 return
34 if {$nm_output(text_end) - $nm_output(text_start) != $nm_output(sizeof_text)} {
35 send_log "text_end - text_start != sizeof_text\n"
36 verbose "text_end - text_start != sizeof_text"
37 fail $testname
38 return
41 if {$nm_output(data_end) - $nm_output(data_start) != $nm_output(sizeof_data)} {
42 send_log "data_end - data_start != sizeof_data\n"
43 verbose "data_end - data_start != sizeof_data"
44 fail $testname
45 return
48 if {$nm_output(sizeof_text) != $nm_output(sizeof_data)} {
49 send_log "sizeof_text != sizeof_data\n"
50 verbose "sizeof_text != sizeof_data"
51 fail $testname
52 return
55 pass $testname