File tree 2 files changed +12
-2
lines changed
librustc_codegen_ssa/back
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use std::sync::Arc;
3
3
4
4
use rustc:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
5
5
use rustc:: middle:: exported_symbols:: { metadata_symbol_name, ExportedSymbol , SymbolExportLevel } ;
6
- use rustc:: session:: config;
6
+ use rustc:: session:: config:: { self , Sanitizer } ;
7
7
use rustc:: ty:: query:: Providers ;
8
8
use rustc:: ty:: subst:: SubstsRef ;
9
9
use rustc:: ty:: Instance ;
@@ -206,6 +206,12 @@ fn exported_symbols_provider_local(
206
206
} ) ) ;
207
207
}
208
208
209
+ if let Some ( Sanitizer :: Memory ) = tcx. sess . opts . debugging_opts . sanitizer {
210
+ // Similar to profiling, preserve weak msan symbol during LTO.
211
+ let exported_symbol = ExportedSymbol :: NoDefId ( SymbolName :: new ( "__msan_track_origins" ) ) ;
212
+ symbols. push ( ( exported_symbol, SymbolExportLevel :: C ) ) ;
213
+ }
214
+
209
215
if tcx. sess . crate_types . borrow ( ) . contains ( & config:: CrateType :: Dylib ) {
210
216
let symbol_name = metadata_symbol_name ( tcx) ;
211
217
let exported_symbol = ExportedSymbol :: NoDefId ( SymbolName :: new ( & symbol_name) ) ;
Original file line number Diff line number Diff line change 4
4
// needs-sanitizer-support
5
5
// only-linux
6
6
// only-x86_64
7
- // revisions:MSAN-0 MSAN-1 MSAN-2
7
+ // revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO
8
8
//
9
9
//[MSAN-0] compile-flags: -Zsanitizer=memory
10
10
//[MSAN-1] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins=1
11
11
//[MSAN-2] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins
12
+ //[MSAN-1-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins=1 -C lto=fat
13
+ //[MSAN-2-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins -C lto=fat
12
14
13
15
#![ crate_type="lib" ]
14
16
15
17
// MSAN-0-NOT: @__msan_track_origins
16
18
// MSAN-1: @__msan_track_origins = weak_odr local_unnamed_addr constant i32 1
17
19
// MSAN-2: @__msan_track_origins = weak_odr local_unnamed_addr constant i32 2
20
+ // MSAN-1-LTO: @__msan_track_origins = weak_odr local_unnamed_addr constant i32 1
21
+ // MSAN-2-LTO: @__msan_track_origins = weak_odr local_unnamed_addr constant i32 2
18
22
//
19
23
// MSAN-0-LABEL: define void @copy(
20
24
// MSAN-1-LABEL: define void @copy(
You can’t perform that action at this time.
0 commit comments