X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=genbindings.sh;h=8fd11889910401d21b01cbd6d81393a36ef34495;hp=7a876312ae2cc818533225ca81326e8f48adc526;hb=6f808498a34b80af2646097f138c54132c48d6f9;hpb=ef46cb1ace8cbea503488436e0c3aa2df349e382 diff --git a/genbindings.sh b/genbindings.sh index 7a87631..8fd1188 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -271,7 +271,11 @@ if [ "$HOST_PLATFORM" != "host: x86_64-apple-darwin" -a "$CLANGPP" != "" ]; then # or Ubuntu packages). This should work fine on Distros which do more involved # packaging than simply shipping the rustup binaries (eg Debian should Just Work # here). - export CFLAGS="$CFLAGS -flto" + # The cc-rs crate tries to force -fdata-sections and -ffunction-sections on, which + # breaks -fembed-bitcode, so we turn off cc-rs' default flags and specify exactly + # what we want here. + export CFLAGS="$CFLAGS -O3 -fPIC -fembed-bitcode" + export CRATE_CC_NO_DEFAULTS=true # Rust doesn't recognize CFLAGS changes, so we need to clean build artifacts cargo clean --release CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release -- -C linker-plugin-lto -C lto -C link-arg=-fuse-ld=lld