summaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2018-07-13 08:30:33 -0700
committerWill Deacon <will.deacon@arm.com>2018-07-23 15:30:19 +0100
commitc931d34ea0853d41349e93f871bd3f17f1c03a6b (patch)
treea3a9b906f7663a5860d07c9fd9c720de01aa9b3a /arch/arm64
parent14d6e289a89780377f8bb09de8926d3c62d763cd (diff)
downloadlinux-stable-c931d34ea0853d41349e93f871bd3f17f1c03a6b.tar.gz
linux-stable-c931d34ea0853d41349e93f871bd3f17f1c03a6b.tar.bz2
linux-stable-c931d34ea0853d41349e93f871bd3f17f1c03a6b.zip
arm64: build with baremetal linker target instead of Linux when available
Not all toolchains have the baremetal elf targets, RedHat/Fedora ones in particular. So, probe for whether it's available and use the previous (linux) targets if it isn't. Reported-by: Laura Abbott <labbott@redhat.com> Tested-by: Laura Abbott <labbott@redhat.com> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Paul Kocialkowski <contact@paulk.fr> Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/Makefile9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 45272266dafb..99a1d859b8b8 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -60,15 +60,16 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
KBUILD_CPPFLAGS += -mbig-endian
CHECKFLAGS += -D__AARCH64EB__
AS += -EB
-LD += -EB
-LDFLAGS += -maarch64linuxb
+# Prefer the baremetal ELF build target, but not all toolchains include
+# it so fall back to the standard linux version if needed.
+LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
UTS_MACHINE := aarch64_be
else
KBUILD_CPPFLAGS += -mlittle-endian
CHECKFLAGS += -D__AARCH64EL__
AS += -EL
-LD += -EL
-LDFLAGS += -maarch64linux
+# Same as above, prefer ELF but fall back to linux target if needed.
+LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux)
UTS_MACHINE := aarch64
endif