about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2020-05-29 11:14:27 -0700
committerPetr Hosek <phosek@google.com>2020-05-29 11:34:41 -0700
commit21abc8879cddd0002ca1da2eaa0f8e27ef09fa99 (patch)
treec81496a205c8295470c11df3676345c4915c2ed1 /src
parent96dd4690c3aa70ec312448c3f2d50e6dc6fb87df (diff)
downloadrust-21abc8879cddd0002ca1da2eaa0f8e27ef09fa99.tar.gz
rust-21abc8879cddd0002ca1da2eaa0f8e27ef09fa99.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/libunwind/build.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs
index 1462639259c..00749d93d55 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![