feat(build): use lld for clang if available

Also simplify the CI.

closes https://github.com/official-stockfish/Stockfish/pull/6592

No functional change
This commit is contained in:
ppigazzini
2026-02-08 15:22:06 +01:00
committed by Disservin
parent 3cde1560f6
commit e3a5c40f05
2 changed files with 24 additions and 12 deletions
-1
View File
@@ -74,7 +74,6 @@ jobs:
run: | run: |
export CXXFLAGS="-Werror" export CXXFLAGS="-Werror"
if [ "${{ matrix.ver }}" -ge 20 ]; then if [ "${{ matrix.ver }}" -ge 20 ]; then
export LDFLAGS="-fuse-ld=lld"
apt install -y lld apt install -y lld
fi fi
make clean make clean
+17 -4
View File
@@ -854,15 +854,28 @@ endif
### This is a mix of compile and link time options because the lto link phase ### This is a mix of compile and link time options because the lto link phase
### needs access to the optimization flags. ### needs access to the optimization flags.
ifeq ($(optimize),yes) ifeq ($(optimize),yes)
ifeq ($(debug), no) ifeq ($(debug),no)
ifneq ($(KERNEL),Darwin)
LLD_BIN := $(shell command -v ld.lld 2>/dev/null)
ifeq ($(LLD_BIN),)
LLD_BIN := $(shell command -v lld 2>/dev/null)
endif
ifneq ($(LLD_BIN),)
ifeq ($(comp),clang)
LDFLAGS += -fuse-ld=lld
else ifeq ($(comp),gcc)
ifneq ($(gccisclang),)
LDFLAGS += -fuse-ld=lld
endif
endif
endif
endif
ifeq ($(comp),$(filter $(comp),clang icx)) ifeq ($(comp),$(filter $(comp),clang icx))
CXXFLAGS += -flto=full CXXFLAGS += -flto=full
ifeq ($(comp),icx) ifeq ($(comp),icx)
CXXFLAGS += -fwhole-program-vtables CXXFLAGS += -fwhole-program-vtables
endif endif
ifeq ($(target_windows),yes)
CXXFLAGS += -fuse-ld=lld
endif
LDFLAGS += $(CXXFLAGS) LDFLAGS += $(CXXFLAGS)
# GCC and CLANG use different methods for parallelizing LTO and CLANG pretends to be # GCC and CLANG use different methods for parallelizing LTO and CLANG pretends to be