Skip to content
Snippets Groups Projects
Commit 73c4d73d authored by Felix Fietkau's avatar Felix Fietkau
Browse files

build: unify target independent optimization options


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

SVN-Revision: 37600
parent 80dd5522
No related branches found
No related tags found
No related merge requests found
Showing
with 38 additions and 31 deletions
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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"
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment