software: enable link time optimization (LTO)

Co-authored-by: Pawel Czarnecki <pczarnecki@internships.antmicro.com>
This commit is contained in:
Tim 'mithro' Ansell 2018-11-27 00:48:44 -08:00 committed by Pawel Czarnecki
parent 9521f2ff80
commit 718a65c3c9
2 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
%.elf: ../libbase/crt0-$(CPU)-ctr.o ../libnet/libnet.a ../libbase/libbase-nofloat.a ../libcompiler_rt/libcompiler_rt.a %.elf: ../libbase/crt0-$(CPU)-ctr.o ../libnet/libnet.a ../libbase/libbase-nofloat.a ../libcompiler_rt/libcompiler_rt.a
$(LD) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ $(CC) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \
../libbase/crt0-$(CPU)-ctr.o \ ../libbase/crt0-$(CPU)-ctr.o \
$(OBJECTS) \ $(OBJECTS) \
-L../libnet \ -L../libnet \

View File

@ -14,7 +14,7 @@ else
CC_normal := $(TARGET_PREFIX)gcc -std=gnu99 CC_normal := $(TARGET_PREFIX)gcc -std=gnu99
CX_normal := $(TARGET_PREFIX)g++ CX_normal := $(TARGET_PREFIX)g++
endif endif
AR_normal := $(TARGET_PREFIX)ar AR_normal := $(TARGET_PREFIX)gcc-ar
LD_normal := $(TARGET_PREFIX)ld LD_normal := $(TARGET_PREFIX)ld
OBJCOPY_normal := $(TARGET_PREFIX)objcopy OBJCOPY_normal := $(TARGET_PREFIX)objcopy
@ -46,10 +46,10 @@ DEPFLAGS += -MD -MP
# Toolchain options # Toolchain options
# #
INCLUDES = -I$(SOC_DIRECTORY)/software/include/base -I$(SOC_DIRECTORY)/software/include -I$(SOC_DIRECTORY)/common -I$(BUILDINC_DIRECTORY) INCLUDES = -I$(SOC_DIRECTORY)/software/include/base -I$(SOC_DIRECTORY)/software/include -I$(SOC_DIRECTORY)/common -I$(BUILDINC_DIRECTORY)
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES) COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES) -flto -fuse-linker-plugin -ffunction-sections -fdata-sections -nostartfiles -nostdlib -nodefaultlibs
CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding
LDFLAGS = -nostdlib -nodefaultlibs -L$(BUILDINC_DIRECTORY) LDFLAGS = -nostdlib -nodefaultlibs -Os $(CPUFLAGS) -L$(BUILDINC_DIRECTORY)
define compilexx define compilexx
$(CX) -c $(CXXFLAGS) $(1) $< -o $@ $(CX) -c $(CXXFLAGS) $(1) $< -o $@