* dwarf.c (display_debug_lines_raw): Do not treat .debug_line.dwo
[deliverable/binutils-gdb.git] / gas / testsuite / gas / elf / elf.exp
CommitLineData
5bf135a7
NC
1# Copyright 2012
2# Free Software Foundation, Inc.
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17
98944905
RH
18#
19# elf tests
20#
21
dfeb0666 22proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } {
5b5032eb
L
23 global READELF
24 global srcdir subdir
25 set testname "elf $name list"
02e07694 26 set file $srcdir/$subdir/$name
5b5032eb 27 gas_run ${name}.s "$opts -o dump.o" ">&dump.out"
5c1aa77e 28 if { ![string match "" $opts]
eb22018c 29 && [regexp_diff "dump.out" "${file}.l"] } then {
5b5032eb
L
30 fail $testname
31 verbose "output is [file_contents "dump.out"]" 2
32 return
33 }
7a6d0b32 34 send_log "$READELF $readelf_opts dump.o $readelf_pipe > dump.out\n"
7f6a71ff
JM
35 set status [gas_host_run "$READELF $readelf_opts dump.o" ">readelf.out"]
36 if { [lindex $status 0] != 0 || ![string match "" [lindex $status 1]] } then {
37 send_log "[lindex $status 1]\n"
38 fail $testname
39 return
40 }
41 catch "exec cat readelf.out $readelf_pipe > dump.out\n" comp_output
5b5032eb
L
42 if ![string match "" $comp_output] then {
43 send_log "$comp_output\n"
44 fail $testname
45 return
46 }
47 verbose_eval {[file_contents "dump.out"]} 3
eb22018c 48 if { [regexp_diff "dump.out" "${file}.e${suffix}"] } then {
5b5032eb
L
49 fail $testname
50 verbose "output is [file_contents "dump.out"]" 2
51 return
52 }
53 pass $testname
54}
55
98944905 56# We're testing bits in obj-elf -- don't run on anything else.
017761ea 57if { [is_elf_format] } then {
fa6b2d59 58 set target_machine ""
9e0665bc 59 if {[istarget "mips*-*-*"]} then {
fa6b2d59
L
60 set target_machine -mips
61 }
6a7715f4
NC
62 if {[istarget m32r*-*-*]} then {
63 set target_machine -m32r
64 }
1c0d3aa6
NC
65 if {[istarget "score-*-*"]} then {
66 set target_machine -score
67 }
59e6276b
JM
68 if {[istarget "tic6x-*-*"]} then {
69 set target_machine -tic6x
70 }
f8a52b59 71 if {[istarget "xtensa*-*-*"]} then {
2caa7ca0
BW
72 set target_machine -xtensa
73 }
c7927a3c
NC
74 if {[istarget "rx-*-*"]} then {
75 set target_machine -rx
76 }
8c5fc800 77 if {[istarget "arm*-*-*"]} {
01642c12 78
e821645d 79 if { ([istarget "*-*-*eabi"]
b27a00c5 80 || [istarget "*-*-linux-*"]
b38cadfb 81 || [istarget "*-*-nacl*"]
e821645d
DJ
82 || [istarget "*-*-symbianelf"])} then {
83 set target_machine -armeabi
84 } else {
85 set target_machine -armelf
86 }
ee065d83 87 }
8c750480 88
ee6365aa
BW
89 # The MN10300 and Xtensa ports disable the assembler's call frame
90 # optimization because it interfers with link-time relaxation of
91 # function prologues.
92 if {![istarget "mn10300-*-*"]
93 && ![istarget "xtensa*-*-*"]
01642c12 94 && ![istarget "am3*-*-*"]} then {
8c750480
NC
95 run_dump_test "ehopt0"
96 }
efa19bfd
JB
97 case $target_triplet in {
98 { m68k-*-* m68[03]??-*-* } {
99 run_dump_test "file" { { as "--defsym m68k=1" } }
100 }
101 { mmix-*-* } {
102 run_dump_test "file" { { as "--defsym mmix=1" } }
103 }
104 { xtensa*-*-* } {
105 run_dump_test "file" { { as "--rename-section file.s=file.c" } }
106 }
107 default {
108 run_dump_test "file"
109 }
110 }
01642c12
RM
111 run_dump_test "group0a"
112 run_dump_test "group0b"
709001e9 113 run_dump_test "group0c"
01642c12
RM
114 run_dump_test "group1a"
115 run_dump_test "group1b"
5ff3e4be 116 case $target_triplet in {
516e75be
AM
117 { hppa64*-*-hpux* } { }
118 default {
119 run_dump_test "groupautoa"
120 }
121 }
122 case $target_triplet in {
123 { hppa64*-*-hpux* } { }
5ff3e4be
AM
124 { xtensa*-*-* } { }
125 default {
126 run_dump_test "groupautob"
127 }
128 }
5ca0ee01
JB
129 case $target_triplet in {
130 { alpha*-*-* } { }
f42fb574
AM
131 { cr16*-*-* } { }
132 { crx*-*-* } { }
133 { h8300-*-* } { }
5ca0ee01
JB
134 { hppa*-*-* } { }
135 { iq2000*-*-* } { }
136 { mips*-*-* } { }
f42fb574
AM
137 { mn10200-*-* } { }
138 { mn10300-*-* } { }
5ca0ee01 139 { *c54x*-*-* } { }
c7927a3c 140 { rx-*-* } { }
5ca0ee01 141 default {
7b5030c0
NC
142 # The next test can fail if the target does not convert fixups
143 # against ordinary symbols into relocations against section symbols.
144 # This is usually revealed by the error message:
145 # symbol `sym' required but not present
6927f982 146 setup_xfail "m681*-*-*" "m68hc*-*-*"
5ca0ee01 147 run_dump_test redef
bdf128d6 148 run_dump_test equ-reloc
5ca0ee01
JB
149 }
150 }
6e8bd58f 151 run_dump_test "pseudo"
01642c12
RM
152 run_dump_test "section0"
153 run_dump_test "section1"
52b010e4
NC
154 if {! [istarget "h8300-*-*"]} then {
155 # The h8300 port issues a warning message for
156 # new sections created without atrributes.
157 run_elf_list_test "section2" "$target_machine" "-al" "-s" ""
158 }
01642c12 159 run_dump_test "section3"
22fe14ad 160 run_dump_test "section4"
a22429b9 161 if {! [istarget "h8300-*-*"] && ! [istarget "rx-*-*"]} then {
52b010e4
NC
162 # The h8300 port issues a warning message for
163 # new sections created without atrributes.
a22429b9
NC
164 # The RX port does not complain about changing the attributes of the
165 # .data and .bss sections since it does not use those names.
52b010e4
NC
166 run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\""
167 }
01642c12 168 run_dump_test "struct"
79c07750
RH
169 if { ![istarget "alpha*-*-*"] } then {
170 # The alpha port uses .set for state, e.g. nomacro.
171 run_dump_test "symtab"
172 }
d8045f23
NC
173 run_dump_test "symver"
174
516e75be 175 # No indirect functions on non-GNU targets.
cec7aa6a
AM
176 # The MSP port sets the ELF header's OSABI field to ELFOSABI_STANDALONE.
177 # The non-eabi ARM ports sets it to ELFOSABI_ARM.
178 # So for these targets we cannot include an IFUNC symbol type
179 # in the symbol type test.
516e75be
AM
180 if { [istarget "*-*-hpux*"]
181 || [istarget "msp*-*-*"]
182 || [istarget "arm*-*-*"]} then {
183 # hppa64 has a non-standard common directive
184 if { ![istarget "hppa64*-*-hpux*"] } then {
017761ea 185 run_elf_list_test "type-noifunc" "" "" "-s" "| grep \"1 *\\\[FONTC\\\]\""
516e75be 186 }
cec7aa6a 187 } else {
516e75be
AM
188 run_dump_test ifunc-1
189 run_elf_list_test "type" "" "" "-s" "| grep \"1 *\\\[FIONTCU\\\]\""
d8045f23
NC
190 }
191
01642c12
RM
192 run_dump_test "section6"
193 run_dump_test "section7"
194 run_dump_test "section8"
68efed41 195 run_dump_test "section9"
01642c12
RM
196 run_dump_test "dwarf2-1"
197 run_dump_test "dwarf2-2"
198 run_dump_test "dwarf2-3"
24a2d04d 199 run_dump_test "dwarf2-4"
8f3bae45 200 run_dump_test "bad-section-flag"
093a6ec6 201 run_dump_test "bad-size"
cfba7fd5 202 run_dump_test "bad-group"
9aec2026 203
7bfd842d
NC
204 run_dump_test "syms"
205
f3aa8054
L
206 run_dump_test "common1"
207 run_dump_test "common2"
208
9aec2026
NC
209load_lib gas-dg.exp
210dg-init
211dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
212dg-finish
213
98944905 214}
This page took 0.652343 seconds and 4 git commands to generate.