1 # Test basic linker script functionality
2 # By Ian Lance Taylor, Cygnus Support
6 if ![ld_assemble $as $srcdir/$subdir/script.s tmpdir/script.o] {
11 proc check_script { } {
16 if ![ld_nm $nm tmpdir/script] {
19 if {![info exists nm_output(text_start)] \
20 || ![info exists nm_output(text_end)] \
21 || ![info exists nm_output(data_start)] \
22 || ![info exists nm_output(data_end)]} {
23 send_log "bad output from nm\n"
24 verbose "bad output from nm"
27 if {$nm_output(text_start) != 0x100} {
28 send_log "text_start == $nm_output(text_start)\n"
29 verbose "text_start == $nm_output(text_start)"
31 } else { if {$nm_output(text_end) < 0x104 \
32 || $nm_output(text_end) > 0x110} {
33 send_log "text_end == $nm_output(text_end)\n"
34 verbose "text_end == $nm_output(text_end)"
36 } else { if {$nm_output(data_start) != 0x1000} {
37 send_log "data_start == $nm_output(data_start)\n"
38 verbose "data_start == $nm_output(data_start)"
40 } else { if {$nm_output(data_end) < 0x1004 \
41 || $nm_output(data_end) > 0x1010} {
42 send_log "data_end == $nm_output(data_end)\n"
43 verbose "data_end == $nm_output(data_end)"
52 # PE targets need to set the image base to 0 to avoid complications from nm.
54 if {[istarget "*-*-pe*"] \
55 || [istarget "*-*-cygwin*"] \
56 || [istarget "*-*-mingw32*"] \
57 || [istarget "*-*-winnt*"] \
58 || [istarget "*-*-nt*"] \
59 || [istarget "*-*-interix*"] } then {
60 set flags "--image-base 0"
63 if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
69 set testname "MRI script"
71 if ![ld_simple_link $ld tmpdir/script "$flags -c $srcdir/$subdir/scriptm.t"] {