Skip to content

Commit

Permalink
toolchain: remove LTO due to over optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Viviane Potocnik committed Jul 18, 2023
1 parent b66b339 commit 1189217
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions target/snitch_cluster/sw/toolchain.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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

Expand All @@ -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

0 comments on commit 1189217

Please sign in to comment.