xref: /openbmc/linux/arch/x86/include/asm/dwarf2.h (revision ba61bb17)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_DWARF2_H
3 #define _ASM_X86_DWARF2_H
4 
5 #ifndef __ASSEMBLY__
6 #warning "asm/dwarf2.h should be only included in pure assembly files"
7 #endif
8 
9 /*
10  * Macros for dwarf2 CFI unwind table entries.
11  * See "as.info" for details on these pseudo ops. Unfortunately
12  * they are only supported in very new binutils, so define them
13  * away for older version.
14  */
15 
16 #ifdef CONFIG_AS_CFI
17 
18 #define CFI_STARTPROC		.cfi_startproc
19 #define CFI_ENDPROC		.cfi_endproc
20 #define CFI_DEF_CFA		.cfi_def_cfa
21 #define CFI_DEF_CFA_REGISTER	.cfi_def_cfa_register
22 #define CFI_DEF_CFA_OFFSET	.cfi_def_cfa_offset
23 #define CFI_ADJUST_CFA_OFFSET	.cfi_adjust_cfa_offset
24 #define CFI_OFFSET		.cfi_offset
25 #define CFI_REL_OFFSET		.cfi_rel_offset
26 #define CFI_REGISTER		.cfi_register
27 #define CFI_RESTORE		.cfi_restore
28 #define CFI_REMEMBER_STATE	.cfi_remember_state
29 #define CFI_RESTORE_STATE	.cfi_restore_state
30 #define CFI_UNDEFINED		.cfi_undefined
31 #define CFI_ESCAPE		.cfi_escape
32 
33 #ifdef CONFIG_AS_CFI_SIGNAL_FRAME
34 #define CFI_SIGNAL_FRAME	.cfi_signal_frame
35 #else
36 #define CFI_SIGNAL_FRAME
37 #endif
38 
39 #if defined(CONFIG_AS_CFI_SECTIONS) && defined(__ASSEMBLY__)
40 #ifndef BUILD_VDSO
41 	/*
42 	 * Emit CFI data in .debug_frame sections, not .eh_frame sections.
43 	 * The latter we currently just discard since we don't do DWARF
44 	 * unwinding at runtime.  So only the offline DWARF information is
45 	 * useful to anyone.  Note we should not use this directive if
46 	 * vmlinux.lds.S gets changed so it doesn't discard .eh_frame.
47 	 */
48 	.cfi_sections .debug_frame
49 #else
50 	 /*
51 	  * For the vDSO, emit both runtime unwind information and debug
52 	  * symbols for the .dbg file.
53 	  */
54 	.cfi_sections .eh_frame, .debug_frame
55 #endif
56 #endif
57 
58 #else
59 
60 /*
61  * Due to the structure of pre-exisiting code, don't use assembler line
62  * comment character # to ignore the arguments. Instead, use a dummy macro.
63  */
64 .macro cfi_ignore a=0, b=0, c=0, d=0
65 .endm
66 
67 #define CFI_STARTPROC		cfi_ignore
68 #define CFI_ENDPROC		cfi_ignore
69 #define CFI_DEF_CFA		cfi_ignore
70 #define CFI_DEF_CFA_REGISTER	cfi_ignore
71 #define CFI_DEF_CFA_OFFSET	cfi_ignore
72 #define CFI_ADJUST_CFA_OFFSET	cfi_ignore
73 #define CFI_OFFSET		cfi_ignore
74 #define CFI_REL_OFFSET		cfi_ignore
75 #define CFI_REGISTER		cfi_ignore
76 #define CFI_RESTORE		cfi_ignore
77 #define CFI_REMEMBER_STATE	cfi_ignore
78 #define CFI_RESTORE_STATE	cfi_ignore
79 #define CFI_UNDEFINED		cfi_ignore
80 #define CFI_ESCAPE		cfi_ignore
81 #define CFI_SIGNAL_FRAME	cfi_ignore
82 
83 #endif
84 
85 #endif /* _ASM_X86_DWARF2_H */
86