diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2016-09-16 20:23:26 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2016-09-30 17:48:22 -0400 |
commit | 5a205a32ffccf6e720a2d2b3aee44b16619016a6 (patch) | |
tree | 9ff1460c48ecbcc382405826ff53c5329bd5a9dd /arch/arc | |
parent | 2dad1122d9d936cf120953324eaaa38c3ab20ac2 (diff) |
ARC: dw2 unwind: add infrastructure for adding cfi pseudo ops to asm
1. detect whether binutils supports the cfi pseudo ops
2. define conditional macros to generate the ops
3. define new ENTRY_CFI/END_CFI to annotate hand asm code.
- Needed because we don't want to emit dwarf info in general ENTRY/END
used by lowest level trap/exception/interrutp handlers as unwinder
gets confused trying to unwind out of them. We want unwinder to
instead stop when it hits onfo those routines
- These provide minimal start/end cfi ops assuming routine doesn't
touch stack memory/regs
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r-- | arch/arc/Makefile | 3 | ||||
-rw-r--r-- | arch/arc/include/asm/dwarf.h | 38 | ||||
-rw-r--r-- | arch/arc/include/asm/linkage.h | 12 |
3 files changed, 52 insertions, 1 deletions
diff --git a/arch/arc/Makefile b/arch/arc/Makefile index a2a6a4614241..aa82d13d4213 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile | |||
@@ -65,7 +65,8 @@ endif | |||
65 | 65 | ||
66 | endif | 66 | endif |
67 | 67 | ||
68 | cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables | 68 | cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI) |
69 | cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi) | ||
69 | 70 | ||
70 | ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE | 71 | ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE |
71 | # Generic build system uses -O2, we want -O3 | 72 | # Generic build system uses -O2, we want -O3 |
diff --git a/arch/arc/include/asm/dwarf.h b/arch/arc/include/asm/dwarf.h new file mode 100644 index 000000000000..bb7bdbc59a44 --- /dev/null +++ b/arch/arc/include/asm/dwarf.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016-17 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_ARC_DWARF_H | ||
10 | #define _ASM_ARC_DWARF_H | ||
11 | |||
12 | #ifdef __ASSEMBLY__ | ||
13 | |||
14 | #ifdef ARC_DW2_UNWIND_AS_CFI | ||
15 | |||
16 | #define CFI_STARTPROC .cfi_startproc | ||
17 | #define CFI_ENDPROC .cfi_endproc | ||
18 | #define CFI_DEF_CFA .cfi_def_cfa | ||
19 | #define CFI_REGISTER .cfi_register | ||
20 | #define CFI_REL_OFFSET .cfi_rel_offset | ||
21 | #define CFI_UNDEFINED .cfi_undefined | ||
22 | |||
23 | #else | ||
24 | |||
25 | #define CFI_IGNORE # | ||
26 | |||
27 | #define CFI_STARTPROC CFI_IGNORE | ||
28 | #define CFI_ENDPROC CFI_IGNORE | ||
29 | #define CFI_DEF_CFA CFI_IGNORE | ||
30 | #define CFI_REGISTER CFI_IGNORE | ||
31 | #define CFI_REL_OFFSET CFI_IGNORE | ||
32 | #define CFI_UNDEFINED CFI_IGNORE | ||
33 | |||
34 | #endif /* !ARC_DW2_UNWIND_AS_CFI */ | ||
35 | |||
36 | #endif /* __ASSEMBLY__ */ | ||
37 | |||
38 | #endif /* _ASM_ARC_DWARF_H */ | ||
diff --git a/arch/arc/include/asm/linkage.h b/arch/arc/include/asm/linkage.h index 5faad17118b4..b29f1a9fd6f7 100644 --- a/arch/arc/include/asm/linkage.h +++ b/arch/arc/include/asm/linkage.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef __ASM_LINKAGE_H | 9 | #ifndef __ASM_LINKAGE_H |
10 | #define __ASM_LINKAGE_H | 10 | #define __ASM_LINKAGE_H |
11 | 11 | ||
12 | #include <asm/dwarf.h> | ||
13 | |||
12 | #ifdef __ASSEMBLY__ | 14 | #ifdef __ASSEMBLY__ |
13 | 15 | ||
14 | #define ASM_NL ` /* use '`' to mark new line in macro */ | 16 | #define ASM_NL ` /* use '`' to mark new line in macro */ |
@@ -32,6 +34,16 @@ | |||
32 | #endif | 34 | #endif |
33 | .endm | 35 | .endm |
34 | 36 | ||
37 | #define ENTRY_CFI(name) \ | ||
38 | .globl name ASM_NL \ | ||
39 | ALIGN ASM_NL \ | ||
40 | name: ASM_NL \ | ||
41 | CFI_STARTPROC ASM_NL | ||
42 | |||
43 | #define END_CFI(name) \ | ||
44 | CFI_ENDPROC ASM_NL \ | ||
45 | .size name, .-name | ||
46 | |||
35 | #else /* !__ASSEMBLY__ */ | 47 | #else /* !__ASSEMBLY__ */ |
36 | 48 | ||
37 | #ifdef CONFIG_ARC_HAS_ICCM | 49 | #ifdef CONFIG_ARC_HAS_ICCM |