c55f069afb75aedd932b34165141993b049ebf32
[deliverable/binutils-gdb.git] / gas / testsuite / gas / cfi / cfi.exp
1 # Copyright (C) 2012-2019 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17 if { ![is_elf_format] && ![is_pecoff_format] } then {
18 return
19 }
20
21 proc gas_x86_64_check { } {
22 global NM
23 global NMFLAGS
24
25 set status [gas_host_run "$NM $NMFLAGS --help" ""]
26 return [regexp "targets:.*x86-64" [lindex $status 1]];
27 }
28
29 proc gas_x86_32_check { } {
30 global NM
31 global NMFLAGS
32
33 set status [gas_host_run "$NM $NMFLAGS --help" ""]
34 return [regexp "targets:.*i386" [lindex $status 1]];
35 }
36
37 if { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } then {
38
39 global ASFLAGS
40 set old_ASFLAGS "$ASFLAGS"
41
42 if { [gas_x86_64_check] } then {
43 set ASFLAGS "$ASFLAGS --64"
44 run_dump_test "cfi-x86_64"
45 set ASFLAGS "$old_ASFLAGS"
46 }
47
48 if { [gas_x86_32_check] } then {
49 set ASFLAGS "$ASFLAGS --32"
50 run_dump_test "cfi-i386"
51 set ASFLAGS "$old_ASFLAGS"
52 }
53
54 if { [is_elf_format] } then {
55 run_dump_test "cfi-label"
56 }
57
58 if { [is_pecoff_format] } then {
59 run_dump_test "reloc-pe-i386"
60 }
61
62 } elseif { [istarget alpha*-*-*] } then {
63 run_dump_test "cfi-alpha-1"
64 run_dump_test "cfi-alpha-2"
65 run_dump_test "cfi-alpha-3"
66
67 } elseif { [istarget "arc*-*-*"] } then {
68 run_dump_test "cfi-arc-1"
69
70 } elseif { [istarget "arm*-*"] } then {
71 # Only ELF based ARM targets support CFI.
72 if { [is_pecoff_format] } then {
73 return
74 }
75 run_dump_test "cfi-arm-1"
76
77 } elseif { [istarget "hppa*-linux*"] } then {
78 run_dump_test "cfi-hppa-1"
79
80 } elseif { [istarget "m68*-*"] && ![istarget "m68hc1*-*"] } then {
81 run_dump_test "cfi-m68k"
82
83 } elseif { [istarget "mips*-*"] } then {
84 run_dump_test "cfi-mips-1"
85
86 } elseif { [istarget powerpc*-*-*] } then {
87 run_dump_test "cfi-ppc-1"
88
89 } elseif { [istarget s390*-*-*] } then {
90 run_dump_test "cfi-s390-1"
91 if { [istarget s390x*-*-*] } then {
92 run_dump_test "cfi-s390x-1"
93 }
94
95 } elseif [istarget "sh*-*"] then {
96 if { [istarget "*-pe" ] || [istarget "*-rtemscoff*"] } then {
97 return
98 }
99 run_dump_test "cfi-sh-1"
100
101 } elseif { [istarget sparc*-*-*] } then {
102 global NM
103 global NMFLAGS
104
105 set nm_status [gas_host_run "$NM $NMFLAGS --help" ""]
106 run_dump_test "cfi-sparc-1"
107 if { [regexp "elf64\[_-\]sparc" [lindex $nm_status 1]] } then {
108 run_dump_test "cfi-sparc64-1"
109 }
110
111 } else {
112 return
113 }
114
115 run_list_test "cfi-diag-1" ""
116
117 # HPPA64 uses 64-bit relocations, which results in all of the dump
118 # offset numbers not matching up.
119 if { ![istarget "hppa64*-*"] } then {
120 run_dump_test "cfi-common-1"
121 run_dump_test "cfi-common-2"
122 run_dump_test "cfi-common-3"
123 run_dump_test "cfi-common-4"
124 if { ![is_pecoff_format] } then {
125 # This test uses .subsection/.previous which are elf-specific.
126 run_dump_test "cfi-common-5"
127 }
128 # Some targets don't support PC relative cfi directives
129 if { ![istarget "mips*-*"] &&
130 !([istarget powerpc*-*-*] && [is_pecoff_format]) } then {
131 run_dump_test "cfi-common-6"
132 }
133 run_dump_test "cfi-common-7"
134 run_dump_test "cfi-common-8"
135 run_dump_test "cfi-common-9"
136 }
This page took 0.061564 seconds and 3 git commands to generate.