Description
I am not familiar with objtool, but it seems that after https://git.kernel.org/linus/1c0c1faf5692c18c127d044ecc0cc92c7bab3477 (objtool: Use relative pointers for annotations
) , non-SHF_ALLOC sections like .discard.retpoline_safe
may contain PC-relative relocations:
% readelf -Wr arch/x86/kernel/irq_32.o
...
Relocation section '.rel.discard.retpoline_safe' at offset 0x3d8 contains 4 entries:
Offset Info Type Sym. Value Symbol's Name
00000000 00000202 R_386_PC32 00000000 .text
00000004 00000302 R_386_PC32 00000000 .altinstr_replacement
00000008 00000202 R_386_PC32 00000000 .text
0000000c 00000302 R_386_PC32 00000000 .altinstr_replacement
In the ELF object file format, non-SHF_ALLOC sections do not occupy memory during program execution. Such sections referencing SHF_ALLOC sections (.text
) do not make sense.
Currently LLD report warnings for non-relocatable links and suppresses the warnings for relocatable links.
After llvm/llvm-project#66804, in relocatable links, SHT_REL
PC-relative relocations will get warnings as well.
LLD still doesn't report warnings for SHT_RELA
PC-relative relocations. LLD doesn't mostly because we don't want to spend more code on the diagnostic.