build: unify target independent optimization options

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37600
lede-17.01
Felix Fietkau 2013-07-29 09:38:29 +00:00
parent 80dd55228e
commit 73c4d73d6d
33 changed files with 51 additions and 44 deletions

View File

@ -847,6 +847,12 @@ menuconfig DEVEL
in the package directory, pointing to the .git tree that you want
to pull the source code from
config EXTRA_OPTIMIZATION
string "Additional compiler options" if DEVEL
default "-fno-caller-saves"
help
Extra Target-independent optimizations to use when building for the target.
menuconfig TARGET_OPTIONS
bool "Target Options" if DEVEL

View File

@ -191,17 +191,17 @@ ifeq ($(DUMP),1)
# remove duplicates
FEATURES:=$(sort $(FEATURES))
endif
DEFAULT_CFLAGS_i386=-O2 -pipe -march=i486 -fno-caller-saves
DEFAULT_CFLAGS_x86_64=-O2 -pipe -march=athlon64 -fno-caller-saves
DEFAULT_CFLAGS_m68k=-Os -pipe -mcfv4e -fno-caller-saves
DEFAULT_CFLAGS_mips=-Os -pipe -mips32 -mtune=mips32 -fno-caller-saves -mno-branch-likely
DEFAULT_CFLAGS_i386=-O2 -pipe -march=i486
DEFAULT_CFLAGS_x86_64=-O2 -pipe -march=athlon64
DEFAULT_CFLAGS_m68k=-Os -pipe -mcfv4e
DEFAULT_CFLAGS_mips=-Os -pipe -mips32 -mtune=mips32 -mno-branch-likely
DEFAULT_CFLAGS_mipsel=$(DEFAULT_CFLAGS_mips)
DEFAULT_CFLAGS_mips64=-Os -pipe -mips64 -mtune=mips64 -mabi=64 -fno-caller-saves
DEFAULT_CFLAGS_mips64=-Os -pipe -mips64 -mtune=mips64 -mabi=64
DEFAULT_CFLAGS_mips64el=$(DEFAULT_CFLAGS_mips64)
DEFAULT_CFLAGS_sparc=-Os -pipe -mcpu=ultrasparc -fno-caller-saves
DEFAULT_CFLAGS_arm=-Os -pipe -march=armv5te -mtune=xscale -fno-caller-saves
DEFAULT_CFLAGS_sparc=-Os -pipe -mcpu=ultrasparc
DEFAULT_CFLAGS_arm=-Os -pipe -march=armv5te -mtune=xscale
DEFAULT_CFLAGS_armeb=$(DEFAULT_CFLAGS_arm)
DEFAULT_CFLAGS=$(if $(DEFAULT_CFLAGS_$(ARCH)),$(DEFAULT_CFLAGS_$(ARCH)),-Os -pipe -fno-caller-saves)
DEFAULT_CFLAGS=$(if $(DEFAULT_CFLAGS_$(ARCH)),$(DEFAULT_CFLAGS_$(ARCH)),-Os -pipe)
endif
define BuildTargets/DumpCurrent

View File

@ -38,6 +38,7 @@ ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONF
ARCH_PACKAGES:=$(call qstrip,$(CONFIG_TARGET_ARCH_PACKAGES))
BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
export EXTRA_OPTIMIZATION:=$(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))
TARGET_SUFFIX=$(call qstrip,$(CONFIG_TARGET_SUFFIX))
BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX))
SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
@ -127,7 +128,7 @@ BUILD_LOG_DIR:=$(TOPDIR)/logs
PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
TARGET_PATH:=$(STAGING_DIR_HOST)/bin:$(subst $(space),:,$(filter-out .,$(filter-out ./,$(subst :,$(space),$(PATH)))))
TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3)
TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3) $(EXTRA_OPTIMIZATION)
TARGET_CXXFLAGS = $(TARGET_CFLAGS)
TARGET_ASFLAGS = $(TARGET_CFLAGS) $(TARGET_ASFLAGS_OVERRIDE)
TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include

View File

@ -10,7 +10,7 @@ ARCH:=mips
BOARD:=ar71xx
BOARDNAME:=Atheros AR7xxx/AR9xxx
FEATURES:=squashfs targz mips16
CFLAGS:=-Os -pipe -mips32r2 -mtune=34kc -fno-caller-saves -mno-branch-likely
CFLAGS:=-Os -pipe -mips32r2 -mtune=34kc -mno-branch-likely
SUBTARGETS:=generic nand
LINUX_VERSION:=3.10.3

View File

@ -11,7 +11,7 @@ BOARD:=at91
MAINTAINER:=Claudio Mignanti <c.mignanti@gmail.com>
BOARDNAME:=Atmel AT91
FEATURES:=squashfs targz ext2 usb
CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s -fno-caller-saves
CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s
LINUX_VERSION:=3.8.13

View File

@ -10,7 +10,7 @@ ARCH:=arm
BOARD:=cns21xx
BOARDNAME:=Cavium Networks Econa CNS21xx
FEATURES:=squashfs
CFLAGS:=-Os -pipe -march=armv4 -mtune=fa526 -fno-caller-saves
CFLAGS:=-Os -pipe -march=armv4 -mtune=fa526
LINUX_VERSION:=3.8.13

View File

@ -10,7 +10,7 @@ ARCH:=arm
BOARD:=cns3xxx
BOARDNAME:=Cavium Networks Econa CNS3xxx
FEATURES:=squashfs fpu gpio pcie usb usbgadget
CFLAGS:=-Os -pipe -march=armv6k -mtune=mpcore -mfloat-abi=softfp -mfpu=vfp -fno-caller-saves
CFLAGS:=-Os -pipe -march=armv6k -mtune=mpcore -mfloat-abi=softfp -mfpu=vfp
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
LINUX_VERSION:=3.8.13

View File

@ -10,7 +10,7 @@ ARCH:=mipsel
BOARD:=cobalt
BOARDNAME:=Cobalt Microservers
FEATURES:=targz pci ext4 display
CFLAGS:=-O2 -pipe -mtune=r5000 -fno-caller-saves
CFLAGS:=-O2 -pipe -mtune=r5000
MAINTAINER:=Florian Fainelli <florian@openwrt.org>
LINUX_VERSION:=3.3.8

View File

@ -10,7 +10,7 @@ ARCH:=arm
BOARD:=ep93xx
BOARDNAME:=Cirrus Logic EP93xx
FEATURES:=squashfs ext4 targz usb display sound
CFLAGS:=-Os -pipe -march=armv4t -fno-caller-saves
CFLAGS:=-Os -pipe -march=armv4t
MAINTAINER:=Florian Fainelli <florian@openwrt.org>
LINUX_VERSION:=3.8.13

View File

@ -10,7 +10,7 @@ ARCH:=arm
BOARD:=gemini
BOARDNAME:=Cortina Systems CS351x
FEATURES:=squashfs pci
CFLAGS:=-Os -pipe -march=armv4 -mtune=fa526 -fno-caller-saves
CFLAGS:=-Os -pipe -march=armv4 -mtune=fa526
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
LINUX_VERSION:=3.9.11

View File

@ -5,10 +5,10 @@
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
+KBUILD_CFLAGS += -Os -fno-caller-saves $(call cc-disable-warning,maybe-uninitialized,)
+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION) $(call cc-disable-warning,maybe-uninitialized,)
else
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch -fno-caller-saves
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
endif
include $(srctree)/arch/$(SRCARCH)/Makefile

View File

@ -5,10 +5,10 @@
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS += -Os
+KBUILD_CFLAGS += -Os -fno-caller-saves
+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION)
else
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch -fno-caller-saves
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
endif
include $(srctree)/arch/$(SRCARCH)/Makefile

View File

@ -5,10 +5,10 @@
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS += -Os
+KBUILD_CFLAGS += -Os -fno-caller-saves
+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION)
else
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch -fno-caller-saves
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
endif
include $(srctree)/arch/$(SRCARCH)/Makefile

View File

@ -5,10 +5,10 @@
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS += -Os
+KBUILD_CFLAGS += -Os -fno-caller-saves
+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION)
else
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch -fno-caller-saves
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
endif
include $(srctree)/arch/$(SRCARCH)/Makefile

View File

@ -5,10 +5,10 @@
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS += -Os
+KBUILD_CFLAGS += -Os -fno-caller-saves
+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION)
else
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch -fno-caller-saves
+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
endif
include $(srctree)/arch/$(SRCARCH)/Makefile

View File

@ -10,7 +10,7 @@ ARCH:=arm
BOARD:=imx23
BOARDNAME:=Freescale i.MX23 series
FEATURES:=ext4 rtc usb gpio
CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s -fno-caller-saves
CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s
MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
LINUX_VERSION:=3.10.3
KERNELNAME:="zImage dtbs"

View File

@ -13,7 +13,7 @@ SUBTARGETS=xway ase falcon
LINUX_VERSION:=3.8.13
CFLAGS=-Os -pipe -mips32r2 -fno-caller-saves -mno-branch-likely
CFLAGS=-Os -pipe -mips32r2 -mno-branch-likely
define Target/Description
Build firmware images for Lantiq SoC

View File

@ -3,7 +3,7 @@ ARCH_PACKAGES:=malta_mips
SUBTARGET:=be
BOARDNAME:=Big Endian
FEATURES:=ramdisk mips16
CFLAGS:=-Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves
CFLAGS:=-Os -pipe -mips32r2 -mtune=mips32r2
define Target/Description
Build BE firmware images for MIPS Malta CoreLV board running in

View File

@ -2,7 +2,7 @@ ARCH:=mips64
ARCH_PACKAGES:=malta_mips64
SUBTARGET:=be64
BOARDNAME:=Big Endian (64-bits)
CFLAGS:=-Os -pipe -mips64 -mtune=mips64 -fno-caller-saves
CFLAGS:=-Os -pipe -mips64 -mtune=mips64
FEATURES:=ramdisk
define Target/Description

View File

@ -3,7 +3,7 @@ ARCH_PACKAGES:=malta_mipsel
SUBTARGET:=le
BOARDNAME:=Little Endian
FEATURES:=ramdisk mips16
CFLAGS:=-Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves
CFLAGS:=-Os -pipe -mips32r2 -mtune=mips32r2
define Target/Description
Build LE firmware images for MIPS Malta CoreLV board running in

View File

@ -2,7 +2,7 @@ ARCH:=mips64el
ARCH_PACKAGES:=malta_mipsel64
SUBTARGET:=le64
BOARDNAME:=Little Endian (64-bits)
CFLAGS:=-Os -pipe -mips64 -mtune=mips64 -fno-caller-saves
CFLAGS:=-Os -pipe -mips64 -mtune=mips64
FEATURES:=ramdisk
define Target/Description

View File

@ -10,7 +10,7 @@ ARCH:=arm
BOARD:=mcs814x
BOARDNAME:=Moschip MCS814x
FEATURES:=usb squashfs
CFLAGS=-Os -pipe -march=armv5te -mtune=arm926ej-s -fno-caller-saves
CFLAGS=-Os -pipe -march=armv5te -mtune=arm926ej-s
MAINTAINER:=Florian Fainelli <florian@openwrt.org>
LINUX_VERSION:=3.3.8

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
ARCH:=powerpc
BOARD:=mpc52xx
BOARDNAME:=Freescale MPC52xx
CFLAGS:=-Os -pipe -fno-caller-saves -mcpu=603e
CFLAGS:=-Os -pipe -mcpu=603e
FEATURES:=targz ext4
LINUX_VERSION:=3.8.13

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
ARCH:=powerpc
BOARD:=mpc83xx
BOARDNAME:=Freescale MPC83xx
CFLAGS:=-Os -pipe -fno-caller-saves -mcpu=603e
CFLAGS:=-Os -pipe -mcpu=603e
FEATURES:=squashfs targz
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
ARCH:=powerpc
BOARD:=mpc85xx
BOARDNAME:=Freescale MPC85xx
CFLAGS:=-Os -pipe -fno-caller-saves -mcpu=8540
CFLAGS:=-Os -pipe -mcpu=8540
FEATURES:=spe_fpu squashfs
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
SUBTARGETS=generic p1020

View File

@ -18,7 +18,7 @@ define Target/Description
TI OMAP-24xx
endef
CFLAGS:=-Os -pipe -march=armv6 -mtune=arm1136j-s -fno-caller-saves
CFLAGS:=-Os -pipe -march=armv6 -mtune=arm1136j-s
KERNELNAME:="zImage"

View File

@ -10,7 +10,7 @@ ARCH:=arm
BOARD:=orion
BOARDNAME:=Marvell Orion
SUBTARGETS:=generic harddisk
CFLAGS=-Os -pipe -march=armv5te -mtune=xscale -fno-caller-saves
CFLAGS=-Os -pipe -march=armv5te -mtune=xscale
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
LINUX_VERSION:=3.3.8

View File

@ -10,7 +10,7 @@ ARCH:=powerpc
BOARD:=ppc40x
BOARDNAME:=AMCC/IBM PPC40x
FEATURES:=squashfs
CFLAGS:=-Os -pipe -fno-caller-saves -mcpu=405
CFLAGS:=-Os -pipe -mcpu=405
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
LINUX_VERSION:=3.8.13

View File

@ -10,7 +10,7 @@ ARCH:=powerpc
BOARD:=ppc44x
BOARDNAME:=AMCC/IBM PPC44x
FEATURES:=squashfs broken
CFLAGS:=-Os -pipe -fno-caller-saves -mcpu=440
CFLAGS:=-Os -pipe -mcpu=440
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
LINUX_VERSION:=3.8.13

View File

@ -10,7 +10,7 @@ ARCH:=mipsel
BOARD:=ramips
BOARDNAME:=Ralink RT288x/RT3xxx
SUBTARGETS:=rt288x rt305x rt3883 mt7620a
CFLAGS:=-Os -pipe -fno-caller-saves -mno-branch-likely
CFLAGS:=-Os -pipe -mno-branch-likely
FEATURES:=squashfs gpio
LINUX_VERSION:=3.10.3

View File

@ -10,7 +10,7 @@ ARCH:=arm
BOARD:=realview
BOARDNAME:=ARM Ltd. Realview board (qemu)
FEATURES:=fpu ramdisk
CFLAGS:=-Os -pipe -march=armv6k -mtune=mpcore -mfloat-abi=softfp -mfpu=vfp -fno-caller-saves
CFLAGS:=-Os -pipe -march=armv6k -mtune=mpcore -mfloat-abi=softfp -mfpu=vfp
MAINTAINER:=Florian Fainelli <florian@openwrt.org>
LINUX_VERSION:=3.10.3

View File

@ -10,7 +10,7 @@ ARCH:=mips
BOARD:=sibyte
BOARDNAME:=Broadcom/SiByte SB-1
FEATURES:=fpu ramdisk broken
CFLAGS:=-Os -pipe -march=sb1 -fno-caller-saves
CFLAGS:=-Os -pipe -march=sb1
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
LINUX_VERSION:=3.3.8

View File

@ -1,6 +1,6 @@
BOARDNAME:=RDC R-321x
FEATURES:=squashfs pci usb gpio pcmcia
CFLAGS:=-Os -pipe -march=i486 -mtune=i486 -fno-caller-saves
CFLAGS:=-Os -pipe -march=i486 -mtune=i486
MAINTAINER:=Florian Fainelli <florian@openwrt.org>
DEFAULT_PACKAGES += kmod-llc kmod-stp kmod-bridge kmod-8021q \