All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux
@ 2020-05-20 18:20 Fangrui Song
  2020-05-20 19:19 ` Arvind Sankar
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Fangrui Song @ 2020-05-20 18:20 UTC (permalink / raw)
  To: x86, Arvind Sankar, linux-efi
  Cc: clang-built-linux, Nick Desaulniers, Ard Biesheuvel,
	Fangrui Song, kbuild test robot

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@intel.com>
Signed-off-by: Fangrui Song <maskray@google.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-22 15:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 18:20 [PATCH] x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux Fangrui Song
2020-05-20 19:19 ` Arvind Sankar
2020-05-22  2:42 ` Kees Cook
2020-05-22  6:51   ` Sedat Dilek
2020-05-22 15:54     ` Ard Biesheuvel
2020-05-22 15:57       ` Sedat Dilek
2020-05-22 15:59         ` Ard Biesheuvel
2020-05-22 12:40 ` [tip: x86/build] " tip-bot2 for Fangrui Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.