* binutils-all/dw2-decodedline.S: Always have whitespace before
[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]
eb22018c 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
eb22018c 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.
017761ea 40if { [is_elf_format] } then {
fa6b2d59 41 set target_machine ""
9e0665bc 42 if {[istarget "mips*-*-*"]} then {
fa6b2d59
L
43 set target_machine -mips
44 }
6a7715f4
NC
45 if {[istarget m32r*-*-*]} then {
46 set target_machine -m32r
47 }
1c0d3aa6
NC
48 if {[istarget "score-*-*"]} then {
49 set target_machine -score
50 }
59e6276b
JM
51 if {[istarget "tic6x-*-*"]} then {
52 set target_machine -tic6x
53 }
f8a52b59 54 if {[istarget "xtensa*-*-*"]} then {
2caa7ca0
BW
55 set target_machine -xtensa
56 }
c7927a3c
NC
57 if {[istarget "rx-*-*"]} then {
58 set target_machine -rx
59 }
8c5fc800 60 if {[istarget "arm*-*-*"]} {
01642c12 61
e821645d 62 if { ([istarget "*-*-*eabi"]
b27a00c5 63 || [istarget "*-*-linux-*"]
e821645d
DJ
64 || [istarget "*-*-symbianelf"])} then {
65 set target_machine -armeabi
66 } else {
67 set target_machine -armelf
68 }
ee065d83 69 }
8c750480 70
ee6365aa
BW
71 # The MN10300 and Xtensa ports disable the assembler's call frame
72 # optimization because it interfers with link-time relaxation of
73 # function prologues.
74 if {![istarget "mn10300-*-*"]
75 && ![istarget "xtensa*-*-*"]
01642c12 76 && ![istarget "am3*-*-*"]} then {
8c750480
NC
77 run_dump_test "ehopt0"
78 }
efa19bfd
JB
79 case $target_triplet in {
80 { m68k-*-* m68[03]??-*-* } {
81 run_dump_test "file" { { as "--defsym m68k=1" } }
82 }
83 { mmix-*-* } {
84 run_dump_test "file" { { as "--defsym mmix=1" } }
85 }
86 { xtensa*-*-* } {
87 run_dump_test "file" { { as "--rename-section file.s=file.c" } }
88 }
89 default {
90 run_dump_test "file"
91 }
92 }
01642c12
RM
93 run_dump_test "group0a"
94 run_dump_test "group0b"
709001e9 95 run_dump_test "group0c"
01642c12
RM
96 run_dump_test "group1a"
97 run_dump_test "group1b"
cec7aa6a 98 run_dump_test "groupautoa"
5ff3e4be
AM
99 case $target_triplet in {
100 { xtensa*-*-* } { }
101 default {
102 run_dump_test "groupautob"
103 }
104 }
5ca0ee01
JB
105 case $target_triplet in {
106 { alpha*-*-* } { }
f42fb574
AM
107 { cr16*-*-* } { }
108 { crx*-*-* } { }
109 { h8300-*-* } { }
5ca0ee01
JB
110 { hppa*-*-* } { }
111 { iq2000*-*-* } { }
112 { mips*-*-* } { }
f42fb574
AM
113 { mn10200-*-* } { }
114 { mn10300-*-* } { }
5ca0ee01 115 { *c54x*-*-* } { }
c7927a3c 116 { rx-*-* } { }
5ca0ee01 117 default {
7b5030c0
NC
118 # The next test can fail if the target does not convert fixups
119 # against ordinary symbols into relocations against section symbols.
120 # This is usually revealed by the error message:
121 # symbol `sym' required but not present
5ca0ee01 122 run_dump_test redef
bdf128d6 123 run_dump_test equ-reloc
5ca0ee01
JB
124 }
125 }
6e8bd58f 126 run_dump_test "pseudo"
01642c12
RM
127 run_dump_test "section0"
128 run_dump_test "section1"
52b010e4
NC
129 if {! [istarget "h8300-*-*"]} then {
130 # The h8300 port issues a warning message for
131 # new sections created without atrributes.
132 run_elf_list_test "section2" "$target_machine" "-al" "-s" ""
133 }
01642c12 134 run_dump_test "section3"
22fe14ad 135 run_dump_test "section4"
a22429b9 136 if {! [istarget "h8300-*-*"] && ! [istarget "rx-*-*"]} then {
52b010e4
NC
137 # The h8300 port issues a warning message for
138 # new sections created without atrributes.
a22429b9
NC
139 # The RX port does not complain about changing the attributes of the
140 # .data and .bss sections since it does not use those names.
52b010e4
NC
141 run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\""
142 }
01642c12 143 run_dump_test "struct"
79c07750
RH
144 if { ![istarget "alpha*-*-*"] } then {
145 # The alpha port uses .set for state, e.g. nomacro.
146 run_dump_test "symtab"
147 }
d8045f23
NC
148 run_dump_test "symver"
149
cec7aa6a
AM
150 # The MSP port sets the ELF header's OSABI field to ELFOSABI_STANDALONE.
151 # The non-eabi ARM ports sets it to ELFOSABI_ARM.
152 # So for these targets we cannot include an IFUNC symbol type
153 # in the symbol type test.
154 if { [istarget "msp*-*-*"]
155 || [istarget "arm*-*-*"]} then {
017761ea 156 run_elf_list_test "type-noifunc" "" "" "-s" "| grep \"1 *\\\[FONTC\\\]\""
cec7aa6a 157 } else {
ad04f5ce 158 run_dump_test ifunc-1
f9272224 159 run_elf_list_test "type" "" "" "-s" "| grep \"1 *\\\[FIONTCU\\\]\""
d8045f23
NC
160 }
161
01642c12
RM
162 run_dump_test "section6"
163 run_dump_test "section7"
164 run_dump_test "section8"
68efed41 165 run_dump_test "section9"
01642c12
RM
166 run_dump_test "dwarf2-1"
167 run_dump_test "dwarf2-2"
168 run_dump_test "dwarf2-3"
24a2d04d 169 run_dump_test "dwarf2-4"
8f3bae45 170 run_dump_test "bad-section-flag"
093a6ec6 171 run_dump_test "bad-size"
cfba7fd5 172 run_dump_test "bad-group"
9aec2026
NC
173
174load_lib gas-dg.exp
175dg-init
176dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
177dg-finish
178
98944905 179}
This page took 0.547904 seconds and 4 git commands to generate.