about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/monomorphize
diff options
context:
space:
mode:
authorRich Kadel <richkadel@google.com>2020-08-27 12:53:43 -0700
committerRich Kadel <richkadel@google.com>2020-08-31 18:41:13 -0700
commitddb054aee898dd74261fa8f50fe0c6541e5ceaf3 (patch)
treea5d8f94dec6ae400ecebc76c50eae8b992152642 /compiler/rustc_mir/src/monomorphize
parent85fbf49ce0e2274d0acf798f6e703747674feec3 (diff)
Fix `-Z instrument-coverage` on MSVC
Found that -C link-dead-code (which was enabled automatically
under -Z instrument-coverage) was causing the linking error that
resulted in segmentation faults in coverage instrumented binaries. Link
dead code is now disabled under MSVC, allowing `-Z instrument-coverage`
to be enabled under MSVC for the first time.

More details are included in Issue #76038.

(This PR was broken out from PR #75828)
Diffstat (limited to 'compiler/rustc_mir/src/monomorphize')
-rw-r--r--compiler/rustc_mir/src/monomorphize/partitioning/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_mir/src/monomorphize/partitioning/mod.rs b/compiler/rustc_mir/src/monomorphize/partitioning/mod.rs
index 9dfbd65e1b1..b7638204c09 100644
--- a/compiler/rustc_mir/src/monomorphize/partitioning/mod.rs
+++ b/compiler/rustc_mir/src/monomorphize/partitioning/mod.rs
@@ -190,7 +190,7 @@ pub fn partition<'tcx>(
 
     // Next we try to make as many symbols "internal" as possible, so LLVM has
     // more freedom to optimize.
-    if tcx.sess.opts.cg.link_dead_code != Some(true) {
+    if !tcx.sess.link_dead_code() {
         let _prof_timer = tcx.prof.generic_activity("cgu_partitioning_internalize_symbols");
         partitioner.internalize_symbols(tcx, &mut post_inlining, inlining_map);
     }
@@ -327,7 +327,7 @@ fn collect_and_partition_mono_items<'tcx>(
             }
         }
         None => {
-            if tcx.sess.opts.cg.link_dead_code == Some(true) {
+            if tcx.sess.link_dead_code() {
                 MonoItemCollectionMode::Eager
             } else {
                 MonoItemCollectionMode::Lazy