gdb/
[deliverable/binutils-gdb.git] / gas / testsuite / gas / elf / elf.exp
CommitLineData
98944905
RH
1#
2# elf tests
3#
4
dfeb0666 5proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } {
5b5032eb
L
6 global READELF
7 global srcdir subdir
8 set testname "elf $name list"
02e07694 9 set file $srcdir/$subdir/$name
5b5032eb 10 gas_run ${name}.s "$opts -o dump.o" ">&dump.out"
5c1aa77e 11 if { ![string match "" $opts]
b27423bb 12 && [regexp_diff "dump.out" "${file}.l" ""] } then {
5b5032eb
L
13 fail $testname
14 verbose "output is [file_contents "dump.out"]" 2
15 return
16 }
7a6d0b32 17 send_log "$READELF $readelf_opts dump.o $readelf_pipe > dump.out\n"
7f6a71ff
JM
18 set status [gas_host_run "$READELF $readelf_opts dump.o" ">readelf.out"]
19 if { [lindex $status 0] != 0 || ![string match "" [lindex $status 1]] } then {
20 send_log "[lindex $status 1]\n"
21 fail $testname
22 return
23 }
24 catch "exec cat readelf.out $readelf_pipe > dump.out\n" comp_output
5b5032eb
L
25 if ![string match "" $comp_output] then {
26 send_log "$comp_output\n"
27 fail $testname
28 return
29 }
30 verbose_eval {[file_contents "dump.out"]} 3
b27423bb 31 if { [regexp_diff "dump.out" "${file}.e${suffix}" ""] } then {
5b5032eb
L
32 fail $testname
33 verbose "output is [file_contents "dump.out"]" 2
34 return
35 }
36 pass $testname
37}
38
98944905 39# We're testing bits in obj-elf -- don't run on anything else.
01642c12 40if { ([istarget "*-*-*elf*"]
966d5bec 41 || [istarget "*-*-linux*"]
e8773edb
SC
42 || [istarget "m6811-*"]
43 || [istarget "m6812-*"]
966d5bec 44 || [istarget "sparc*-*-solaris*"]
4403997d
PB
45 || [istarget "mips*-*-irix6*"]
46 || [istarget "arm*-*-eabi"])
966d5bec 47 && ![istarget *-*-linux*aout*]
f48026f7 48 && ![istarget *-*-linux*coff*]
966d5bec 49 && ![istarget *-*-linux*oldld*]
42bf09b2 50 && ![istarget sh64*-*-linux*]
966d5bec 51} then {
fa6b2d59 52 set target_machine ""
9e0665bc 53 if {[istarget "mips*-*-*"]} then {
fa6b2d59
L
54 set target_machine -mips
55 }
6a7715f4
NC
56 if {[istarget m32r*-*-*]} then {
57 set target_machine -m32r
58 }
1c0d3aa6
NC
59 if {[istarget "score-*-*"]} then {
60 set target_machine -score
61 }
59e6276b
JM
62 if {[istarget "tic6x-*-*"]} then {
63 set target_machine -tic6x
64 }
f8a52b59 65 if {[istarget "xtensa*-*-*"]} then {
2caa7ca0
BW
66 set target_machine -xtensa
67 }
c7927a3c
NC
68 if {[istarget "rx-*-*"]} then {
69 set target_machine -rx
70 }
ee065d83 71 if { ([istarget "*arm*-*-*"]
e821645d 72 || [istarget "xscale*-*-*"]) } {
01642c12 73
e821645d 74 if { ([istarget "*-*-*eabi"]
b27a00c5 75 || [istarget "*-*-linux-*"]
e821645d
DJ
76 || [istarget "*-*-symbianelf"])} then {
77 set target_machine -armeabi
78 } else {
79 set target_machine -armelf
80 }
ee065d83 81 }
8c750480 82
ee6365aa
BW
83 # The MN10300 and Xtensa ports disable the assembler's call frame
84 # optimization because it interfers with link-time relaxation of
85 # function prologues.
86 if {![istarget "mn10300-*-*"]
87 && ![istarget "xtensa*-*-*"]
01642c12 88 && ![istarget "am3*-*-*"]} then {
8c750480
NC
89 run_dump_test "ehopt0"
90 }
efa19bfd
JB
91 case $target_triplet in {
92 { m68k-*-* m68[03]??-*-* } {
93 run_dump_test "file" { { as "--defsym m68k=1" } }
94 }
95 { mmix-*-* } {
96 run_dump_test "file" { { as "--defsym mmix=1" } }
97 }
98 { xtensa*-*-* } {
99 run_dump_test "file" { { as "--rename-section file.s=file.c" } }
100 }
101 default {
102 run_dump_test "file"
103 }
104 }
01642c12
RM
105 run_dump_test "group0a"
106 run_dump_test "group0b"
107 run_dump_test "group1a"
108 run_dump_test "group1b"
109 run_dump_test "groupautoa"
110 run_dump_test "groupautob"
5ca0ee01
JB
111 case $target_triplet in {
112 { alpha*-*-* } { }
f42fb574
AM
113 { cr16*-*-* } { }
114 { crx*-*-* } { }
115 { h8300-*-* } { }
5ca0ee01
JB
116 { hppa*-*-* } { }
117 { iq2000*-*-* } { }
118 { mips*-*-* } { }
f42fb574
AM
119 { mn10200-*-* } { }
120 { mn10300-*-* } { }
5ca0ee01 121 { *c54x*-*-* } { }
c7927a3c 122 { rx-*-* } { }
5ca0ee01 123 default {
7b5030c0
NC
124 # The next test can fail if the target does not convert fixups
125 # against ordinary symbols into relocations against section symbols.
126 # This is usually revealed by the error message:
127 # symbol `sym' required but not present
5ca0ee01 128 run_dump_test redef
bdf128d6 129 run_dump_test equ-reloc
5ca0ee01
JB
130 }
131 }
6e8bd58f 132 run_dump_test "pseudo"
01642c12
RM
133 run_dump_test "section0"
134 run_dump_test "section1"
52b010e4
NC
135 if {! [istarget "h8300-*-*"]} then {
136 # The h8300 port issues a warning message for
137 # new sections created without atrributes.
138 run_elf_list_test "section2" "$target_machine" "-al" "-s" ""
139 }
01642c12 140 run_dump_test "section3"
22fe14ad 141 run_dump_test "section4"
52b010e4
NC
142 if {! [istarget "h8300-*-*"]} then {
143 # The h8300 port issues a warning message for
144 # new sections created without atrributes.
145 run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\""
146 }
01642c12 147 run_dump_test "struct"
95027438 148 run_dump_test "symtab"
d8045f23
NC
149 run_dump_test "symver"
150
151 # The MSP port sets the ELF header's OSABI field to ELFOSABI_STANDALONE.
152 # The non-eabi ARM ports sets it to ELFOSABI_ARM.
153 # So for these targets we cannot include an IFUNC symbol type
154 # in the symbol type test.
155 if { [istarget "msp*-*-*"]
156 || [istarget "arm*-*-*"]
157 || [istarget "xscale*-*-*"]} then {
f9272224 158 run_elf_list_test "type-noifunc" "" "" "-s" "| grep \"1 *\\\[FONTC\\\]\""
d8045f23 159 } else {
ad04f5ce 160 run_dump_test ifunc-1
f9272224 161 run_elf_list_test "type" "" "" "-s" "| grep \"1 *\\\[FIONTCU\\\]\""
d8045f23
NC
162 }
163
01642c12
RM
164 run_dump_test "section6"
165 run_dump_test "section7"
166 run_dump_test "section8"
167 run_dump_test "dwarf2-1"
168 run_dump_test "dwarf2-2"
169 run_dump_test "dwarf2-3"
98944905 170}
This page took 0.477096 seconds and 4 git commands to generate.