summaryrefslogtreecommitdiffstats
path: root/arch/mips/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/Makefile')
-rw-r--r--arch/mips/Makefile53
1 files changed, 21 insertions, 32 deletions
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index ee3364d27a..65a00379ab 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
KBUILD_DEFCONFIG := qemu-malta_defconfig
#
@@ -11,7 +13,7 @@ else
64bit-emul = elf64btsmip
endif
-CPPFLAGS += -D__MIPS__ -fno-strict-aliasing -fno-merge-constants
+KBUILD_CPPFLAGS += -D__MIPS__ -fno-strict-aliasing -fno-merge-constants
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
cflags-y += -Wall -Wstrict-prototypes \
@@ -34,17 +36,17 @@ predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
ifdef CONFIG_CPU_BIG_ENDIAN
cflags-y += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be))
-ldflags-y += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB )
+mips-ldflags-y += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB )
endif
ifdef CONFIG_CPU_LITTLE_ENDIAN
cflags-y += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
-ldflags-y += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL )
+mips-ldflags-y += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL )
endif
-LDFLAGS += $(ldflags-y) -m $(ld-emul)
-LDFLAGS_barebox += $(ldflags-y)
-LDFLAGS_pbl += $(ldflags-y)
+KBUILD_LDFLAGS += $(mips-ldflags-y) -m $(ld-emul)
+LDFLAGS_barebox += $(KBUILD_LDFLAGS)
+LDFLAGS_pbl += $(KBUILD_LDFLAGS)
#
# CPU-dependent compiler/assembler options for optimization.
@@ -55,11 +57,17 @@ 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
-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
-CPPFLAGS += -fdata-sections -ffunction-sections
+KBUILD_CPPFLAGS += -fdata-sections -ffunction-sections
LDFLAGS_barebox += -static --gc-sections --emit-relocs
endif
@@ -72,8 +80,6 @@ KBUILD_BINARY := barebox.bin
KBUILD_TARGET := barebox.bin
endif
-LDFLAGS_barebox += -nostdlib
-
machine-$(CONFIG_MACH_MIPS_MALTA) := malta
machine-$(CONFIG_MACH_MIPS_AR231X) := ar231x
machine-$(CONFIG_MACH_MIPS_ATH79) := ath79
@@ -82,22 +88,7 @@ machine-$(CONFIG_MACH_MIPS_LOONGSON) := loongson
machine-$(CONFIG_MACH_MIPS_XBURST) := xburst
machdirs := $(patsubst %,arch/mips/mach-%/,$(machine-y))
-ifeq ($(KBUILD_SRC),)
-CPPFLAGS += $(patsubst %,-I%include,$(machdirs))
-else
-CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
-endif
-
-ifeq ($(incdir-y),)
-incdir-y := $(machine-y)
-endif
-INCDIR := arch-$(incdir-y)
-
-ifeq ($(KBUILD_SRC),)
-CPPFLAGS += -I$(BOARD)/include
-else
-CPPFLAGS += -I$(srctree)/$(BOARD)/include
-endif
+KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
ifneq ($(machine-y),)
MACH := arch/mips/mach-$(machine-y)/
@@ -105,21 +96,19 @@ else
MACH :=
endif
-common-y += $(BOARD)
-
common-y += $(MACH)
common-y += arch/mips/lib/
common-y += arch/mips/boot/
common-y += arch/mips/boards/
-CPPFLAGS += $(cflags-y)
-CFLAGS += $(cflags-y)
+KBUILD_CPPFLAGS += $(cflags-y)
+KBUILD_CFLAGS += $(cflags-y)
lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/mips/lib/barebox.lds
-cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
+cmd_barebox__ ?= $(LD) $(LDFLAGS_barebox) -o $@ \
-T $(BAREBOX_LDS) \
- --start-group $(BAREBOX_OBJS) --end-group \
+ --whole-archive $(BAREBOX_OBJS) --no-whole-archive \
$(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^); \
$(objtree)/scripts/mips-relocs $@