Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c77880dd authored by Greg Hackmann's avatar Greg Hackmann Committed by Satya Durga Srinivasu Prabhala
Browse files

ANDROID: HACK: firmware, LLVMLinux: fix EFI libstub with clang



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.

Change-Id: I59b052a14c8cda88fc4c3ba8bdb26c456f9316ef
Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
Git-commit: 90387ea45956dd9f61d43babe2b3329ffe58037e
Git-repo: https://android.googlesource.com/kernel/common/


[satyap@codeaurora.org: trivial merge conflict resolution]
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent 5f432361
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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

@@ -42,6 +45,9 @@ lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \
lib-$(CONFIG_ARM)		+= arm32-stub.o
lib-$(CONFIG_ARM64)		+= arm64-stub.o
CFLAGS_arm64-stub.o 		:= -DTEXT_OFFSET=$(TEXT_OFFSET)
ifeq ($(cc-name),clang)
CFLAGS_arm64-stub.o		+= -fno-pic
endif

#
# arm64 puts the stub in the kernel proper, which will unnecessarily retain all