From 21abc8879cddd0002ca1da2eaa0f8e27ef09fa99 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 29 May 2020 11:14:27 -0700 Subject: [PATCH] Make libunwind build hermetic We want to avoid exporting any symbols from Rust's version of libunwind, and to do so we need to disable visibility annotations to make sure that the -fvisibility=hidden has effect, and also hide global new/delete. This matches the CMake build of libunwind. --- src/libunwind/build.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index 1462639259cb8..00749d93d55b0 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -90,6 +90,8 @@ mod llvm_libunwind { cfg.flag("-fstrict-aliasing"); cfg.flag("-funwind-tables"); cfg.flag("-fvisibility=hidden"); + cfg.flag_if_supported("-fvisibility-global-new-delete-hidden"); + cfg.define("_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS", None); } let mut unwind_sources = vec![