Commit missing part of previous delta to add GNU_UNIQUE_FUNCTION support.
[deliverable/binutils-gdb.git] / gas / testsuite / gas / elf / elf.exp
1 #
2 # elf tests
3 #
4
5 proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } {
6 global READELF
7 global srcdir subdir
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 {
13 fail $testname
14 verbose "output is [file_contents "dump.out"]" 2
15 return
16 }
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"
21 fail $testname
22 return
23 }
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"
27 fail $testname
28 return
29 }
30 verbose_eval {[file_contents "dump.out"]} 3
31 if { [regexp_diff "dump.out" "${file}.e${suffix}"] } then {
32 fail $testname
33 verbose "output is [file_contents "dump.out"]" 2
34 return
35 }
36 pass $testname
37 }
38
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*]
51 } then {
52 set target_machine ""
53 if {[istarget "mips*-*-*"]} then {
54 set target_machine -mips
55 }
56 if {[istarget m32r*-*-*]} then {
57 set target_machine -m32r
58 }
59 if {[istarget "score-*-*"]} then {
60 set target_machine -score
61 }
62 if {[istarget "xtensa*-*-*"]} then {
63 set target_machine -xtensa
64 }
65 if { ([istarget "*arm*-*-*"]
66 || [istarget "xscale*-*-*"]) } {
67
68 if { ([istarget "*-*-*eabi"]
69 || [istarget "*-*-linux-*"]
70 || [istarget "*-*-symbianelf"])} then {
71 set target_machine -armeabi
72 } else {
73 set target_machine -armelf
74 }
75 }
76
77 # The MN10300 and Xtensa ports disable the assembler's call frame
78 # optimization because it interfers with link-time relaxation of
79 # function prologues.
80 if {![istarget "mn10300-*-*"]
81 && ![istarget "xtensa*-*-*"]
82 && ![istarget "am3*-*-*"]} then {
83 run_dump_test "ehopt0"
84 }
85 run_dump_test "group0a"
86 run_dump_test "group0b"
87 run_dump_test "group1a"
88 run_dump_test "group1b"
89 case $target_triplet in {
90 { alpha*-*-* } { }
91 { cr16*-*-* } { }
92 { crx*-*-* } { }
93 { h8300-*-* } { }
94 { hppa*-*-* } { }
95 { iq2000*-*-* } { }
96 { mips*-*-* } { }
97 { mn10200-*-* } { }
98 { mn10300-*-* } { }
99 { *c54x*-*-* } { }
100 default {
101 # The next test can fail if the target does not convert fixups
102 # against ordinary symbols into relocations against section symbols.
103 # This is usually revealed by the error message:
104 # symbol `sym' required but not present
105 run_dump_test redef
106 run_dump_test equ-reloc
107 }
108 }
109 run_dump_test "section0"
110 run_dump_test "section1"
111 run_elf_list_test "section2" "$target_machine" "-al" "-s" ""
112 run_dump_test "section3"
113 run_dump_test "section4"
114 run_elf_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\""
115 run_dump_test "struct"
116 run_dump_test "symtab"
117 run_dump_test "symver"
118
119 # The MSP port sets the ELF header's OSABI field to ELFOSABI_STANDALONE.
120 # The non-eabi ARM ports sets it to ELFOSABI_ARM.
121 # So for these targets we cannot include an IFUNC symbol type
122 # in the symbol type test.
123 if { [istarget "msp*-*-*"]
124 || [istarget "arm*-*-*"]
125 || [istarget "xscale*-*-*"]} then {
126 run_elf_list_test "type-noifunc" "" "" "-s" "| grep \"1 \\\[FONTC\\\]\""
127 } else {
128 run_dump_test ifunc-1
129 run_elf_list_test "type" "" "" "-s" "| grep \"1 \\\[FIONTCU\\\]\""
130 }
131
132 run_dump_test "section6"
133 run_dump_test "section7"
134 }
This page took 0.03808 seconds and 5 git commands to generate.