Re: [PATCH] x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 20, 2020 at 11:20:10AM -0700, Fangrui Song wrote:
> In the latest efi tree, ce5e3f909fc0ed67e58367b9c56a54c20a51080b
> "efi/printf: Add 64-bit and 8-bit integer support",
> arch/x86/boot/compressed/vmlinux may have an undesired
> .discard.unreachable section from drivers/firmware/efi/libstub/vsprintf.stub.o
> 
> .discard.unreachable contains an R_X86_64_PC32 relocation, which will be
> warned by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not
> part of the memory image, thus conceptually the distance between a
> non-SHF_ALLOC and a SHF_ALLOC is not a constant which can be resolved at
> link time.
> 
> % ld.lld -m elf_x86_64 -T arch/x86/boot/compressed/vmlinux.lds ... -o arch/x86/boot/compressed/vmlinux
> ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
> 
> Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable
> 
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> Signed-off-by: Fangrui Song <maskray@xxxxxxxxxx>
> ---
>  arch/x86/boot/compressed/vmlinux.lds.S | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S
> index 0dc5c2b9614b..8f1025d1f681 100644
> --- a/arch/x86/boot/compressed/vmlinux.lds.S
> +++ b/arch/x86/boot/compressed/vmlinux.lds.S
> @@ -74,4 +74,6 @@ SECTIONS
>  #endif
>  	. = ALIGN(PAGE_SIZE);	/* keep ZO size page aligned */
>  	_end = .;
> +
> +	DISCARDS
>  }
> -- 
> 2.26.2.761.g0e0b3e54be-goog
> 

Thanks! Maybe add a note in the commit message that the section is
generated from unreachable() annotations when CONFIG_STACK_VALIDATION is
enabled.

Tested-by: Arvind Sankar <nivedita@xxxxxxxxxxxx>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux