]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
MIPS: refactor setting of compiler options
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Sun, 26 Oct 2014 13:16:23 +0000 (14:16 +0100)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Sat, 1 Nov 2014 17:18:05 +0000 (18:18 +0100)
Refactor and unify all compiler settings in arch/mips/config.mk.
Also add tune flags for each supported CPU type.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
arch/mips/config.mk
arch/mips/cpu/mips32/config.mk
arch/mips/cpu/mips64/config.mk

index a2d07aff1b1d5209fbb925b4a4399ee707e365e2..b758116d972da41240a42064256c6599a733eac1 100644 (file)
@@ -5,25 +5,41 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE := mips_4KC-
+ifdef CONFIG_SYS_BIG_ENDIAN
+32bit-emul             := elf32btsmip
+64bit-emul             := elf64btsmip
+32bit-bfd              := elf32-tradbigmips
+64bit-bfd              := elf64-tradbigmips
+PLATFORM_CPPFLAGS      += -EB
+PLATFORM_LDFLAGS       += -EB
 endif
 
-# Handle special prefix in ELDK 4.0 toolchain
-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS := -EL
+ifdef CONFIG_SYS_LITTLE_ENDIAN
+32bit-emul             := elf32ltsmip
+64bit-emul             := elf64ltsmip
+32bit-bfd              := elf32-tradlittlemips
+64bit-bfd              := elf64-tradlittlemips
+PLATFORM_CPPFLAGS      += -EL
+PLATFORM_LDFLAGS       += -EL
 endif
 
-ifdef CONFIG_SYS_LITTLE_ENDIAN
-ENDIANNESS := -EL
+ifdef CONFIG_32BIT
+PLATFORM_CPPFLAGS      += -mabi=32
+PLATFORM_LDFLAGS       += -m $(32bit-emul)
+OBJCOPYFLAGS           += -O $(32bit-bfd)
 endif
 
-ifdef CONFIG_SYS_BIG_ENDIAN
-ENDIANNESS := -EB
+ifdef CONFIG_64BIT
+PLATFORM_CPPFLAGS      += -mabi=64
+PLATFORM_LDFLAGS       += -m$(64bit-emul)
+OBJCOPYFLAGS           += -O $(64bit-bfd)
 endif
 
-# Default to EB if no endianess is configured
-ENDIANNESS ?= -EB
+cpuflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,-mips32
+cpuflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,-mips32r2
+cpuflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,-mips64
+cpuflags-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,-mips64r2
+PLATFORM_CPPFLAGS += $(cpuflags-y)
 
 PLATFORM_CPPFLAGS += -D__MIPS__
 
@@ -49,9 +65,9 @@ __HAVE_ARCH_GENERIC_BOARD := y
 # On the other hand, we want PIC in the U-Boot code to relocate it from ROM
 # to RAM. $28 is always used as gp.
 #
-PLATFORM_CPPFLAGS              += -G 0 -mabicalls -fpic $(ENDIANNESS)
+PLATFORM_CPPFLAGS              += -G 0 -mabicalls -fpic
 PLATFORM_CPPFLAGS              += -msoft-float
-PLATFORM_LDFLAGS               += -G 0 -static -n -nostdlib $(ENDIANNESS)
+PLATFORM_LDFLAGS               += -G 0 -static -n -nostdlib
 PLATFORM_RELFLAGS              += -ffunction-sections -fdata-sections
 LDFLAGS_FINAL                  += --gc-sections -pie
 OBJCOPYFLAGS                   += -j .text -j .rodata -j .data -j .got
index 332cd62c74901869009aa40d9c32f30a2fbc93df..4257c56d59e3b104faa7326286efb5408c95ee66 100644 (file)
@@ -5,19 +5,5 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-#
-# Default optimization level for MIPS32
-#
-# Note: Toolchains with binutils prior to v2.16
-# are no longer supported by U-Boot MIPS tree!
-#
-PLATFORM_CPPFLAGS += -DCONFIG_MIPS32 -march=mips32r2
-PLATFORM_CPPFLAGS += -mabi=32 -DCONFIG_32BIT
-ifdef CONFIG_SYS_BIG_ENDIAN
-PLATFORM_LDFLAGS  += -m elf32btsmip
-else
-PLATFORM_LDFLAGS  += -m elf32ltsmip
-endif
-
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \
                               -T $(srctree)/examples/standalone/mips.lds
index c55eb7f2ee9089e042d566c873b3740370c52332..96eb82948d4a1a53005948c28f0124fac95250ed 100644 (file)
@@ -5,19 +5,5 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-#
-# Default optimization level for MIPS64
-#
-# Note: Toolchains with binutils prior to v2.16
-# are no longer supported by U-Boot MIPS tree!
-#
-PLATFORM_CPPFLAGS += -DCONFIG_MIPS64 -march=mips64
-PLATFORM_CPPFLAGS += -mabi=64 -DCONFIG_64BIT
-ifdef CONFIG_SYS_BIG_ENDIAN
-PLATFORM_LDFLAGS  += -m elf64btsmip
-else
-PLATFORM_LDFLAGS  += -m elf64ltsmip
-endif
-
 CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 \
                               -T $(srctree)/examples/standalone/mips64.lds