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

Madhavan T. Venkataraman madvenka at linux.microsoft.com
Sun May 29 08:36:30 PDT 2022


See my responses inline...

On 5/24/22 09:27, Chen Zhongjin wrote:
> 
> 
> 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.

Yeah. The ORC entry structure is a superset of what I need for ARM64. But X86 requires all of it.
(Although I think "end" is not needed anymore).

And, other architectures might require all of it. So, I am keeping it as is.

> 
>> +	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 */

Thanks!

Madhavan



More information about the linux-arm-kernel mailing list