The code that uses TEXT_BASE will fail on reading truncated 32-bit address if running with 64BIT enabled. As we only support running from compatibility segments (i.e. no 'proper' 64-bit base addresses), simply make sure the value is sign-extended when passing it as a define. Signed-off-by: Denis Orlov <denorl2009@xxxxxxxxx> --- arch/mips/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/mips/Makefile b/arch/mips/Makefile index bad6e574c4..65a00379ab 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -57,7 +57,13 @@ cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips64 -U_MIPS cflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) -Wa,-mips64r2 -Wa,--trap cflags-$(CONFIG_CPU_GS232) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) -Wa,-mips32r2 -Wa,--trap -KBUILD_CPPFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE) +ifdef CONFIG_64BIT +MIPS_TEXT_BASE = $(subst 0x,0xffffffff,$(CONFIG_TEXT_BASE)) +else +MIPS_TEXT_BASE = $(CONFIG_TEXT_BASE) +endif + +KBUILD_CPPFLAGS += -DTEXT_BASE=$(MIPS_TEXT_BASE) ifndef CONFIG_MODULES # Add cleanup flags -- 2.41.0