Commit | Line | Data |
---|---|---|
98944905 RH |
1 | # |
2 | # elf tests | |
3 | # | |
4 | ||
dfeb0666 | 5 | proc 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 L |
11 | if { ![string match "" $opts] |
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 | |
fa6b2d59 | 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. |
4403997d | 40 | if { ([istarget "*-*-*elf*"] |
966d5bec | 41 | || [istarget "*-*-linux*"] |
e8773edb SC |
42 | || [istarget "m6811-*"] |
43 | || [istarget "m6812-*"] | |
966d5bec | 44 | || [istarget "sparc*-*-solaris*"] |
4403997d PB |
45 | || [istarget "mips*-*-irix6*"] |
46 | || [istarget "arm*-*-eabi"]) | |
966d5bec | 47 | && ![istarget *-*-linux*aout*] |
f48026f7 | 48 | && ![istarget *-*-linux*coff*] |
966d5bec | 49 | && ![istarget *-*-linux*oldld*] |
42bf09b2 | 50 | && ![istarget sh64*-*-linux*] |
966d5bec | 51 | } then { |
fa6b2d59 | 52 | set target_machine "" |
9e0665bc | 53 | if {[istarget "mips*-*-*"]} then { |
fa6b2d59 L |
54 | set target_machine -mips |
55 | } | |
6a7715f4 NC |
56 | if {[istarget m32r*-*-*]} then { |
57 | set target_machine -m32r | |
58 | } | |
1c0d3aa6 NC |
59 | if {[istarget "score-*-*"]} then { |
60 | set target_machine -score | |
61 | } | |
2caa7ca0 BW |
62 | if {[istarget "xtensa-*-*"]} then { |
63 | set target_machine -xtensa | |
64 | } | |
ee065d83 | 65 | if { ([istarget "*arm*-*-*"] |
e821645d DJ |
66 | || [istarget "xscale*-*-*"]) } { |
67 | ||
68 | if { ([istarget "*-*-*eabi"] | |
b27a00c5 | 69 | || [istarget "*-*-linux-*"] |
e821645d DJ |
70 | || [istarget "*-*-symbianelf"])} then { |
71 | set target_machine -armeabi | |
72 | } else { | |
73 | set target_machine -armelf | |
74 | } | |
ee065d83 | 75 | } |
8c750480 NC |
76 | |
77 | # The MN10300 port disables the assembler's call frame optimization | |
78 | # because it interfers with link time relaxation of function prologues. | |
79 | if (![istarget "mn10300-*-*"] && ![istarget "am3*-*-*"]} then { | |
80 | run_dump_test "ehopt0" | |
81 | } | |
f5842774 L |
82 | run_dump_test "group0a" |
83 | run_dump_test "group0b" | |
86654c12 L |
84 | run_dump_test "group1a" |
85 | run_dump_test "group1b" | |
5ca0ee01 JB |
86 | case $target_triplet in { |
87 | { alpha*-*-* } { } | |
88 | { hppa*-*-* } { } | |
89 | { iq2000*-*-* } { } | |
90 | { mips*-*-* } { } | |
91 | { *c54x*-*-* } { } | |
92 | default { | |
7b5030c0 NC |
93 | # The next test can fail if the target does not convert fixups |
94 | # against ordinary symbols into relocations against section symbols. | |
95 | # This is usually revealed by the error message: | |
96 | # symbol `sym' required but not present | |
3ccac826 | 97 | setup_xfail "cr16-*-*" "h8300-*-*" "mn10300-*-*" |
5ca0ee01 | 98 | run_dump_test redef |
bdf128d6 | 99 | run_dump_test equ-reloc |
5ca0ee01 JB |
100 | } |
101 | } | |
98944905 | 102 | run_dump_test "section0" |
8ee99f93 | 103 | run_dump_test "section1" |
dfeb0666 | 104 | run_elf_list_test "section2" "$target_machine" "-al" "-s" "" |
7a6d0b32 | 105 | run_dump_test "section3" |
22fe14ad | 106 | run_dump_test "section4" |
dfeb0666 | 107 | run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\"" |
8fe53b44 | 108 | run_dump_test "struct" |
eba874d8 | 109 | run_dump_test "symver" |
6f932bce NC |
110 | run_elf_list_test "type" "" "" "-s" "| grep \"1 \\\[FONTC\\\]\"" |
111 | run_dump_test "section6" | |
9cfc3331 | 112 | run_dump_test "section7" |
98944905 | 113 | } |