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 "m6811-*"]
43 || [istarget "m6812-*"]
44 || [istarget "sparc*-*-solaris*"]
45 || [istarget "mips*-*-irix6*"]
46 || [istarget "arm*-*-eabi"])
47 && ![istarget *-*-linux*aout*]
48 && ![istarget *-*-linux*coff*]
49 && ![istarget *-*-linux*oldld*]
50 && ![istarget sh64*-*-linux*]
53 if {[istarget "mips*-*-*"]} then {
54 set target_machine -mips
56 if {[istarget m32r*-*-*]} then {
57 set target_machine -m32r
59 if {[istarget "score-*-*"]} then {
60 set target_machine -score
62 if {[istarget "xtensa*-*-*"]} then {
63 set target_machine -xtensa
65 if {[istarget "rx-*-*"]} then {
66 set target_machine -rx
68 if { ([istarget "*arm*-*-*"]
69 || [istarget "xscale*-*-*"]) } {
71 if { ([istarget "*-*-*eabi"]
72 || [istarget "*-*-linux-*"]
73 || [istarget "*-*-symbianelf"])} then {
74 set target_machine -armeabi
76 set target_machine -armelf
80 # The MN10300 and Xtensa ports disable the assembler's call frame
81 # optimization because it interfers with link-time relaxation of
83 if {![istarget "mn10300-*-*"]
84 && ![istarget "xtensa*-*-*"]
85 && ![istarget "am3*-*-*"]} then {
86 run_dump_test "ehopt0"
88 case $target_triplet in {
89 { m68k-*-* m68[03]??-*-* } {
90 run_dump_test "file" { { as "--defsym m68k=1" } }
93 run_dump_test "file" { { as "--defsym mmix=1" } }
96 run_dump_test "file" { { as "--rename-section file.s=file.c" } }
102 run_dump_test "group0a"
103 run_dump_test "group0b"
104 run_dump_test "group1a"
105 run_dump_test "group1b"
106 case $target_triplet in {
119 # The next test can fail if the target does not convert fixups
120 # against ordinary symbols into relocations against section symbols.
121 # This is usually revealed by the error message:
122 # symbol `sym' required but not present
124 run_dump_test equ-reloc
127 run_dump_test "section0"
128 run_dump_test "section1"
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" ""
134 run_dump_test "section3"
135 run_dump_test "section4"
136 if {! [istarget "h8300-*-*"]} then {
137 # The h8300 port issues a warning message for
138 # new sections created without atrributes.
139 run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\""
141 run_dump_test "struct"
142 run_dump_test "symtab"
143 run_dump_test "symver"
145 # The MSP port sets the ELF header's OSABI field to ELFOSABI_STANDALONE.
146 # The non-eabi ARM ports sets it to ELFOSABI_ARM.
147 # So for these targets we cannot include an IFUNC symbol type
148 # in the symbol type test.
149 if { [istarget "msp*-*-*"]
150 || [istarget "arm*-*-*"]
151 || [istarget "xscale*-*-*"]} then {
152 run_elf_list_test "type-noifunc" "" "" "-s" "| grep \"1 *\\\[FONTC\\\]\""
154 run_dump_test ifunc-1
155 run_elf_list_test "type" "" "" "-s" "| grep \"1 *\\\[FIONTCU\\\]\""
158 run_dump_test "section6"
159 run_dump_test "section7"
160 run_dump_test "section8"