From: Matthias Kaehlcke <mka@chromium.org>
To: Matt Fleming <matt@codeblueprint.co.uk>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
"Grant Grundler" <grundler@chromium.org>,
"Greg Hackmann" <ghackmann@google.com>,
"Michael Davidson" <md@google.com>,
"Matthias Kaehlcke" <mka@chromium.org>,
"Bernhard Rosenkränzer" <Bernhard.Rosenkranzer@linaro.org>
Subject: [PATCH] efi/libstub: Indicate clang the relocation mode for arm64
Date: Tue, 9 May 2017 12:36:12 -0700 [thread overview]
Message-ID: <20170509193612.64105-1-mka@chromium.org> (raw)
From: Greg Hackmann <ghackmann@google.com>
Without any extra guidance, clang will generate libstub with either
absolute or relative ELF relocations. Use the right combination of
-fpic and -fno-pic on different files to avoid this.
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
drivers/firmware/efi/libstub/Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index f7425960f6a5..ccbaaf4d8650 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -11,6 +11,9 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \
-mno-mmx -mno-sse
cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS))
+ifeq ($(cc-name),clang)
+cflags-$(CONFIG_ARM64) += -fpic
+endif
cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \
-fno-builtin -fpic -mno-single-pic-base
@@ -38,6 +41,9 @@ $(obj)/lib-%.o: $(srctree)/lib/%.c FORCE
lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \
$(patsubst %.c,lib-%.o,$(arm-deps))
+ifeq ($(cc-name),clang)
+CFLAGS_arm64-stub.o += -fno-pic
+endif
lib-$(CONFIG_ARM) += arm32-stub.o
lib-$(CONFIG_ARM64) += arm64-stub.o
--
2.13.0.rc2.291.g57267f2277-goog
next reply other threads:[~2017-05-09 19:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 19:36 Matthias Kaehlcke [this message]
2017-05-09 20:50 ` Greg Hackmann
2017-05-09 21:49 ` Matthias Kaehlcke
2017-05-10 7:51 ` Ard Biesheuvel
2017-05-10 18:38 ` Matthias Kaehlcke
2017-05-10 19:05 ` Ard Biesheuvel
2017-05-10 19:47 ` Matthias Kaehlcke
2017-05-11 13:51 ` Ard Biesheuvel
2017-05-17 16:09 ` Matthias Kaehlcke
2017-05-17 23:24 ` Greg Hackmann
2017-05-18 7:41 ` Ard Biesheuvel
2017-05-18 17:00 ` Matthias Kaehlcke
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=20170509193612.64105-1-mka@chromium.org \
--to=mka@chromium.org \
--cc=Bernhard.Rosenkranzer@linaro.org \
--cc=ard.biesheuvel@linaro.org \
--cc=ghackmann@google.com \
--cc=grundler@chromium.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=md@google.com \
/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
all inboxes | Powered by JetHome®