Skip to content

Commit 9910e3c

Browse files
committed
Auto merge of #4953 - str4d:linker-plugin-lto, r=<try>
build: Enable cross-language ThinLTO Causes warnings at link time due to C++ and Rust using different target strings. These warnings do not break CI, because while we require `-Werror` to build on Linux, that only affects compilation, not linking. See rust-lang/rust#33147 for more details.
2 parents c969864 + e3c0417 commit 9910e3c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

depends/hosts/darwin.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-
2727
# https://reviews.llvm.org/D64089, we should use that instead. Read the
2828
# differential summary there for more details.
2929
#
30-
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin
31-
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
30+
darwin_CC=clang -target $(host) -flto=thin -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin
31+
darwin_CXX=clang++ -target $(host) -flto=thin -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
3232

3333
darwin_CFLAGS=-pipe
3434
darwin_CXXFLAGS=$(darwin_CFLAGS)

depends/hosts/default.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# Explicitly point to our binaries (e.g. cctools) so that they are
66
# ensured to be found and preferred over other possibilities.
77
#
8-
default_host_CC = clang -target $(host) -B$(build_prefix)/bin
9-
default_host_CXX = clang++ -target $(host) -B$(build_prefix)/bin -stdlib=libc++
8+
default_host_CC = clang -target $(host) -flto=thin -B$(build_prefix)/bin
9+
default_host_CXX = clang++ -target $(host) -flto=thin -B$(build_prefix)/bin -stdlib=libc++
1010
default_host_AR = llvm-ar
1111
default_host_RANLIB = llvm-ranlib
1212
default_host_STRIP = llvm-strip

src/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if ENABLE_WALLET
3939
LIBBITCOIN_WALLET=libbitcoin_wallet.a
4040
endif
4141

42-
RUST_ENV_VARS = RUSTC="$(RUSTC)" TERM=dumb
42+
RUST_ENV_VARS = RUSTC="$(RUSTC)" TERM=dumb RUSTFLAGS="-Clinker-plugin-lto"
4343
RUST_BUILD_OPTS = --lib --release --target $(RUST_TARGET)
4444

4545
rust_verbose = $(rust_verbose_@AM_V@)

0 commit comments

Comments
 (0)