]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/x86/include/asm/dwarf2.h
x86/vdso: Define BUILD_VDSO while building and emit .eh_frame in asm
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / include / asm / dwarf2.h
CommitLineData
7b956f03
AL
1#ifndef _ASM_X86_DWARF2_H
2#define _ASM_X86_DWARF2_H
3
4#ifndef __ASSEMBLY__
5#warning "asm/dwarf2.h should be only included in pure assembly files"
6#endif
7
8/*
9 * Macros for dwarf2 CFI unwind table entries.
10 * See "as.info" for details on these pseudo ops. Unfortunately
11 * they are only supported in very new binutils, so define them
12 * away for older version.
13 */
14
15#ifdef CONFIG_AS_CFI
16
17#define CFI_STARTPROC .cfi_startproc
18#define CFI_ENDPROC .cfi_endproc
19#define CFI_DEF_CFA .cfi_def_cfa
20#define CFI_DEF_CFA_REGISTER .cfi_def_cfa_register
21#define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset
22#define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset
23#define CFI_OFFSET .cfi_offset
24#define CFI_REL_OFFSET .cfi_rel_offset
25#define CFI_REGISTER .cfi_register
26#define CFI_RESTORE .cfi_restore
27#define CFI_REMEMBER_STATE .cfi_remember_state
28#define CFI_RESTORE_STATE .cfi_restore_state
29#define CFI_UNDEFINED .cfi_undefined
30#define CFI_ESCAPE .cfi_escape
31
32#ifdef CONFIG_AS_CFI_SIGNAL_FRAME
33#define CFI_SIGNAL_FRAME .cfi_signal_frame
34#else
35#define CFI_SIGNAL_FRAME
36#endif
37
38#if defined(CONFIG_AS_CFI_SECTIONS) && defined(__ASSEMBLY__)
f24f9108 39#ifndef BUILD_VDSO
7b956f03
AL
40 /*
41 * Emit CFI data in .debug_frame sections, not .eh_frame sections.
42 * The latter we currently just discard since we don't do DWARF
43 * unwinding at runtime. So only the offline DWARF information is
f24f9108
AL
44 * useful to anyone. Note we should not use this directive if
45 * vmlinux.lds.S gets changed so it doesn't discard .eh_frame.
7b956f03
AL
46 */
47 .cfi_sections .debug_frame
f24f9108
AL
48#else
49 /*
50 * For the vDSO, emit both runtime unwind information and debug
51 * symbols for the .dbg file.
52 */
53 .cfi_sections .eh_frame, .debug_frame
54#endif
7b956f03
AL
55#endif
56
57#else
58
59/*
60 * Due to the structure of pre-exisiting code, don't use assembler line
61 * comment character # to ignore the arguments. Instead, use a dummy macro.
62 */
63.macro cfi_ignore a=0, b=0, c=0, d=0
64.endm
65
66#define CFI_STARTPROC cfi_ignore
67#define CFI_ENDPROC cfi_ignore
68#define CFI_DEF_CFA cfi_ignore
69#define CFI_DEF_CFA_REGISTER cfi_ignore
70#define CFI_DEF_CFA_OFFSET cfi_ignore
71#define CFI_ADJUST_CFA_OFFSET cfi_ignore
72#define CFI_OFFSET cfi_ignore
73#define CFI_REL_OFFSET cfi_ignore
74#define CFI_REGISTER cfi_ignore
75#define CFI_RESTORE cfi_ignore
76#define CFI_REMEMBER_STATE cfi_ignore
77#define CFI_RESTORE_STATE cfi_ignore
78#define CFI_UNDEFINED cfi_ignore
79#define CFI_ESCAPE cfi_ignore
80#define CFI_SIGNAL_FRAME cfi_ignore
81
82#endif
83
84/*
85 * An attempt to make CFI annotations more or less
86 * correct and shorter. It is implied that you know
87 * what you're doing if you use them.
88 */
89#ifdef __ASSEMBLY__
90#ifdef CONFIG_X86_64
91 .macro pushq_cfi reg
92 pushq \reg
93 CFI_ADJUST_CFA_OFFSET 8
94 .endm
95
96 .macro pushq_cfi_reg reg
97 pushq %\reg
98 CFI_ADJUST_CFA_OFFSET 8
99 CFI_REL_OFFSET \reg, 0
100 .endm
101
102 .macro popq_cfi reg
103 popq \reg
104 CFI_ADJUST_CFA_OFFSET -8
105 .endm
106
107 .macro popq_cfi_reg reg
108 popq %\reg
109 CFI_ADJUST_CFA_OFFSET -8
110 CFI_RESTORE \reg
111 .endm
112
113 .macro pushfq_cfi
114 pushfq
115 CFI_ADJUST_CFA_OFFSET 8
116 .endm
117
118 .macro popfq_cfi
119 popfq
120 CFI_ADJUST_CFA_OFFSET -8
121 .endm
122
123 .macro movq_cfi reg offset=0
124 movq %\reg, \offset(%rsp)
125 CFI_REL_OFFSET \reg, \offset
126 .endm
127
128 .macro movq_cfi_restore offset reg
129 movq \offset(%rsp), %\reg
130 CFI_RESTORE \reg
131 .endm
132#else /*!CONFIG_X86_64*/
133 .macro pushl_cfi reg
134 pushl \reg
135 CFI_ADJUST_CFA_OFFSET 4
136 .endm
137
138 .macro pushl_cfi_reg reg
139 pushl %\reg
140 CFI_ADJUST_CFA_OFFSET 4
141 CFI_REL_OFFSET \reg, 0
142 .endm
143
144 .macro popl_cfi reg
145 popl \reg
146 CFI_ADJUST_CFA_OFFSET -4
147 .endm
148
149 .macro popl_cfi_reg reg
150 popl %\reg
151 CFI_ADJUST_CFA_OFFSET -4
152 CFI_RESTORE \reg
153 .endm
154
155 .macro pushfl_cfi
156 pushfl
157 CFI_ADJUST_CFA_OFFSET 4
158 .endm
159
160 .macro popfl_cfi
161 popfl
162 CFI_ADJUST_CFA_OFFSET -4
163 .endm
164
165 .macro movl_cfi reg offset=0
166 movl %\reg, \offset(%esp)
167 CFI_REL_OFFSET \reg, \offset
168 .endm
169
170 .macro movl_cfi_restore offset reg
171 movl \offset(%esp), %\reg
172 CFI_RESTORE \reg
173 .endm
174#endif /*!CONFIG_X86_64*/
175#endif /*__ASSEMBLY__*/
176
177#endif /* _ASM_X86_DWARF2_H */