Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638375

[PATCH] efi/libstub: Indicate clang the relocation mode for arm64

From Matthias Kaehlcke <mka@chromium.org>
Newsgroups linux.kernel
Subject [PATCH] efi/libstub: Indicate clang the relocation mode for arm64
Date 2017-05-09 21:40 +0200
Message-ID <tFj9f-69K-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Matthias Kaehlcke <mka@chromium.org> - 2017-05-09 21:40 +0200
  Re: [PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Greg Hackmann <ghackmann@google.com> - 2017-05-09 23:00 +0200
    Re: [PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Matthias Kaehlcke <mka@chromium.org> - 2017-05-09 23:50 +0200
      Re: [PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-05-10 10:00 +0200
        Re: [PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Matthias Kaehlcke <mka@chromium.org> - 2017-05-10 20:40 +0200
          Re: [PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-05-10 21:10 +0200
            Re: [PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Matthias Kaehlcke <mka@chromium.org> - 2017-05-10 21:50 +0200
              Re: [PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-05-11 16:00 +0200

csiph-web