# 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.
+# passing 'KBUILD_SYM32=no' option to the make's command line.
#
ifdef CONFIG_64BIT
- ifndef BUILD_ELF32
+ ifndef KBUILD_SYM32
ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0)
- BUILD_ELF32 = y
+ KBUILD_SYM32 = y
endif
endif
- ifeq ($(BUILD_ELF32), y)
- cflags-y += -msym32
- else
- cflags-y += -DCONFIG_BUILD_ELF64
+ ifeq ($(KBUILD_SYM32), y)
+ cflags-y += -msym32 -DKBUILD_64BIT_SYM32
endif
endif
/*
* __pa()/__va() should be used only during mem init.
*/
-#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
+#ifdef KBUILD_64BIT_SYM32
#define __pa(x) \
({ \
unsigned long __x = (unsigned long)(x); \
#define VMALLOC_START MAP_BASE
#define VMALLOC_END \
(VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE)
-#if defined(CONFIG_MODULES) && !defined(CONFIG_BUILD_ELF64) && \
+#if defined(CONFIG_MODULES) && defined(KBUILD_64BIT_SYM32) && \
VMALLOC_START != CKSSEG
/* Load modules into 32bit-compatible segment. */
#define MODULE_START CKSSEG
#else
MFC0 k0, CP0_CONTEXT
#endif
-#if defined(CONFIG_BUILD_ELF64) || (defined(CONFIG_64BIT) && __GNUC__ < 4)
+#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
+ lui k1, %hi(kernelsp)
+#else
lui k1, %highest(kernelsp)
daddiu k1, %higher(kernelsp)
dsll k1, 16
daddiu k1, %hi(kernelsp)
dsll k1, 16
-#else
- lui k1, %hi(kernelsp)
#endif
LONG_SRL k0, PTEBASE_SHIFT
LONG_ADDU k1, k0
.endm
#else
.macro get_saved_sp /* Uniprocessor variation */
-#if defined(CONFIG_BUILD_ELF64) || (defined(CONFIG_64BIT) && __GNUC__ < 4)
+#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
+ lui k1, %hi(kernelsp)
+#else
lui k1, %highest(kernelsp)
daddiu k1, %higher(kernelsp)
dsll k1, k1, 16
daddiu k1, %hi(kernelsp)
dsll k1, k1, 16
-#else
- lui k1, %hi(kernelsp)
#endif
LONG_L k1, %lo(kernelsp)(k1)
.endm