File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ OPTIMIZATION?=-O3
2424ifeq ($(OPTIMIZATION ) ,-O3)
2525 ifeq (clang,$(CLANG))
2626 OPTIMIZATION+=-flto
27- # Use llvm-ar for LTO bitcode compatibility when archiving with clang.
28- AR=llvm-ar
2927 else
3028 OPTIMIZATION+=-flto=auto -ffat-lto-objects
3129 endif
@@ -143,6 +141,12 @@ FINAL_LDFLAGS=$(LDFLAGS) $(OPT) $(SERVER_LDFLAGS) $(DEBUG)
143141FINAL_LIBS =-lm
144142DEBUG =-g -ggdb
145143
144+ # Use lld when linking with clang to avoid LLVM version mismatches
145+ # between clang and the system's gold plugin during LTO.
146+ ifeq (clang,$(CLANG ) )
147+ FINAL_LDFLAGS+=-fuse-ld=lld
148+ endif
149+
146150# Linux ARM32 needs -latomic at linking time
147151ifneq (,$(findstring armv,$(uname_M ) ) )
148152 FINAL_LIBS+ =-latomic
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ QUIET_LINK_MOD = @printf ' %b %b\n' $(LINKCOLOR_MOD)LINK$(RESET) $(BINCOLOR_M
3232endif
3333ifeq (clang,$(CLANG ) )
3434 SHOBJ_LDFLAGS+= -fuse-ld=lld
35+ # Use llvm-ar for LTO bitcode compatibility when archiving with clang.
36+ AR=llvm-ar
3537endif
3638
3739endif
You can’t perform that action at this time.
0 commit comments