summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown2017-07-28 13:47:06 +0200
committerMichael Brown2017-07-28 13:49:40 +0200
commitb6fc8be2c43c4e1b068613abadc48c1d86caee2b (patch)
treead9bb16280a9e0886fb9b27d4937a70d18aecc04 /src/arch
parent[efi] Enumerate PCI BARs in same order as SnpDxe (diff)
downloadipxe-b6fc8be2c43c4e1b068613abadc48c1d86caee2b.tar.gz
ipxe-b6fc8be2c43c4e1b068613abadc48c1d86caee2b.tar.xz
ipxe-b6fc8be2c43c4e1b068613abadc48c1d86caee2b.zip
[build] Conditionalise use of -mabi=lp64 for ARM64 builds
The -mabi option was added in GCC 4.9. Test for the existence of this option to allow for building with earlier versions of GCC. Reported-by: Benjamin S. Allen <bsallen@alcf.anl.gov> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/arm64/Makefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/arch/arm64/Makefile b/src/arch/arm64/Makefile
index d121871f..9b9dd5ec 100644
--- a/src/arch/arm64/Makefile
+++ b/src/arch/arm64/Makefile
@@ -4,10 +4,21 @@ SRCDIRS += arch/arm64/core
# ARM64-specific flags
#
-CFLAGS += -mabi=lp64 -mlittle-endian -mcmodel=small
+CFLAGS += -mlittle-endian -mcmodel=small
CFLAGS += -fomit-frame-pointer
ASFLAGS += -mabi=lp64 -EL
+# We want to specify the LP64 model. There is an explicit -mabi=lp64
+# on GCC 4.9 and later, and no guarantee as to which is the default
+# model. In earlier versions of GCC, there is no -mabi option and the
+# default appears to be LP64 anyway.
+#
+ifeq ($(CCTYPE),gcc)
+LP64_TEST = $(CC) -mabi=lp64 -x c -c /dev/null -o /dev/null >/dev/null 2>&1
+LP64_FLAGS := $(shell $(LP64_TEST) && $(ECHO) '-mabi=lp64')
+WORKAROUND_CFLAGS += $(LP64_FLAGS)
+endif
+
# EFI requires -fshort-wchar, and nothing else currently uses wchar_t
#
CFLAGS += -fshort-wchar