summaryrefslogtreecommitdiffstats
path: root/arch/mips/Makefile
diff options
context:
space:
mode:
authorFranck Bui-Huu <fbuihuu@gmail.com>2007-02-15 12:06:48 +0100
committerRalf Baechle <ralf@linux-mips.org>2007-10-11 23:45:59 +0100
commitadff90a9333004d5459823665e8bcf6cb9214f79 (patch)
treed4eadd84faed02ef8514cca0e22756efbbfe5d2f /arch/mips/Makefile
parent8c67316e706cabc2145d6c8e97f0bd8f2a86d8a1 (diff)
downloadlinux-adff90a9333004d5459823665e8bcf6cb9214f79.tar.bz2
[MIPS] Automatically set CONFIG_BUILD_ELF64
We do not rely on user anymore to setup this config correctly. Instead we make our choice depending on the load address. If we want to force Kbuild to use ELF64 format whatever the load address we can still do: $ make BUILD_ELF32=no Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/Makefile')
-rw-r--r--arch/mips/Makefile23
1 files changed, 20 insertions, 3 deletions
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d5d5831b6e24..4337c492ed1b 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -60,9 +60,6 @@ vmlinux-32 = vmlinux.32
vmlinux-64 = vmlinux
cflags-y += -mabi=64
-ifndef CONFIG_BUILD_ELF64
-cflags-y += $(call cc-option,-msym32)
-endif
endif
all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32)
@@ -576,6 +573,26 @@ else
JIFFIES = jiffies_64
endif
+#
+# Automatically detect the build format. By default we choose
+# the elf format according to the load address.
+# We can always force a build with a 64-bits symbol format by
+# passing 'BUILD_ELF32=no' option to the make's command line.
+#
+ifdef CONFIG_64BIT
+ ifndef BUILD_ELF32
+ ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0)
+ BUILD_ELF32 = y
+ endif
+ endif
+
+ ifeq ($(BUILD_ELF32), y)
+ cflags-y += -msym32
+ else
+ cflags-y += -DCONFIG_BUILD_ELF64
+ endif
+endif
+
AFLAGS += $(cflags-y)
CFLAGS += $(cflags-y) \
-D"VMLINUX_LOAD_ADDRESS=$(load-y)"