mirror of https://github.com/YosysHQ/yosys.git
Makefile: LTO for all, lld for clang
This commit is contained in:
parent
ad22430b96
commit
725746baa6
19
Makefile
19
Makefile
|
@ -34,6 +34,7 @@ ENABLE_PYOSYS := 0
|
||||||
ENABLE_GCOV := 0
|
ENABLE_GCOV := 0
|
||||||
ENABLE_GPROF := 0
|
ENABLE_GPROF := 0
|
||||||
ENABLE_DEBUG := 0
|
ENABLE_DEBUG := 0
|
||||||
|
ENABLE_LTO := 1
|
||||||
ENABLE_CCACHE := 0
|
ENABLE_CCACHE := 0
|
||||||
# sccache is not always a drop-in replacement for ccache in practice
|
# sccache is not always a drop-in replacement for ccache in practice
|
||||||
ENABLE_SCCACHE := 0
|
ENABLE_SCCACHE := 0
|
||||||
|
@ -52,8 +53,11 @@ SANITIZER =
|
||||||
# SANITIZER = undefined
|
# SANITIZER = undefined
|
||||||
# SANITIZER = cfi
|
# SANITIZER = cfi
|
||||||
|
|
||||||
# Prefer using ENABLE_DEBUG over setting this
|
# Prefer using ENABLE_DEBUG over setting these
|
||||||
OPT_LEVEL := -O3
|
OPT_LEVEL := -O3
|
||||||
|
GCC_LTO := -flto=auto
|
||||||
|
CLANG_LTO := -flto=thin
|
||||||
|
|
||||||
PROGRAM_PREFIX :=
|
PROGRAM_PREFIX :=
|
||||||
|
|
||||||
OS := $(shell uname -s)
|
OS := $(shell uname -s)
|
||||||
|
@ -208,10 +212,15 @@ ifeq ($(OS), OpenBSD)
|
||||||
ABC_ARCHFLAGS += "-DABC_NO_RLIMIT"
|
ABC_ARCHFLAGS += "-DABC_NO_RLIMIT"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# This gets overridden later.
|
||||||
|
LTOFLAGS := $(GCC_LTO)
|
||||||
|
|
||||||
ifeq ($(CONFIG),clang)
|
ifeq ($(CONFIG),clang)
|
||||||
CXX = clang++
|
CXX = clang++
|
||||||
CXXFLAGS += -std=$(CXXSTD) $(OPT_LEVEL)
|
CXXFLAGS += -std=$(CXXSTD) $(OPT_LEVEL)
|
||||||
|
LINKFLAGS += -fuse-ld=lld
|
||||||
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H $(ABC_ARCHFLAGS)"
|
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H $(ABC_ARCHFLAGS)"
|
||||||
|
LTOFLAGS := $(CLANG_LTO)
|
||||||
|
|
||||||
ifneq ($(SANITIZER),)
|
ifneq ($(SANITIZER),)
|
||||||
$(info [Clang Sanitizer] $(SANITIZER))
|
$(info [Clang Sanitizer] $(SANITIZER))
|
||||||
|
@ -227,6 +236,7 @@ endif
|
||||||
ifneq ($(findstring cfi,$(SANITIZER)),)
|
ifneq ($(findstring cfi,$(SANITIZER)),)
|
||||||
CXXFLAGS += -flto
|
CXXFLAGS += -flto
|
||||||
LINKFLAGS += -flto
|
LINKFLAGS += -flto
|
||||||
|
LTOFLAGS =
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -318,11 +328,18 @@ EXE = .exe
|
||||||
else ifeq ($(CONFIG),none)
|
else ifeq ($(CONFIG),none)
|
||||||
CXXFLAGS += -std=$(CXXSTD) $(OPT_LEVEL)
|
CXXFLAGS += -std=$(CXXSTD) $(OPT_LEVEL)
|
||||||
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H $(ABC_ARCHFLAGS)"
|
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H $(ABC_ARCHFLAGS)"
|
||||||
|
LTOFLAGS =
|
||||||
|
|
||||||
else
|
else
|
||||||
$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, mxe, msys2-32, msys2-64, none)
|
$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, mxe, msys2-32, msys2-64, none)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO),1)
|
||||||
|
CXXFLAGS += $(LTOFLAGS)
|
||||||
|
LINKFLAGS += $(LTOFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(ENABLE_LIBYOSYS),1)
|
ifeq ($(ENABLE_LIBYOSYS),1)
|
||||||
TARGETS += libyosys.so
|
TARGETS += libyosys.so
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
packages.default = yosys;
|
packages.default = yosys;
|
||||||
defaultPackage = yosys;
|
defaultPackage = yosys;
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git gtest abc-verifier ];
|
buildInputs = with pkgs; [ clang llvmPackages.bintools bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git gtest abc-verifier ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue