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 JB |
17 | send_log "$READELF $readelf_opts dump.o $readelf_pipe > dump.out\n" |
18 | catch "exec $READELF $readelf_opts dump.o $readelf_pipe > dump.out\n" comp_output | |
5b5032eb L |
19 | if ![string match "" $comp_output] then { |
20 | send_log "$comp_output\n" | |
21 | fail $testname | |
22 | return | |
23 | } | |
24 | verbose_eval {[file_contents "dump.out"]} 3 | |
fa6b2d59 | 25 | if { [regexp_diff "dump.out" "${file}.e${suffix}"] } then { |
5b5032eb L |
26 | fail $testname |
27 | verbose "output is [file_contents "dump.out"]" 2 | |
28 | return | |
29 | } | |
30 | pass $testname | |
31 | } | |
32 | ||
98944905 | 33 | # We're testing bits in obj-elf -- don't run on anything else. |
4403997d | 34 | if { ([istarget "*-*-*elf*"] |
966d5bec | 35 | || [istarget "*-*-linux*"] |
e8773edb SC |
36 | || [istarget "m6811-*"] |
37 | || [istarget "m6812-*"] | |
966d5bec | 38 | || [istarget "sparc*-*-solaris*"] |
4403997d PB |
39 | || [istarget "mips*-*-irix6*"] |
40 | || [istarget "arm*-*-eabi"]) | |
966d5bec | 41 | && ![istarget *-*-linux*aout*] |
f48026f7 | 42 | && ![istarget *-*-linux*coff*] |
966d5bec | 43 | && ![istarget *-*-linux*oldld*] |
42bf09b2 | 44 | && ![istarget sh64*-*-linux*] |
966d5bec | 45 | } then { |
fa6b2d59 | 46 | set target_machine "" |
9e0665bc | 47 | if {[istarget "mips*-*-*"]} then { |
fa6b2d59 L |
48 | set target_machine -mips |
49 | } | |
6a7715f4 NC |
50 | if {[istarget m32r*-*-*]} then { |
51 | set target_machine -m32r | |
52 | } | |
1c0d3aa6 NC |
53 | if {[istarget "score-*-*"]} then { |
54 | set target_machine -score | |
55 | } | |
2caa7ca0 BW |
56 | if {[istarget "xtensa-*-*"]} then { |
57 | set target_machine -xtensa | |
58 | } | |
ee065d83 | 59 | if { ([istarget "*arm*-*-*"] |
e821645d DJ |
60 | || [istarget "xscale*-*-*"]) } { |
61 | ||
62 | if { ([istarget "*-*-*eabi"] | |
63 | || [istarget "*-*-symbianelf"])} then { | |
64 | set target_machine -armeabi | |
65 | } else { | |
66 | set target_machine -armelf | |
67 | } | |
ee065d83 | 68 | } |
1ff55c93 | 69 | run_dump_test "ehopt0" |
f5842774 L |
70 | run_dump_test "group0a" |
71 | run_dump_test "group0b" | |
86654c12 L |
72 | run_dump_test "group1a" |
73 | run_dump_test "group1b" | |
5ca0ee01 JB |
74 | case $target_triplet in { |
75 | { alpha*-*-* } { } | |
76 | { hppa*-*-* } { } | |
77 | { iq2000*-*-* } { } | |
78 | { mips*-*-* } { } | |
79 | { *c54x*-*-* } { } | |
80 | default { | |
7b5030c0 NC |
81 | # The next test can fail if the target does not convert fixups |
82 | # against ordinary symbols into relocations against section symbols. | |
83 | # This is usually revealed by the error message: | |
84 | # symbol `sym' required but not present | |
85 | setup_xfail "h8300-*-*" "mn10300-*-*" | |
5ca0ee01 | 86 | run_dump_test redef |
bdf128d6 | 87 | run_dump_test equ-reloc |
5ca0ee01 JB |
88 | } |
89 | } | |
98944905 | 90 | run_dump_test "section0" |
8ee99f93 | 91 | run_dump_test "section1" |
dfeb0666 | 92 | run_elf_list_test "section2" "$target_machine" "-al" "-s" "" |
7a6d0b32 | 93 | run_dump_test "section3" |
22fe14ad | 94 | run_dump_test "section4" |
dfeb0666 | 95 | run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\"" |
8fe53b44 | 96 | run_dump_test "struct" |
eba874d8 | 97 | run_dump_test "symver" |
dfeb0666 | 98 | run_elf_list_test "type" "" "" "-s" "| grep \"1 \\\[FONT\\\]\"" |
98944905 | 99 | } |