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>
Forward-ported-by: Bernhard Rosenkränzer <bero@linaro.org>
Signed-off-by: Bernhard Rosenkränzer <bero@linaro.org>
-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
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