From: Matt Corallo Date: Thu, 12 Jan 2023 23:27:19 +0000 (+0000) Subject: Fix LTO compilation with latest ld.lld on OSX X-Git-Tag: v0.0.113.1~1^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=3c53ad28bb8dfc5495e21ad754fd8680e4eca4f8;p=ldk-c-bindings Fix LTO compilation with latest ld.lld on OSX --- diff --git a/genbindings.sh b/genbindings.sh index f26ea5d..d1b6758 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -559,7 +559,8 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="$RUSTFLAGS -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS -v --release if [ "$2" = "true" ]; then - $CLANGPP $LOCAL_CFLAGS -flto -fuse-ld=$LLD -O2 demo.cpp target/release/libldk.a -ldl + $CLANGPP $LOCAL_CFLAGS -flto -fuse-ld=$LLD -O2 -c demo.cpp -o demo.o + $CLANGPP $LOCAL_CFLAGS -flto -fuse-ld=$LLD -Wl,--lto-O2 -Wl,-O2 -O2 demo.o target/release/libldk.a -ldl strip ./a.out echo "C++ Bin size and runtime with cross-language LTO:" ls -lha a.out