Re: [PATCH 4/4] x86/boot: Check that there are no runtime relocations
From: Arvind Sankar
Date: Mon May 25 2020 - 15:22:28 EST
On Mon, May 25, 2020 at 09:26:26AM -0700, Fangrui Song wrote:
> On 2020-05-25, Ard Biesheuvel wrote:
> >
> >Do we really need the macro here? Could we just do
>
> The output section name does not matter: it will be discarded by the linker.
>
> >.rel.dyn : { *(.rel.* .rela.*) }
>
> If for some reasons there is at least one SHT_REL and at least one
> SHT_RELA, LLD will error "section type mismatch for .rel.dyn", while the
> intended diagnostic is the assert below.
>
> >(or even
> >
> >.rel.dyn : { *(.rel.* }
> >.rela.dyn : { *(.rela.*) }
> >
> >if the output section name matters, and always assert that both are empty)?
>
> .rel.dyn : { *(.rel.* }
> .rela.dyn : { *(.rela.*) }
>
> looks good to me.
>
>
> FWIW I intend to add -z rel and -z rela to LLD: https://reviews.llvm.org/D80496#inline-738804
> (binutils thread https://sourceware.org/pipermail/binutils/2020-May/111244.html)
>
> In case someone builds the x86-64 kernel with -z rel, your suggested
> input section description will work out of the box...
>
Ok with me.