linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efi/libstub: Indicate clang the relocation mode for arm64
@ 2017-05-09 19:36 Matthias Kaehlcke
       [not found] ` <20170509193612.64105-1-mka-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Matthias Kaehlcke @ 2017-05-09 19:36 UTC (permalink / raw)
  To: Matt Fleming, Ard Biesheuvel
  Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Grant Grundler,
	Greg Hackmann, Michael Davidson, Matthias Kaehlcke,
	Bernhard Rosenkränzer

From: Greg Hackmann <ghackmann-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>

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-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Signed-off-by: Matthias Kaehlcke <mka-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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

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

end of thread, other threads:[~2017-05-18 17:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-09 19:36 [PATCH] efi/libstub: Indicate clang the relocation mode for arm64 Matthias Kaehlcke
     [not found] ` <20170509193612.64105-1-mka-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
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
     [not found]           ` <20170510183848.GI128305-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2017-05-10 19:05             ` Ard Biesheuvel
     [not found]               ` <69A18345-6933-4C6A-8FAC-DBD4D7EF30DE-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-05-10 19:47                 ` Matthias Kaehlcke
     [not found]                   ` <20170510194734.GJ128305-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2017-05-11 13:51                     ` Ard Biesheuvel
     [not found]                       ` <CAKv+Gu8H9H=Rax4iiKaZ2z2GikXTjseCAyKrYgQPQWkekjsN8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-17 16:09                         ` Matthias Kaehlcke
2017-05-17 23:24                         ` Greg Hackmann
     [not found]                           ` <a5692a7a-0140-2e61-497f-6d3bf92b5d11-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2017-05-18  7:41                             ` Ard Biesheuvel
     [not found]                               ` <CAKv+Gu_JE8No4Ob-kL4tubRYiuFWYbptwouw16ezFhkLSizn5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-18 17:00                                 ` Matthias Kaehlcke

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).