about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back/symbol_export.rs
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-01-19 22:08:15 +0100
committerTomasz Miąsko <tomasz.miasko@gmail.com>2020-01-20 23:13:38 +0100
commit2c0845c6ccfdee7fb255756918a22101376efa7e (patch)
treecf48daa1bdb29527dce7fc87b3228e594e604390 /src/librustc_codegen_ssa/back/symbol_export.rs
parent66b0c97070f422cb82baaaafc79ee94cab4396c5 (diff)
downloadrust-2c0845c6ccfdee7fb255756918a22101376efa7e.tar.gz
rust-2c0845c6ccfdee7fb255756918a22101376efa7e.zip
Mark __msan_track_origins as an exported symbol for LTO
Diffstat (limited to 'src/librustc_codegen_ssa/back/symbol_export.rs')
-rw-r--r--src/librustc_codegen_ssa/back/symbol_export.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs
index bd44b4a38fd..c5989748560 100644
--- a/src/librustc_codegen_ssa/back/symbol_export.rs
+++ b/src/librustc_codegen_ssa/back/symbol_export.rs
@@ -3,7 +3,7 @@ use std::sync::Arc;
 
 use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
 use rustc::middle::exported_symbols::{metadata_symbol_name, ExportedSymbol, SymbolExportLevel};
-use rustc::session::config;
+use rustc::session::config::{self, Sanitizer};
 use rustc::ty::query::Providers;
 use rustc::ty::subst::SubstsRef;
 use rustc::ty::Instance;
@@ -206,6 +206,12 @@ fn exported_symbols_provider_local(
         }));
     }
 
+    if let Some(Sanitizer::Memory) = tcx.sess.opts.debugging_opts.sanitizer {
+        // Similar to profiling, preserve weak msan symbol during LTO.
+        let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new("__msan_track_origins"));
+        symbols.push((exported_symbol, SymbolExportLevel::C));
+    }
+
     if tcx.sess.crate_types.borrow().contains(&config::CrateType::Dylib) {
         let symbol_name = metadata_symbol_name(tcx);
         let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(&symbol_name));