aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-07-29 09:38:29 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-07-29 09:38:29 +0000
commit01695667a89785538d92a65f85c739ad27a5db09 (patch)
tree66cc67ad618d7ddfdf73f2927eeb37e20355dd44
parent6562d215fc07a8420c2dca1aa4d6e491303231bd (diff)
downloadmaster-187ad058-01695667a89785538d92a65f85c739ad27a5db09.tar.gz
master-187ad058-01695667a89785538d92a65f85c739ad27a5db09.tar.bz2
master-187ad058-01695667a89785538d92a65f85c739ad27a5db09.zip
build: unify target independent optimization options
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37600 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--Config.in6
-rw-r--r--include/target.mk16
-rw-r--r--rules.mk3
-rw-r--r--target/linux/ar71xx/Makefile2
-rw-r--r--target/linux/at91/Makefile2
-rw-r--r--target/linux/cns21xx/Makefile2
-rw-r--r--target/linux/cns3xxx/Makefile2
-rw-r--r--target/linux/cobalt/Makefile2
-rw-r--r--target/linux/ep93xx/Makefile2
-rw-r--r--target/linux/gemini/Makefile2
-rw-r--r--target/linux/generic/patches-3.10/201-extra_optimization.patch4
-rw-r--r--target/linux/generic/patches-3.3/201-extra_optimization.patch4
-rw-r--r--target/linux/generic/patches-3.6/201-extra_optimization.patch4
-rw-r--r--target/linux/generic/patches-3.8/201-extra_optimization.patch4
-rw-r--r--target/linux/generic/patches-3.9/201-extra_optimization.patch4
-rw-r--r--target/linux/imx23/Makefile2
-rw-r--r--target/linux/lantiq/Makefile2
-rw-r--r--target/linux/malta/be/target.mk2
-rw-r--r--target/linux/malta/be64/target.mk2
-rw-r--r--target/linux/malta/le/target.mk2
-rw-r--r--target/linux/malta/le64/target.mk2
-rw-r--r--target/linux/mcs814x/Makefile2
-rw-r--r--target/linux/mpc52xx/Makefile2
-rw-r--r--target/linux/mpc83xx/Makefile2
-rw-r--r--target/linux/mpc85xx/Makefile2
-rw-r--r--target/linux/omap24xx/Makefile2
-rw-r--r--target/linux/orion/Makefile2
-rw-r--r--target/linux/ppc40x/Makefile2
-rw-r--r--target/linux/ppc44x/Makefile2
-rw-r--r--target/linux/ramips/Makefile2
-rw-r--r--target/linux/realview/Makefile2
-rw-r--r--target/linux/sibyte/Makefile2
-rw-r--r--target/linux/x86/rdc/target.mk2
33 files changed, 51 insertions, 44 deletions
diff --git a/Config.in b/Config.in
index db3094d729..0ef2f1413d 100644
--- 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
diff --git a/include/target.mk b/include/target.mk
index eeabb25f37..b6d79fb20a 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -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
diff --git a/rules.mk b/rules.mk
index 5ed8000e05..48be224858 100644
--- 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
diff --git a/target/linux/ar71xx/Makefile b/target/linux/ar71xx/Makefile
index 52cfc371ab..c123598e3b 100644
--- a/target/linux/ar71xx/Makefile
+++ b/target/linux/ar71xx/Makefile
@@ -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
diff --git a/target/linux/at91/Makefile b/target/linux/at91/Makefile
index ff93076f1d..e9cc6d1c49 100644
--- a/target/linux/at91/Makefile
+++ b/target/linux/at91/Makefile
@@ -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
diff --git a/target/linux/cns21xx/Makefile b/target/linux/cns21xx/Makefile
index a08679589a..bb691ddebc 100644
--- a/target/linux/cns21xx/Makefile
+++ b/target/linux/cns21xx/Makefile
@@ -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
diff --git a/target/linux/cns3xxx/Makefile b/target/linux/cns3xxx/Makefile
index 96d6ab137c..a169d0bbe9 100644
--- a/target/linux/cns3xxx/Makefile
+++ b/target/linux/cns3xxx/Makefile
@@ -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
diff --git a/target/linux/cobalt/Makefile b/target/linux/cobalt/Makefile
index 56799f9ba4..632b61c70a 100644
--- a/target/linux/cobalt/Makefile
+++ b/target/linux/cobalt/Makefile
@@ -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
diff --git a/target/linux/ep93xx/Makefile b/target/linux/ep93xx/Makefile
index 21db716a79..1cc08770cd 100644
--- a/target/linux/ep93xx/Makefile
+++ b/target/linux/ep93xx/Makefile
@@ -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
diff --git a/target/linux/gemini/Makefile b/target/linux/gemini/Makefile
index f0e802dba8..e1586d138f 100644
--- a/target/linux/gemini/Makefile
+++ b/target/linux/gemini/Makefile
@@ -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
diff --git a/target/linux/generic/patches-3.10/201-extra_optimization.patch b/target/linux/generic/patches-3.10/201-extra_optimization.patch
index 6af3d01ba2..ccb7fcfb3b 100644
--- a/target/linux/generic/patches-3.10/201-extra_optimization.patch
+++ b/target/linux/generic/patches-3.10/201-extra_optimization.patch
@@ -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
diff --git a/target/linux/generic/patches-3.3/201-extra_optimization.patch b/target/linux/generic/patches-3.3/201-extra_optimization.patch
index e724891e4f..213e6d12a1 100644
--- a/target/linux/generic/patches-3.3/201-extra_optimization.patch
+++ b/target/linux/generic/patches-3.3/201-extra_optimization.patch
@@ -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
diff --git a/target/linux/generic/patches-3.6/201-extra_optimization.patch b/target/linux/generic/patches-3.6/201-extra_optimization.patch
index f255a01c1a..10b2c4dfa8 100644
--- a/target/linux/generic/patches-3.6/201-extra_optimization.patch
+++ b/target/linux/generic/patches-3.6/201-extra_optimization.patch
@@ -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
diff --git a/target/linux/generic/patches-3.8/201-extra_optimization.patch b/target/linux/generic/patches-3.8/201-extra_optimization.patch
index 119655dfd3..a7d4bdcef3 100644
--- a/target/linux/generic/patches-3.8/201-extra_optimization.patch
+++ b/target/linux/generic/patches-3.8/201-extra_optimization.patch
@@ -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
diff --git a/target/linux/generic/patches-3.9/201-extra_optimization.patch b/target/linux/generic/patches-3.9/201-extra_optimization.patch
index bd8cc12260..8354780aef 100644
--- a/target/linux/generic/patches-3.9/201-extra_optimization.patch
+++ b/target/linux/generic/patches-3.9/201-extra_optimization.patch
@@ -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
diff --git a/target/linux/imx23/Makefile b/target/linux/imx23/Makefile
index b77988e78b..f022cae8d5 100644
--- a/target/linux/imx23/Makefile
+++ b/target/linux/imx23/Makefile
@@ -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"
diff --git a/target/linux/lantiq/Makefile b/target/linux/lantiq/Makefile
index 25fea54080..94b506d4ee 100644
--- a/target/linux/lantiq/Makefile
+++ b/target/linux/lantiq/Makefile
@@ -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
diff --git a/target/linux/malta/be/target.mk b/target/linux/malta/be/target.mk
index 90b655c8d2..a4a00b7106 100644
--- a/target/linux/malta/be/target.mk
+++ b/target/linux/malta/be/target.mk
@@ -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
diff --git a/target/linux/malta/be64/target.mk b/target/linux/malta/be64/target.mk
index 30804f4e1e..13c5d7e3b9 100644
--- a/target/linux/malta/be64/target.mk
+++ b/target/linux/malta/be64/target.mk
@@ -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
diff --git a/target/linux/malta/le/target.mk b/target/linux/malta/le/target.mk
index 3b6e8953d0..e7c90e9235 100644
--- a/target/linux/malta/le/target.mk
+++ b/target/linux/malta/le/target.mk
@@ -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
diff --git a/target/linux/malta/le64/target.mk b/target/linux/malta/le64/target.mk
index bd5c63619e..86fe90d446 100644
--- a/target/linux/malta/le64/target.mk
+++ b/target/linux/malta/le64/target.mk
@@ -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
diff --git a/target/linux/mcs814x/Makefile b/target/linux/mcs814x/Makefile
index 55ae90c4c5..dac17b8f90 100644
--- a/target/linux/mcs814x/Makefile
+++ b/target/linux/mcs814x/Makefile
@@ -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
diff --git a/target/linux/mpc52xx/Makefile b/target/linux/mpc52xx/Makefile
index d3cf6a2950..7b07058944 100644
--- a/target/linux/mpc52xx/Makefile
+++ b/target/linux/mpc52xx/Makefile
@@ -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
diff --git a/target/linux/mpc83xx/Makefile b/target/linux/mpc83xx/Makefile
index 2a721dace0..1bb0d34bbc 100644
--- a/target/linux/mpc83xx/Makefile
+++ b/target/linux/mpc83xx/Makefile
@@ -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>
diff --git a/target/linux/mpc85xx/Makefile b/target/linux/mpc85xx/Makefile
index 5a9e7ac6a1..c0dd6e216b 100644
--- a/target/linux/mpc85xx/Makefile
+++ b/target/linux/mpc85xx/Makefile
@@ -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
diff --git a/target/linux/omap24xx/Makefile b/target/linux/omap24xx/Makefile
index a91b0d2d13..b3e54d31be 100644
--- a/target/linux/omap24xx/Makefile
+++ b/target/linux/omap24xx/Makefile
@@ -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"
diff --git a/target/linux/orion/Makefile b/target/linux/orion/Makefile
index 14cb688293..fa06466e89 100644
--- a/target/linux/orion/Makefile
+++ b/target/linux/orion/Makefile
@@ -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
diff --git a/target/linux/ppc40x/Makefile b/target/linux/ppc40x/Makefile
index 39b074a5c7..3ae5ca9d17 100644
--- a/target/linux/ppc40x/Makefile
+++ b/target/linux/ppc40x/Makefile
@@ -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
diff --git a/target/linux/ppc44x/Makefile b/target/linux/ppc44x/Makefile
index 45512b55cc..bd62efb258 100644
--- a/target/linux/ppc44x/Makefile
+++ b/target/linux/ppc44x/Makefile
@@ -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
diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
index d918b951c4..8d17d0ca32 100644
--- a/target/linux/ramips/Makefile
+++ b/target/linux/ramips/Makefile
@@ -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
diff --git a/target/linux/realview/Makefile b/target/linux/realview/Makefile
index 4668137c23..4d6fa07acf 100644
--- a/target/linux/realview/Makefile
+++ b/target/linux/realview/Makefile
@@ -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
diff --git a/target/linux/sibyte/Makefile b/target/linux/sibyte/Makefile
index fb27b4633d..440cff3b85 100644
--- a/target/linux/sibyte/Makefile
+++ b/target/linux/sibyte/Makefile
@@ -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
diff --git a/target/linux/x86/rdc/target.mk b/target/linux/x86/rdc/target.mk
index c9589452b0..e38f5e2006 100644
--- a/target/linux/x86/rdc/target.mk
+++ b/target/linux/x86/rdc/target.mk
@@ -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 \