[RFC PATCH v2 05/20] objtool: Reorganize ORC types

Chen Zhongjin chenzhongjin at huawei.com
Tue May 24 07:27:44 PDT 2022



On 2022/5/24 8:16, madvenka at linux.microsoft.com wrote:
> From: "Madhavan T. Venkataraman" <madvenka at linux.microsoft.com>
> 
> The ORC code needs to be reorganized into arch-specific and generic parts
> so that architectures other than X86 can use the generic parts.
> 
> orc_types.h contains the following ORC definitions shared between objtool
> and the kernel:
> 
> 	- ORC register definitions which are arch-specific.
> 	- orc_entry structure which is generic.
...
> diff --git a/include/linux/orc_entry.h b/include/linux/orc_entry.h
> new file mode 100644
> index 000000000000..3d49e3b9dabe
> --- /dev/null
> +++ b/include/linux/orc_entry.h
> @@ -0,0 +1,39 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Copyright (C) 2017 Josh Poimboeuf <jpoimboe at redhat.com>
> + */
> +
> +#ifndef _ORC_ENTRY_H
> +#define _ORC_ENTRY_H
> +
> +#ifndef __ASSEMBLY__
> +#include <asm/byteorder.h>
> +
> +/*
> + * This struct is more or less a vastly simplified version of the DWARF Call
> + * Frame Information standard.  It contains only the necessary parts of DWARF
> + * CFI, simplified for ease of access by the in-kernel unwinder.  It tells the
> + * unwinder how to find the previous SP and BP (and sometimes entry regs) on
> + * the stack for a given code address.  Each instance of the struct corresponds
> + * to one or more code locations.
> + */
> +struct orc_entry {
> +	s16		sp_offset;
> +	s16		fp_offset;
> +#if defined(__LITTLE_ENDIAN_BITFIELD)
> +	unsigned	sp_reg:4;
> +	unsigned	fp_reg:4;
Are sp_reg & fp_reg & end needed? I noticed that they are not used in
reliability checking.

> +	unsigned	type:3;
> +	unsigned	end:1;
> +#elif defined(__BIG_ENDIAN_BITFIELD)
> +	unsigned	fp_reg:4;
> +	unsigned	sp_reg:4;
> +	unsigned	unused:4;
> +	unsigned	end:1;
> +	unsigned	type:3;
> +#endif
> +} __packed;
> +
> +#endif /* __ASSEMBLY__ */
> +
> +#endif /* _ORC_ENTRY_H */




More information about the linux-arm-kernel mailing list