linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: x86@kernel.org, Arvind Sankar <nivedita@alum.mit.edu>,
	linux-efi@vger.kernel.org
Cc: clang-built-linux@googlegroups.com,
	Nick Desaulniers <ndesaulniers@google.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Fangrui Song <maskray@google.com>,
	kbuild test robot <lkp@intel.com>
Subject: [PATCH] x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux
Date: Wed, 20 May 2020 11:20:10 -0700	[thread overview]
Message-ID: <20200520182010.242489-1-maskray@google.com> (raw)

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


             reply	other threads:[~2020-05-20 18:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20 18:20 Fangrui Song [this message]
2020-05-20 19:19 ` [PATCH] x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200520182010.242489-1-maskray@google.com \
    --to=maskray@google.com \
    --cc=ardb@kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=ndesaulniers@google.com \
    --cc=nivedita@alum.mit.edu \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).