aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite/gas/cfi/cfi.exp
blob: fab64b91afd95875c33c734b54e6768e2f631e2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Copyright (C) 2012-2023 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  

if { ![is_elf_format] && ![is_pecoff_format] } then {
    return
}

proc gas_x86_64_check { } {
    global NM
    global NMFLAGS

    set status [gas_host_run "$NM $NMFLAGS --help" ""]
    return [regexp "targets:.*x86-64" [lindex $status 1]];
}

proc gas_x86_32_check { } {
    global NM
    global NMFLAGS

    set status [gas_host_run "$NM $NMFLAGS --help" ""]
    return [regexp "targets:.*i386" [lindex $status 1]];
}

if  { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } then {

    global ASFLAGS
    set old_ASFLAGS "$ASFLAGS"

    if { [gas_x86_64_check] } then {
	set ASFLAGS "$ASFLAGS --64"
	run_dump_test "cfi-x86_64"
	set ASFLAGS "$old_ASFLAGS"
    }

    if { [gas_x86_32_check] }  then {
	set ASFLAGS "$ASFLAGS --32"
	run_dump_test "cfi-i386"
	run_dump_test "cfi-i386-2"
	set ASFLAGS "$old_ASFLAGS"
    }

    if { [is_elf_format] } then {
	run_dump_test "cfi-label"
    }

    if { [is_pecoff_format] } then {
	run_dump_test "reloc-pe-i386"
    }

} elseif { [istarget alpha*-*-*] } then {
    run_dump_test "cfi-alpha-1"
    run_dump_test "cfi-alpha-2"
    run_dump_test "cfi-alpha-3"

} elseif { [istarget "arc*-*-*"] } then {
    run_dump_test "cfi-arc-1"

} elseif { [istarget "arm*-*"] } then {
    # Only ELF based ARM targets support CFI.
    if { [is_pecoff_format] } then {
	return
    }
    run_dump_test "cfi-arm-1"

} elseif { [istarget "hppa*-linux*"] } then {
    run_dump_test "cfi-hppa-1"

} elseif { [istarget "m68*-*"] && ![istarget "m68hc1*-*"] } then {
    run_dump_test "cfi-m68k"

} elseif { [istarget "mips*-*"] } then {
    run_dump_test "cfi-mips-1"

} elseif { [istarget powerpc*-*-*] } then {
    run_dump_test "cfi-ppc-1"

} elseif { [istarget s390*-*-*] } then {
    run_dump_test "cfi-s390-1"
    if { [istarget s390x*-*-*] } then {
	run_dump_test "cfi-s390x-1"
    }

} elseif [istarget "sh*-*"] then {
    if { [istarget "*-pe" ] } then {
	return
    }
    run_dump_test "cfi-sh-1"

} elseif { [istarget sparc*-*-*] } then {
    global NM
    global NMFLAGS

    set nm_status [gas_host_run "$NM $NMFLAGS --help" ""]
    run_dump_test "cfi-sparc-1"
    if { [regexp "elf64\[_-\]sparc" [lindex $nm_status 1]] } then {
	run_dump_test "cfi-sparc64-1"
    }

} else {
    return
}

run_list_test "cfi-diag-1" ""

# HPPA64 uses 64-bit relocations, which results in all of the dump
# offset numbers not matching up.
if { ![istarget "hppa64*-*"] } then {
  run_dump_test "cfi-common-1"
  run_dump_test "cfi-common-2"
  run_dump_test "cfi-common-3"
  run_dump_test "cfi-common-4"
  if { ![is_pecoff_format] } then {
    # This test uses .subsection/.previous which are elf-specific.
    run_dump_test "cfi-common-5"
  }
  # Some targets don't support PC relative cfi directives
  if { ![istarget "mips*-*"] } then {
    run_dump_test "cfi-common-6"
  }
  run_dump_test "cfi-common-7"
  run_dump_test "cfi-common-8"
  run_dump_test "cfi-common-9"

  run_dump_test "cie-version-0"
  run_dump_test "cie-version-1"
  run_dump_test "cie-version-2"
  run_dump_test "cie-version-3"
  run_dump_test "cie-version-4"
}