build: unify target independent optimization options
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 29 Jul 2013 09:38:29 +0000 (09:38 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 29 Jul 2013 09:38:29 +0000 (09:38 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37600 3c298f89-4303-0410-b956-a3cf2f4a3e73

33 files changed:
Config.in
include/target.mk
rules.mk
target/linux/ar71xx/Makefile
target/linux/at91/Makefile
target/linux/cns21xx/Makefile
target/linux/cns3xxx/Makefile
target/linux/cobalt/Makefile
target/linux/ep93xx/Makefile
target/linux/gemini/Makefile
target/linux/generic/patches-3.10/201-extra_optimization.patch
target/linux/generic/patches-3.3/201-extra_optimization.patch
target/linux/generic/patches-3.6/201-extra_optimization.patch
target/linux/generic/patches-3.8/201-extra_optimization.patch
target/linux/generic/patches-3.9/201-extra_optimization.patch
target/linux/imx23/Makefile
target/linux/lantiq/Makefile
target/linux/malta/be/target.mk
target/linux/malta/be64/target.mk
target/linux/malta/le/target.mk
target/linux/malta/le64/target.mk
target/linux/mcs814x/Makefile
target/linux/mpc52xx/Makefile
target/linux/mpc83xx/Makefile
target/linux/mpc85xx/Makefile
target/linux/omap24xx/Makefile
target/linux/orion/Makefile
target/linux/ppc40x/Makefile
target/linux/ppc44x/Makefile
target/linux/ramips/Makefile
target/linux/realview/Makefile
target/linux/sibyte/Makefile
target/linux/x86/rdc/target.mk

index db3094d..0ef2f14 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -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
 
index eeabb25..b6d79fb 100644 (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
index 5ed8000..48be224 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -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
index 52cfc37..c123598 100644 (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
index ff93076..e9cc6d1 100644 (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
 
index a086795..bb691dd 100644 (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
 
index 96d6ab1..a169d0b 100644 (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
index 56799f9..632b61c 100644 (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
index 21db716..1cc0877 100644 (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
index f0e802d..e1586d1 100644 (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
index 6af3d01..ccb7fcf 100644 (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
index e724891..213e6d1 100644 (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
index f255a01..10b2c4d 100644 (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
index 119655d..a7d4bdc 100644 (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
index bd8cc12..8354780 100644 (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
index b77988e..f022cae 100644 (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"
index 25fea54..94b506d 100644 (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
index 90b655c..a4a00b7 100644 (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
index 30804f4..13c5d7e 100644 (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
index 3b6e895..e7c90e9 100644 (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
index bd5c636..86fe90d 100644 (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
index 55ae90c..dac17b8 100644 (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
index d3cf6a2..7b07058 100644 (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
index 2a721da..1bb0d34 100644 (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>
 
index 5a9e7ac..c0dd6e2 100644 (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
index a91b0d2..b3e54d3 100644 (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"
 
index 14cb688..fa06466 100644 (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
index 39b074a..3ae5ca9 100644 (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
index 45512b5..bd62efb 100644 (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
index d918b95..8d17d0c 100644 (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
index 4668137..4d6fa07 100644 (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
index fb27b46..440cff3 100644 (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
index c958945..e38f5e2 100644 (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 \