5 proc run_elf_list_test
{ name suffix opts readelf_opts readelf_pipe
} {
8 set testname
"elf $name list"
9 set file $srcdir
/$subdir
/$
name
10 gas_run $
{name}.s
"$opts -o dump.o" ">&dump.out"
11 if { ![string match
"" $opts]
12 && [regexp_diff
"dump.out" "${file}.l"] } then {
14 verbose
"output is [file_contents "dump.out"]" 2
17 send_log
"$READELF $readelf_opts dump.o $readelf_pipe > dump.out\n"
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"
24 catch
"exec cat readelf.out $readelf_pipe > dump.out\n" comp_output
25 if ![string match
"" $comp_output] then {
26 send_log
"$comp_output\n"
30 verbose_eval
{[file_contents
"dump.out"]} 3
31 if { [regexp_diff
"dump.out" "${file}.e${suffix}"] } then {
33 verbose
"output is [file_contents "dump.out"]" 2
39 # We
're testing bits in obj-elf -- don't run
on anything
else.
40 if { [is_elf_format
] } then {
42 if {[istarget
"mips*-*-*"]} then {
43 set target_machine
-mips
45 if {[istarget m32r
*-*-*]} then {
46 set target_machine
-m32r
48 if {[istarget
"score-*-*"]} then {
49 set target_machine
-score
51 if {[istarget
"tic6x-*-*"]} then {
52 set target_machine
-tic6x
54 if {[istarget
"xtensa*-*-*"]} then {
55 set target_machine
-xtensa
57 if {[istarget
"rx-*-*"]} then {
58 set target_machine
-rx
60 if {[istarget
"arm*-*-*"]} {
62 if { ([istarget
"*-*-*eabi"]
63 ||
[istarget
"*-*-linux-*"]
64 ||
[istarget
"*-*-symbianelf"])} then {
65 set target_machine
-armeabi
67 set target_machine
-armelf
71 # The MN10300 and Xtensa ports disable the assembler
's call frame
72 # optimization because it interfers with link-time relaxation of
74 if {![istarget "mn10300-*-*"]
75 && ![istarget "xtensa*-*-*"]
76 && ![istarget "am3*-*-*"]} then {
77 run_dump_test "ehopt0"
79 case $target_triplet in {
80 { m68k-*-* m68[03]??-*-* } {
81 run_dump_test "file" { { as "--defsym m68k=1" } }
84 run_dump_test "file" { { as "--defsym mmix=1" } }
87 run_dump_test "file" { { as "--rename-section file.s=file.c" } }
93 run_dump_test "group0a"
94 run_dump_test "group0b"
95 run_dump_test "group0c"
96 run_dump_test "group1a"
97 run_dump_test "group1b"
98 case $target_triplet in {
99 { hppa64*-*-hpux* } { }
101 run_dump_test "groupautoa"
104 case $target_triplet in {
105 { hppa64*-*-hpux* } { }
108 run_dump_test "groupautob"
111 case $target_triplet in {
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
129 run_dump_test equ
-reloc
132 run_dump_test
"pseudo"
133 run_dump_test
"section0"
134 run_dump_test
"section1"
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" ""
140 run_dump_test
"section3"
141 run_dump_test
"section4"
142 if {! [istarget
"h8300-*-*"] && ! [istarget "rx-*-*"]} then {
143 # The h8300 port issues a warning message
for
144 # new sections created without atrributes.
145 # The RX port does not complain about changing the attributes of the
146 # .data and .bss sections since it does not use those names.
147 run_elf_list_test
"section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\""
149 run_dump_test
"struct"
150 if { ![istarget
"alpha*-*-*"] } then {
151 # The alpha port uses .
set for state
, e.g. nomacro.
152 run_dump_test
"symtab"
154 run_dump_test
"symver"
156 # No indirect functions
on non
-GNU targets.
157 # The MSP port sets the ELF header
's OSABI field to ELFOSABI_STANDALONE.
158 # The non-eabi ARM ports sets it to ELFOSABI_ARM.
159 # So for these targets we cannot include an IFUNC symbol type
160 # in the symbol type test.
161 if { [istarget "*-*-hpux*"]
162 || [istarget "msp*-*-*"]
163 || [istarget "arm*-*-*"]} then {
164 # hppa64 has a non-standard common directive
165 if { ![istarget "hppa64*-*-hpux*"] } then {
166 run_elf_list_test "type-noifunc" "" "" "-s" "| grep \"1 *\\\[FONTC\\\]\""
169 run_dump_test ifunc-1
170 run_elf_list_test "type" "" "" "-s" "| grep \"1 *\\\[FIONTCU\\\]\""
173 run_dump_test "section6"
174 run_dump_test "section7"
175 run_dump_test "section8"
176 run_dump_test "section9"
177 run_dump_test "dwarf2-1"
178 run_dump_test "dwarf2-2"
179 run_dump_test "dwarf2-3"
180 run_dump_test "dwarf2-4"
181 run_dump_test "bad-section-flag"
182 run_dump_test "bad-size"
183 run_dump_test "bad-group"
187 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""