Re: [PATCH v4 05/10] objtool: Handle unreachable entry of rodata

From: Josh Poimboeuf
Date: Tue Nov 26 2024 - 19:55:22 EST


On Tue, Nov 26, 2024 at 07:04:39PM +0800, Tiezhu Yang wrote:
> On 11/26/2024 03:25 PM, Josh Poimboeuf wrote:
> > Are you sure this is specific to loongarch?
>
> I am not sure, I only found this issue on LoongArch compiled with Clang,
> but I think there is no effect if make it generic, like this:
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index f7586f82b967..87302e6fc07f 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -2103,9 +2103,10 @@ static int add_jump_table(struct objtool_file *file,
> struct instruction *insn,
> if (!dest_insn)
> break;
>
> - /* Make sure the destination is in the same function: */
> - if (!insn_func(dest_insn) || insn_func(dest_insn)->pfunc !=
> pfunc)
> - break;
> + if (!insn_func(dest_insn) || insn_func(dest_insn)->pfunc !=
> pfunc) {
> + prev_offset = reloc_offset(reloc);
> + continue;
> + }

Yeah, something like that might work.

--
Josh