Re: [PATCH v2] x86/alternative: fix undefined reference to __ibt_endbr_seal[_end]

From: Miaohe Lin
Date: Fri Dec 02 2022 - 20:20:42 EST


On 2022/12/2 19:59, Thomas Gleixner wrote:
> On Tue, Oct 11 2022 at 19:38, Miaohe Lin wrote:
>> Due to the explicit 'noinline' GCC-7.3 is not able to optimize away the
>> argument setup of:
>>
>> apply_ibt_endbr(__ibt_endbr_seal, __ibt_enbr_seal_end);
>>
>> even when X86_KERNEL_IBT=n and the function is an empty stub which leads
>> to link errors due to missing __ibt_endbr_seal* symbols like below:
>>
>> ld: arch/x86/kernel/alternative.o: in function
>> `alternative_instructions':
>> alternative.c:(.init.text+0x15d): undefined reference to
>> `__ibt_endbr_seal_end'
>> ld: alternative.c:(.init.text+0x164): undefined reference to
>> `__ibt_endbr_seal'
>
> This is incomplete because the noinline is only visible within
> alternative.c, but there is another caller in module.c
>
> This needs an inline stub in the header to be correct.
>

I see. I think I should update my gcc instead :) Thanks for your reply.

Thanks,
Miaohe Lin