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

Commit c931d34e authored by Olof Johansson's avatar Olof Johansson Committed by Will Deacon
Browse files

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: default avatarLaura Abbott <labbott@redhat.com>
Tested-by: default avatarLaura Abbott <labbott@redhat.com>
Acked-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Cc: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 14d6e289
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -60,15 +60,16 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
KBUILD_CPPFLAGS	+= -mbig-endian
KBUILD_CPPFLAGS	+= -mbig-endian
CHECKFLAGS	+= -D__AARCH64EB__
CHECKFLAGS	+= -D__AARCH64EB__
AS		+= -EB
AS		+= -EB
LD		+= -EB
# Prefer the baremetal ELF build target, but not all toolchains include
LDFLAGS		+= -maarch64linuxb
# it so fall back to the standard linux version if needed.
LDFLAGS		+= -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
UTS_MACHINE	:= aarch64_be
UTS_MACHINE	:= aarch64_be
else
else
KBUILD_CPPFLAGS	+= -mlittle-endian
KBUILD_CPPFLAGS	+= -mlittle-endian
CHECKFLAGS	+= -D__AARCH64EL__
CHECKFLAGS	+= -D__AARCH64EL__
AS		+= -EL
AS		+= -EL
LD		+= -EL
# Same as above, prefer ELF but fall back to linux target if needed.
LDFLAGS		+= -maarch64linux
LDFLAGS		+= -EL $(call ld-option, -maarch64elf, -maarch64linux)
UTS_MACHINE	:= aarch64
UTS_MACHINE	:= aarch64
endif
endif


+2 −2
Original line number Original line Diff line number Diff line
@@ -163,8 +163,8 @@ cc-ldoption = $(call try-run,\
	$(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
	$(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))


# ld-option
# ld-option
# Usage: LDFLAGS += $(call ld-option, -X)
# Usage: LDFLAGS += $(call ld-option, -X, -Y)
ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2))
ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3))


# ar-option
# ar-option
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)