diff --git a/src/Makevars.in b/src/Makevars.in index 548bbc3..0d02d74 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -20,8 +20,13 @@ $(STATLIB): cp ./cargo_vendor_config.toml ./rust/.cargo/config.toml; \ fi +# Note: -fno-lto is appended to CFLAGS to override any -flto* injected by R +# (e.g. the gcc-SAN builder uses -flto=10). The cc crate compiles savvy's +# unwind_protect_wrapper.c with these CFLAGS and archives the result with +# plain `ar`, which doesn't record GCC LTO symbols, leaving +# unwind_protect_impl undefined at dyn.load time. export CC="$(CC)" && \ - export CFLAGS="$(CFLAGS)" && \ + export CFLAGS="$(CFLAGS) -fno-lto" && \ if [ "$(TARGET)" != "wasm32-unknown-emscripten" ]; then \ @BEFORE_CARGO_BUILD@ cd ./rust && cargo build --jobs 1 --lib --release $(OFFLINE_OPTION); \ else \