From 979f98ea3120dbba208c2b0b044ce37294653814 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 11 Mar 2020 12:56:40 +0100 Subject: [PATCH] software: revert LTO changes (Disable it). It seems LTO is not yet fully working with all configurations, so it's better reverting the changes for now. - cause issues with LM32 available compilers. - seems to cause issues with min/lite variant of VexRiscv. - seems to cause issues with some litex-buildenv configurations. (see https://github.com/enjoy-digital/litex/issues/417). --- litex/soc/software/bios/Makefile | 2 +- litex/soc/software/common.mak | 24 +++++------------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/litex/soc/software/bios/Makefile b/litex/soc/software/bios/Makefile index 6966ff97..66be372c 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 - $(CC) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \ + $(LD) $(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 9fd0e307..18fc50c3 100644 --- a/litex/soc/software/common.mak +++ b/litex/soc/software/common.mak @@ -7,24 +7,14 @@ endif RM ?= rm -f PYTHON ?= python3 -ifeq ($(CPU), lm32) -LTO = 0 -else -LTO = 1 -endif - -ifeq ($(CLANG), 1) +ifeq ($(CLANG),1) CC_normal := clang -target $(TRIPLE) -integrated-as CX_normal := clang++ -target $(TRIPLE) -integrated-as else CC_normal := $(TARGET_PREFIX)gcc -std=gnu99 CX_normal := $(TARGET_PREFIX)g++ endif -ifeq ($(LTO), 1) -AR_normal := $(TARGET_PREFIX)gcc-ar -else AR_normal := $(TARGET_PREFIX)ar -endif LD_normal := $(TARGET_PREFIX)ld OBJCOPY_normal := $(TARGET_PREFIX)objcopy @@ -34,7 +24,7 @@ AR_quiet = @echo " AR " $@ && $(AR_normal) LD_quiet = @echo " LD " $@ && $(LD_normal) OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(OBJCOPY_normal) -ifeq ($(V), 1) +ifeq ($(V),1) CC = $(CC_normal) CX = $(CX_normal) AR = $(AR_normal) @@ -55,15 +45,11 @@ DEPFLAGS += -MD -MP # 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 += -ffunction-sections -fdata-sections -nostartfiles -nostdlib -nodefaultlibs -ifeq ($(LTO), 1) -COMMONFLAGS += -flto -fuse-linker-plugin -endif -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 -LDFLAGS = -nostdlib -nodefaultlibs -Os $(CPUFLAGS) -L$(BUILDINC_DIRECTORY) +LDFLAGS = -nostdlib -nodefaultlibs -L$(BUILDINC_DIRECTORY) define compilexx $(CX) -c $(CXXFLAGS) $(1) $< -o $@ -- 2.30.2