tic54x/ibmc54xdsp target for ld.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-scripts / script.exp
1 # Test basic linker script functionality
2 # By Ian Lance Taylor, Cygnus Support
3
4 set testname "script"
5
6 if ![ld_assemble $as $srcdir/$subdir/script.s tmpdir/script.o] {
7 unresolved $testname
8 return
9 }
10
11 proc check_script { } {
12 global nm
13 global testname
14 global nm_output
15
16 if ![ld_nm $nm tmpdir/script] {
17 unresolved $testname
18 } else {
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"
25 fail $testname
26 } else {
27 set text_end 0x104
28 set data_end 0x1004
29 if [istarget *c54x*-*-*] then {
30 set text_end 0x102
31 set data_end 0x1002
32 }
33 if {$nm_output(text_start) != 0x100} {
34 send_log "text_start == $nm_output(text_start)\n"
35 verbose "text_start == $nm_output(text_start)"
36 fail $testname
37 } else { if {$nm_output(text_end) < $text_end \
38 || $nm_output(text_end) > 0x110} {
39 send_log "text_end == $nm_output(text_end)\n"
40 verbose "text_end == $nm_output(text_end)"
41 fail $testname
42 } else { if {$nm_output(data_start) != 0x1000} {
43 send_log "data_start == $nm_output(data_start)\n"
44 verbose "data_start == $nm_output(data_start)"
45 fail $testname
46 } else { if {$nm_output(data_end) < $data_end \
47 || $nm_output(data_end) > 0x1010} {
48 send_log "data_end == $nm_output(data_end)\n"
49 verbose "data_end == $nm_output(data_end)"
50 fail $testname
51 } else {
52 pass $testname
53 } } } }
54 }
55 }
56 }
57
58 # PE targets need to set the image base to 0 to avoid complications from nm.
59 set flags ""
60 if {[istarget "*-*-pe*"] \
61 || [istarget "*-*-cygwin*"] \
62 || [istarget "*-*-mingw32*"] \
63 || [istarget "*-*-winnt*"] \
64 || [istarget "*-*-nt*"] \
65 || [istarget "*-*-interix*"] } then {
66 set flags "--image-base 0"
67 }
68
69 if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
70 fail $testname
71 } else {
72 check_script
73 }
74
75 set testname "MRI script"
76
77 if ![ld_simple_link $ld tmpdir/script "$flags -c $srcdir/$subdir/scriptm.t"] {
78 fail $testname
79 } else {
80 check_script
81 }
This page took 0.052388 seconds and 4 git commands to generate.