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: Greg 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: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
Greg Hackmann 2016-10-25 16:04:29 -07:00 committed by Satya Durga Srinivasu Prabhala
parent 5f43236149
commit c77880dd01

View File

@ -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