mirror of
https://github.com/u-boot/u-boot.git
synced 2025-01-27 05:03:28 +08:00
MIPS: refactor setting of compiler options
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>
This commit is contained in:
parent
4207917867
commit
837cad1e47
@ -5,25 +5,41 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0+
|
# SPDX-License-Identifier: GPL-2.0+
|
||||||
#
|
#
|
||||||
|
|
||||||
ifeq ($(CROSS_COMPILE),)
|
ifdef CONFIG_SYS_BIG_ENDIAN
|
||||||
CROSS_COMPILE := mips_4KC-
|
32bit-emul := elf32btsmip
|
||||||
endif
|
64bit-emul := elf64btsmip
|
||||||
|
32bit-bfd := elf32-tradbigmips
|
||||||
# Handle special prefix in ELDK 4.0 toolchain
|
64bit-bfd := elf64-tradbigmips
|
||||||
ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
|
PLATFORM_CPPFLAGS += -EB
|
||||||
ENDIANNESS := -EL
|
PLATFORM_LDFLAGS += -EB
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_SYS_LITTLE_ENDIAN
|
ifdef CONFIG_SYS_LITTLE_ENDIAN
|
||||||
ENDIANNESS := -EL
|
32bit-emul := elf32ltsmip
|
||||||
|
64bit-emul := elf64ltsmip
|
||||||
|
32bit-bfd := elf32-tradlittlemips
|
||||||
|
64bit-bfd := elf64-tradlittlemips
|
||||||
|
PLATFORM_CPPFLAGS += -EL
|
||||||
|
PLATFORM_LDFLAGS += -EL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_SYS_BIG_ENDIAN
|
ifdef CONFIG_32BIT
|
||||||
ENDIANNESS := -EB
|
PLATFORM_CPPFLAGS += -mabi=32
|
||||||
|
PLATFORM_LDFLAGS += -m $(32bit-emul)
|
||||||
|
OBJCOPYFLAGS += -O $(32bit-bfd)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Default to EB if no endianess is configured
|
ifdef CONFIG_64BIT
|
||||||
ENDIANNESS ?= -EB
|
PLATFORM_CPPFLAGS += -mabi=64
|
||||||
|
PLATFORM_LDFLAGS += -m$(64bit-emul)
|
||||||
|
OBJCOPYFLAGS += -O $(64bit-bfd)
|
||||||
|
endif
|
||||||
|
|
||||||
|
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__
|
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
|
# 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.
|
# 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_CPPFLAGS += -msoft-float
|
||||||
PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib $(ENDIANNESS)
|
PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib
|
||||||
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
|
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
|
||||||
LDFLAGS_FINAL += --gc-sections -pie
|
LDFLAGS_FINAL += --gc-sections -pie
|
||||||
OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .got
|
OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .got
|
||||||
|
@ -5,19 +5,5 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0+
|
# 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 \
|
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \
|
||||||
-T $(srctree)/examples/standalone/mips.lds
|
-T $(srctree)/examples/standalone/mips.lds
|
||||||
|
@ -5,19 +5,5 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0+
|
# 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 \
|
CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 \
|
||||||
-T $(srctree)/examples/standalone/mips64.lds
|
-T $(srctree)/examples/standalone/mips64.lds
|
||||||
|
Loading…
Reference in New Issue
Block a user