@@ -2,39 +2,10 @@ OSX_MIN_VERSION=11.0
22OSX_SDK_VERSION =14.0
33XCODE_VERSION =15.0
44XCODE_BUILD_ID =15A240d
5- LD64_VERSION =711
5+ LLD_VERSION =711
66
77OSX_SDK =$(SDK_PATH ) /Xcode-$(XCODE_VERSION ) -$(XCODE_BUILD_ID ) -extracted-SDK-with-libcxx-headers
88
9- ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG ) ) ,)
10- # FORCE_USE_SYSTEM_CLANG is empty, so we use our depends-managed, pinned LLVM
11- # from llvm.org
12-
13- darwin_native_toolchain =native_llvm
14-
15- clang_prog =$(build_prefix ) /bin/clang
16- clangxx_prog =$(clang_prog ) ++
17- llvm_config_prog =$(build_prefix ) /bin/llvm-config
18-
19- llvm_TOOLS =AR NM OBJDUMP RANLIB STRIP
20-
21- # Make-only lowercase function
22- lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
23-
24- # For well-known tools provided by LLVM, make sure that their well-known
25- # variable is set to the full path of the tool, just like how AC_PATH_{TOO,PROG}
26- # would.
27- $(foreach TOOL,$(llvm_TOOLS),$(eval darwin_$(TOOL) = $$(build_prefix)/bin/llvm-$(call lc,$(TOOL))))
28-
29- # Clang expects dsymutil to be called dsymutil
30- darwin_DSYMUTIL =$(build_prefix ) /bin/dsymutil
31-
32- else
33- # FORCE_USE_SYSTEM_CLANG is non-empty, so we use the clang from the user's
34- # system
35-
36- darwin_native_toolchain =
37-
389# We can't just use $(shell command -v clang) because GNU Make handles builtins
3910# in a special way and doesn't know that `command` is a POSIX-standard builtin
4011# prior to 1af314465e5dfe3e8baa839a32a72e83c04f26ef, first released in v4.2.90.
@@ -44,17 +15,13 @@ darwin_native_toolchain=
4415# Source: https://lists.gnu.org/archive/html/bug-make/2017-11/msg00017.html
4516clang_prog =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v clang")
4617clangxx_prog =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v clang++")
47- llvm_config_prog =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v llvm-config")
48-
49- llvm_lib_dir =$(shell $(llvm_config_prog ) --libdir)
5018
5119darwin_AR =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v llvm-ar")
5220darwin_DSYMUTIL =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v dsymutil")
5321darwin_NM =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v llvm-nm")
5422darwin_OBJDUMP =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v llvm-objdump")
5523darwin_RANLIB =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v llvm-ranlib")
5624darwin_STRIP =$(shell $(SHELL ) $(.SHELLFLAGS ) "command -v llvm-strip")
57- endif
5825
5926# Flag explanations:
6027#
6330# Ensures that modern linker features are enabled. See here for more
6431# details: https://github.com/bitcoin/bitcoin/pull/19407.
6532#
66- # -B$(build_prefix)/bin
67- #
68- # Explicitly point to our binaries so that they are
69- # ensured to be found and preferred over other possibilities.
70- #
7133# -isysroot$(OSX_SDK) -nostdlibinc
7234#
7335# Disable default include paths built into the compiler as well as
@@ -92,15 +54,13 @@ darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
9254 -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
9355 -u LIBRARY_PATH \
9456 $(clang_prog ) --target=$(host ) \
95- -B$(build_prefix ) /bin \
9657 -isysroot$(OSX_SDK ) -nostdlibinc \
9758 -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
9859
9960darwin_CXX =env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
10061 -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
10162 -u LIBRARY_PATH \
10263 $(clangxx_prog ) --target=$(host ) \
103- -B$(build_prefix ) /bin \
10464 -isysroot$(OSX_SDK ) -nostdlibinc \
10565 -iwithsysroot/usr/include/c++/v1 \
10666 -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
@@ -110,8 +70,8 @@ darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD) -mmacosx-version-min=$(OSX_MIN_VERSIO
11070darwin_LDFLAGS =-Wl,-platform_version,macos,$(OSX_MIN_VERSION ) ,$(OSX_SDK_VERSION )
11171
11272ifneq ($(build_os ) ,darwin)
113- darwin_CFLAGS += -mlinker-version=$(LD64_VERSION )
114- darwin_CXXFLAGS += -mlinker-version=$(LD64_VERSION )
73+ darwin_CFLAGS += -mlinker-version=$(LLD_VERSION )
74+ darwin_CXXFLAGS += -mlinker-version=$(LLD_VERSION )
11575darwin_LDFLAGS += -Wl,-no_adhoc_codesign -fuse-ld=lld
11676endif
11777
0 commit comments