mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-31 23:27:20 +00:00

The kernel CONFIG_UNWINDER_ORC option enables the ORC unwinder, which is similar in concept to a DWARF unwinder. The difference is that the format of the ORC data is much simpler than DWARF, which in turn allows the ORC unwinder to be much simpler and faster. The ORC data consists of unwind tables which are generated by objtool. After analyzing all the code paths of a .o file, it determines information about the stack state at each instruction address in the file and outputs that information to the .orc_unwind and .orc_unwind_ip sections. The per-object ORC sections are combined at link time and are sorted and post-processed at boot time. The unwinder uses the resulting data to correlate instruction addresses with their stack states at run time. Most of the logic are similar with x86, in order to get ra info before ra is saved into stack, add ra_reg and ra_offset into orc_entry. At the same time, modify some arch-specific code to silence the objtool warnings. Co-developed-by: Jinyang He <hejinyang@loongson.cn> Signed-off-by: Jinyang He <hejinyang@loongson.cn> Co-developed-by: Youling Tang <tangyouling@loongson.cn> Signed-off-by: Youling Tang <tangyouling@loongson.cn> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
62 lines
1.3 KiB
C
62 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_BUG_H
|
|
#define __ASM_BUG_H
|
|
|
|
#include <asm/break.h>
|
|
#include <linux/stringify.h>
|
|
|
|
#ifndef CONFIG_DEBUG_BUGVERBOSE
|
|
#define _BUGVERBOSE_LOCATION(file, line)
|
|
#else
|
|
#define __BUGVERBOSE_LOCATION(file, line) \
|
|
.pushsection .rodata.str, "aMS", @progbits, 1; \
|
|
10002: .string file; \
|
|
.popsection; \
|
|
\
|
|
.long 10002b - .; \
|
|
.short line;
|
|
#define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
|
|
#endif
|
|
|
|
#ifndef CONFIG_GENERIC_BUG
|
|
#define __BUG_ENTRY(flags)
|
|
#else
|
|
#define __BUG_ENTRY(flags) \
|
|
.pushsection __bug_table, "aw"; \
|
|
.align 2; \
|
|
10000: .long 10001f - .; \
|
|
_BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
|
|
.short flags; \
|
|
.popsection; \
|
|
10001:
|
|
#endif
|
|
|
|
#define ASM_BUG_FLAGS(flags) \
|
|
__BUG_ENTRY(flags) \
|
|
break BRK_BUG
|
|
|
|
#define ASM_BUG() ASM_BUG_FLAGS(0)
|
|
|
|
#define __BUG_FLAGS(flags) \
|
|
asm_inline volatile (__stringify(ASM_BUG_FLAGS(flags)));
|
|
|
|
#define __WARN_FLAGS(flags) \
|
|
do { \
|
|
instrumentation_begin(); \
|
|
__BUG_FLAGS(BUGFLAG_WARNING|(flags)); \
|
|
annotate_reachable(); \
|
|
instrumentation_end(); \
|
|
} while (0)
|
|
|
|
#define BUG() \
|
|
do { \
|
|
instrumentation_begin(); \
|
|
__BUG_FLAGS(0); \
|
|
unreachable(); \
|
|
} while (0)
|
|
|
|
#define HAVE_ARCH_BUG
|
|
|
|
#include <asm-generic/bug.h>
|
|
|
|
#endif /* __ASM_BUG_H */
|