From 718a65c3c9353a9b920dd568a63b60e7d9a6a950 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 27 Nov 2018 00:48:44 -0800 Subject: [PATCH] software: enable link time optimization (LTO) Co-authored-by: Pawel Czarnecki --- litex/soc/software/bios/Makefile | 2 +- litex/soc/software/common.mak | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/litex/soc/software/bios/Makefile b/litex/soc/software/bios/Makefile index 66be372c..6966ff97 100755 --- a/litex/soc/software/bios/Makefile +++ b/litex/soc/software/bios/Makefile @@ -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 - $(LD) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ + $(CC) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ ../libbase/crt0-$(CPU)-ctr.o \ $(OBJECTS) \ -L../libnet \ diff --git a/litex/soc/software/common.mak b/litex/soc/software/common.mak index 18fc50c3..259ff473 100644 --- a/litex/soc/software/common.mak +++ b/litex/soc/software/common.mak @@ -14,7 +14,7 @@ else CC_normal := $(TARGET_PREFIX)gcc -std=gnu99 CX_normal := $(TARGET_PREFIX)g++ endif -AR_normal := $(TARGET_PREFIX)ar +AR_normal := $(TARGET_PREFIX)gcc-ar LD_normal := $(TARGET_PREFIX)ld OBJCOPY_normal := $(TARGET_PREFIX)objcopy @@ -46,10 +46,10 @@ DEPFLAGS += -MD -MP # Toolchain options # 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 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 $(CX) -c $(CXXFLAGS) $(1) $< -o $@ -- 2.30.2