diff options
| -rw-r--r-- | arch/arm64/Makefile | 6 | ||||
| -rw-r--r-- | scripts/Kbuild.include | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 072547e675ab..566cd87c9ced 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -92,12 +92,14 @@ KBUILD_AFLAGS += $(lseinstr) $(vdso32) ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) KBUILD_CPPFLAGS += -mbig-endian AS += -EB -LDFLAGS += -EB -maarch64elfb +# Prefer the baremetal ELF build target, but not all toolchains include +LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb) UTS_MACHINE := aarch64_be else KBUILD_CPPFLAGS += -mlittle-endian AS += -EL -LDFLAGS += -EL -maarch64elf +# Same as above, prefer ELF but fall back to linux target if needed. +LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux) UTS_MACHINE := aarch64 endif diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index fcf10806de4d..8a491e6b542c 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -196,8 +196,8 @@ cc-ldoption = $(call try-run,\ $(CC) $(1) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) # ld-option -# Usage: LDFLAGS += $(call ld-option, -X) -ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2)) +# Usage: LDFLAGS += $(call ld-option, -X, -Y) +ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3)) # ar-option # Usage: KBUILD_ARFLAGS := $(call ar-option,D) |
