Re: "relocation to !ENDBR" objtool warnings
From: Arnd Bergmann
Date: Tue Dec 17 2024 - 05:42:36 EST
On Tue, Dec 17, 2024, at 10:09, Arnd Bergmann wrote:
> On Tue, Dec 17, 2024, at 09:54, Arnd Bergmann wrote:
>>
>> 00000000000000f0 <stpcpy>:
>> f0: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
>> f7: 00 00 00 00
>> fb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
>> 100: f3 0f 1e fa endbr64
>
>
> I had one more look at the assembler file created by gcc and found
> that this is a 16-byte nop:
>
> .align 16
> .globl stpcpy
> .type stpcpy, @function
> stpcpy:
> .p2align 5
> endbr64
...
>
> No idea why it got inserted here, or why it only shows up in these
> two functions. Having a nop before the endbr is a compiler bug, right?
I confirmed that this is only a problem on gcc-14.2, both gcc-14.1
and gcc trunk (15.0 I assume) are fine according to the compiler
explorer: https://godbolt.org/z/9xf7Ph8GT
Arnd