From 45c3970db8dcd40b9b8ceddcd48d06db4e2447ea Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 9 Sep 2013 13:45:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6286 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/ports/ARMCMx/compilers/GCC/rules.mk | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'os/common') diff --git a/os/common/ports/ARMCMx/compilers/GCC/rules.mk b/os/common/ports/ARMCMx/compilers/GCC/rules.mk index 249793fcd..f60fc985d 100644 --- a/os/common/ports/ARMCMx/compilers/GCC/rules.mk +++ b/os/common/ports/ARMCMx/compilers/GCC/rules.mk @@ -4,6 +4,21 @@ # Processing options coming from the upper Makefile. # +# Compiler options +OPT = $(USE_OPT) +COPT = $(USE_COPT) +CPPOPT = $(USE_CPPOPT) + +# Garbage collection +ifeq ($(USE_LINK_GC),yes) + OPT += -ffunction-sections -fdata-sections -fno-common +endif + +# Link time optimizations +ifeq ($(USE_LTO),yes) + OPT += -flto +endif + # FPU-related options ifeq ($(USE_FPU),yes) USE_OPT += -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant @@ -45,14 +60,6 @@ endif OUTFILES = $(BUILDDIR)/$(PROJECT).elf $(BUILDDIR)/$(PROJECT).hex \ $(BUILDDIR)/$(PROJECT).bin $(BUILDDIR)/$(PROJECT).dmp -# Automatic compiler options -OPT = $(USE_OPT) -COPT = $(USE_COPT) -CPPOPT = $(USE_CPPOPT) -ifeq ($(USE_LINK_GC),yes) - OPT += -ffunction-sections -fdata-sections -fno-common -endif - # Source files groups and paths ifeq ($(USE_THUMB),yes) TCSRC += $(CSRC) @@ -96,7 +103,7 @@ ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS) ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS) CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS) CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS) -LDFLAGS = $(MCFLAGS) -nostartfiles $(LLIBDIR) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--library-path=$(RULESPATH),--script=$(LDSCRIPT),$(LDOPT) +LDFLAGS = $(MCFLAGS) $(OPT) -nostartfiles $(LLIBDIR) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--library-path=$(RULESPATH),--script=$(LDSCRIPT),$(LDOPT) # Thumb interwork enabled only if needed because it kills performance. ifneq ($(TSRC),) -- cgit v1.2.3