From 11892171146ec684ddc5761e68c5efeca3d29f47 Mon Sep 17 00:00:00 2001 From: Viviane Potocnik Date: Tue, 18 Jul 2023 09:24:40 +0200 Subject: [PATCH] toolchain: remove LTO due to over optimization --- target/snitch_cluster/sw/toolchain.mk | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/target/snitch_cluster/sw/toolchain.mk b/target/snitch_cluster/sw/toolchain.mk index 88280d0d4..8f36e417b 100644 --- a/target/snitch_cluster/sw/toolchain.mk +++ b/target/snitch_cluster/sw/toolchain.mk @@ -22,14 +22,11 @@ SW_INSTALL_DIR ?= $(abspath $(MUSL_DIR)/../../../sw/deps/install/) # Compiler toolchain LLVM_BINROOT ?= $(dir $(shell which riscv32-unknown-elf-clang)) RISCV_CC ?= $(LLVM_BINROOT)/clang -RISCV_CXX ?= $(LLVM_BINROOT)/clang++ RISCV_LD ?= $(LLVM_BINROOT)/ld.lld RISCV_AR ?= $(LLVM_BINROOT)/llvm-ar RISCV_OBJCOPY ?= $(LLVM_BINROOT)/llvm-objcopy RISCV_OBJDUMP ?= $(LLVM_BINROOT)/llvm-objdump RISCV_DWARFDUMP ?= $(LLVM_BINROOT)/llvm-dwarfdump -RISCV_RANLIB ?= $(LLVM_BINROOT)/llvm-ranlib -RISCV_STRIP ?= $(LLVM_BINROOT)/llvm-strip # Compiler flags RISCV_CFLAGS += $(addprefix -I,$(INCDIRS)) @@ -47,12 +44,9 @@ RISCV_CFLAGS += -fno-builtin-printf RISCV_CFLAGS += -fno-common RISCV_CFLAGS += -fopenmp -RISCV_CFLAGS += -flto=thin -RISCV_CFLAGS += -ffunction-sections -RISCV_CFLAGS += -Wextra -RISCV_CFLAGS += -static -RISCV_CFLAGS += -mllvm -enable-misched=false -RISCV_CFLAGS += -mno-relax +# TODO: check why the LTO flags optimizes the CBSS section away +# RISCV_CFLAGS += -flto=thin + RISCV_CFLAGS += -ftls-model=local-exec RISCV_CFLAGS += -nostdinc @@ -65,16 +59,10 @@ endif RISCV_LDFLAGS += -fuse-ld=$(RISCV_LD) RISCV_LDFLAGS += -nostartfiles RISCV_LDFLAGS += -lm -RISCV_LDFLAGS += -static -RISCV_LDFLAGS += -mcpu=snitch -nostartfiles -fuse-ld=lld -Wl,--image-base=0x80000000 -RISCV_LDFLAGS += -Wl,-z,norelro -RISCV_LDFLAGS += -Wl,--gc-sections -RISCV_LDFLAGS += -Wl,--no-relax -RISCV_LDFLAGS += -Wl,--verbose # musl specific flags RISCV_LDFLAGS += -L$(SW_INSTALL_DIR)/lib RISCV_LDFLAGS += -nostdinc -RISCV_LDFLAGS += -flto=thin +# RISCV_LDFLAGS += -flto=thin # Archiver flags RISCV_ARFLAGS = rcs