mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +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>
31 lines
999 B
C
31 lines
999 B
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
#ifndef _ORC_LOOKUP_H
|
|
#define _ORC_LOOKUP_H
|
|
|
|
/*
|
|
* This is a lookup table for speeding up access to the .orc_unwind table.
|
|
* Given an input address offset, the corresponding lookup table entry
|
|
* specifies a subset of the .orc_unwind table to search.
|
|
*
|
|
* Each block represents the end of the previous range and the start of the
|
|
* next range. An extra block is added to give the last range an end.
|
|
*
|
|
* The block size should be a power of 2 to avoid a costly 'div' instruction.
|
|
*
|
|
* A block size of 256 was chosen because it roughly doubles unwinder
|
|
* performance while only adding ~5% to the ORC data footprint.
|
|
*/
|
|
#define LOOKUP_BLOCK_ORDER 8
|
|
#define LOOKUP_BLOCK_SIZE (1 << LOOKUP_BLOCK_ORDER)
|
|
|
|
#ifndef LINKER_SCRIPT
|
|
|
|
extern unsigned int orc_lookup[];
|
|
extern unsigned int orc_lookup_end[];
|
|
|
|
#define LOOKUP_START_IP (unsigned long)_stext
|
|
#define LOOKUP_STOP_IP (unsigned long)_etext
|
|
|
|
#endif /* LINKER_SCRIPT */
|
|
|
|
#endif /* _ORC_LOOKUP_H */
|