https://sourceware.org/bugzilla/show_bug.cgi?id=31924

Ard Biesheuvel <ardb at kernel dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ardb at kernel dot org

--- Comment #11 from Ard Biesheuvel <ardb at kernel dot org> ---
(In reply to Tj from comment #10)
> On Friday, 28 June 2024 at 13:52, nsz at gcc dot gnu.org
> <sourceware-bugzi...@sourceware.org> wrote:
> 
> > 
> > so either linux is wrong for passing
> > 
> > --no-apply-dynamic-relocs -z pack-relative-relocs
> > 
> > together or ld should ignore --no-apply-dynamic-relocs in this case.
> > i think linux is wrong here.
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/Makefile#n15
> > 
> > if i edit that out then i get a bootable Image.
> > 
> 
> Did you notice my finding about zboot.lds and removing the DISCARD ?
> 
> That was only added in v6.9 with commit 5134acb15d9ef27aa2b90aad46d and is
> targeted at loongarch so I suspect that commit needs reverting and redoing
> to be conditional on the architecture.

That seems spurious to me - zboot.lds is not used for building Image, only for
building vmlinuz.efi, which incorporates a compressed copy of Image.

(In reply to Szabolcs Nagy from comment #9)
> it seems arm64 linux passes --no-apply-dynamic-relocs which means
> the relative reloc addend is not stored to the referenced location
> (0 is stored) and since -z pack-relative-relocs does not have the
> addend stored elsewhere, the linux self-relocation code can't work.
> 
> so either linux is wrong for passing
> 
>    --no-apply-dynamic-relocs -z pack-relative-relocs
> 
> together or ld should ignore --no-apply-dynamic-relocs in this case.
> i think linux is wrong here.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/
> arm64/Makefile#n15
> 
> if i edit that out then i get a bootable Image.

Agree that this combination makes no sense, although LLD does the right thing
here.

So the Makefile logic should be updated to only pass --no-apply-dynamic-relocs
if CONFIG_RELR is not set. That would result in all locations to have the
addend stored, even the ones that are covered by RELA rather than RELR
(assuming ld.bfd could emit both just like LLD) but that shouldn't matter -
RELR saves so much space that the overhead of a handful of less compressible
statically initialized pointers should be negligible.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to