about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2019-08-19 16:24:08 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2019-08-19 16:27:21 +0200
commit0e35e4ea1907e4de9527f6c4cd7bf41ac4c8dae2 (patch)
tree038410cd01da9dd0f8a300b0d14c487a712324e4
parentedbb5730ea966be9d810a3ec46db8245dce51b4e (diff)
downloadrust-0e35e4ea1907e4de9527f6c4cd7bf41ac4c8dae2.tar.gz
rust-0e35e4ea1907e4de9527f6c4cd7bf41ac4c8dae2.zip
Set correct linkage for statics
-rw-r--r--src/constant.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/constant.rs b/src/constant.rs
index f035d8b9e06..960097f2d13 100644
--- a/src/constant.rs
+++ b/src/constant.rs
@@ -268,8 +268,11 @@ fn define_all_allocs(
                     _ => bug!("static const eval returned {:#?}", const_),
                 };
 
-                // FIXME set correct linkage
-                let data_id = data_id_for_static(tcx, module, def_id, Linkage::Export);
+                let data_id = data_id_for_static(tcx, module, def_id, if tcx.is_reachable_non_generic(def_id) {
+                    Linkage::Export
+                } else {
+                    Linkage::Local
+                });
                 (data_id, alloc)
             }
         };