Re: [PATCH] x86/boot: allow a relocatable kernel to be linked with lld
From: Borislav Petkov
Date: Fri May 15 2020 - 14:51:01 EST
On Fri, May 01, 2020 at 08:42:13AM +0000, Dmitry Golovin wrote:
> LLD by default disallows relocations in read-only segments. For a
I need more info here about which segment is read-only?
Is this something LLD does by default or what's happening?
Because my BFD-linked vmlinux has:
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0x0000000000000000 0x0000000000000000
0x000000000070fa28 0x0000000000726b00 RWE 0x1000
LOAD 0x0000000000000000 0x0000000000727000 0x0000000000727000
0x0000000000000000 0x0000000000007000 RW 0x1000
DYNAMIC 0x00000000007108f8 0x000000000070f8f8 0x000000000070f8f8
0x0000000000000130 0x0000000000000130 RW 0x8
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RWE 0x10
so what's up?
> relocatable kernel, we pass -z notext to the linker to explicitly
> allow relocations. This behavior is the default for BFD.
Or are you saying that ld.bfd makes the text segment by default RW while
ld.lld makes it read-only like the elf manpage says:
"p_flags
This member holds a bit mask of flags relevant to the segment:
PF_X An executable segment.
PF_W A writable segment.
PF_R A readable segment.
A text segment commonly has the flags PF_X and PF_R."
IOW, don't be afraid to be more verbose in the commit message. :)
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette