Skip to content

Commit 894ef53

Browse files
solbjorntsbogend
authored andcommitted
MIPS: properly stop .eh_frame generation
Commit 866b6a8 ("MIPS: Add DWARF unwinding to assembly") added -fno-asynchronous-unwind-tables to KBUILD_CFLAGS to prevent compiler from emitting .eh_frame symbols. However, as MIPS heavily uses CFI, that's not enough. Use the approach taken for x86 (as it also uses CFI) and explicitly put CFI symbols into the .debug_frame section (except for VDSO). This allows us to drop .eh_frame from DISCARDS as it's no longer being generated. Fixes: 866b6a8 ("MIPS: Add DWARF unwinding to assembly") Suggested-by: Kees Cook <keescook@chromium.org> Signed-off-by: Alexander Lobakin <alobakin@pm.me> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 5629d41 commit 894ef53

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

arch/mips/include/asm/asm.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,27 @@
2020
#include <asm/sgidefs.h>
2121
#include <asm/asm-eva.h>
2222

23+
#ifndef __VDSO__
24+
/*
25+
* Emit CFI data in .debug_frame sections, not .eh_frame sections.
26+
* We don't do DWARF unwinding at runtime, so only the offline DWARF
27+
* information is useful to anyone. Note we should change this if we
28+
* ever decide to enable DWARF unwinding at runtime.
29+
*/
30+
#define CFI_SECTIONS .cfi_sections .debug_frame
31+
#else
32+
/*
33+
* For the vDSO, emit both runtime unwind information and debug
34+
* symbols for the .dbg file.
35+
*/
36+
#define CFI_SECTIONS
37+
#endif
38+
2339
/*
2440
* LEAF - declare leaf routine
2541
*/
2642
#define LEAF(symbol) \
43+
CFI_SECTIONS; \
2744
.globl symbol; \
2845
.align 2; \
2946
.type symbol, @function; \
@@ -36,6 +53,7 @@ symbol: .frame sp, 0, ra; \
3653
* NESTED - declare nested routine entry point
3754
*/
3855
#define NESTED(symbol, framesize, rpc) \
56+
CFI_SECTIONS; \
3957
.globl symbol; \
4058
.align 2; \
4159
.type symbol, @function; \

arch/mips/kernel/vmlinux.lds.S

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,5 @@ SECTIONS
224224
*(.options)
225225
*(.pdr)
226226
*(.reginfo)
227-
*(.eh_frame)
228227
}
229228
}

0 commit comments

Comments
 (0)