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 { ([istarget "*-*-*elf*"]
41 || [istarget "*-*-linux*"]
42 || [istarget "*-*-gnu*"]
43 || [istarget "m6811-*"]
44 || [istarget "m6812-*"]
45 || [istarget "sparc*-*-solaris*"]
46 || [istarget "mips*-*-irix6*"]
47 || [istarget "arm*-*-eabi"])
48 && ![istarget *-*-linux*aout*]
49 && ![istarget *-*-linux*coff*]
50 && ![istarget *-*-linux*oldld*]
51 && ![istarget sh64*-*-linux*]
54 if {[istarget "mips*-*-*"]} then {
55 set target_machine -mips
57 if {[istarget m32r*-*-*]} then {
58 set target_machine -m32r
60 if {[istarget "score-*-*"]} then {
61 set target_machine -score
63 if {[istarget "tic6x-*-*"]} then {
64 set target_machine -tic6x
66 if {[istarget "xtensa*-*-*"]} then {
67 set target_machine -xtensa
69 if {[istarget "rx-*-*"]} then {
70 set target_machine -rx
72 if { ([istarget "*arm*-*-*"]
73 || [istarget "xscale*-*-*"]) } {
75 if { ([istarget "*-*-*eabi"]
76 || [istarget "*-*-linux-*"]
77 || [istarget "*-*-symbianelf"])} then {
78 set target_machine -armeabi
80 set target_machine -armelf
84 # The MN10300 and Xtensa ports disable the assembler's call frame
85 # optimization because it interfers with link-time relaxation of
87 if {![istarget "mn10300-*-*"]
88 && ![istarget "xtensa*-*-*"]
89 && ![istarget "am3*-*-*"]} then {
90 run_dump_test "ehopt0"
92 case $target_triplet in {
93 { m68k-*-* m68[03]??-*-* } {
94 run_dump_test "file" { { as "--defsym m68k=1" } }
97 run_dump_test "file" { { as "--defsym mmix=1" } }
100 run_dump_test "file" { { as "--rename-section file.s=file.c" } }
106 run_dump_test "group0a"
107 run_dump_test "group0b"
108 run_dump_test "group0c"
109 run_dump_test "group1a"
110 run_dump_test "group1b"
111 run_dump_test "groupautoa"
112 case $target_triplet in {
115 run_dump_test "groupautob"
118 case $target_triplet in {
131 # The next test can fail if the target does not convert fixups
132 # against ordinary symbols into relocations against section symbols.
133 # This is usually revealed by the error message:
134 # symbol `sym' required but not present
136 run_dump_test equ-reloc
139 run_dump_test "pseudo"
140 run_dump_test "section0"
141 run_dump_test "section1"
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 "section2" "$target_machine" "-al" "-s" ""
147 run_dump_test "section3"
148 run_dump_test "section4"
149 if {! [istarget "h8300-*-*"]} then {
150 # The h8300 port issues a warning message for
151 # new sections created without atrributes.
152 run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\""
154 run_dump_test "struct"
155 if { ![istarget "alpha*-*-*"] } then {
156 # The alpha port uses .set for state, e.g. nomacro.
157 run_dump_test "symtab"
159 run_dump_test "symver"
161 # The MSP port sets the ELF header's OSABI field to ELFOSABI_STANDALONE.
162 # The non-eabi ARM ports sets it to ELFOSABI_ARM.
163 # So for these targets we cannot include an IFUNC symbol type
164 # in the symbol type test.
165 if { [istarget "msp*-*-*"]
166 || [istarget "arm*-*-*"]
167 || [istarget "xscale*-*-*"]} then {
168 run_elf_list_test "type-noifunc" "" "" "-s" "| grep \"1 *\\\[FONTC\\\]\""
170 run_dump_test ifunc-1
171 run_elf_list_test "type" "" "" "-s" "| grep \"1 *\\\[FIONTCU\\\]\""
174 run_dump_test "section6"
175 run_dump_test "section7"
176 run_dump_test "section8"
177 run_dump_test "section9"
178 run_dump_test "dwarf2-1"
179 run_dump_test "dwarf2-2"
180 run_dump_test "dwarf2-3"
181 run_dump_test "bad-section-flag"