diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs index 63258b74533..378e1d7fc63 100644 --- a/src/librustc_trans/base.rs +++ b/src/librustc_trans/base.rs @@ -1189,8 +1189,6 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Create llvm.used variable if !ccx.used_statics().borrow().is_empty() { - debug!("llvm.used"); - let name = CString::new("llvm.used").unwrap(); let section = CString::new("llvm.metadata").unwrap(); let array = C_array(Type::i8(&ccx).ptr_to(), &*ccx.used_statics().borrow()); diff --git a/src/librustc_trans/consts.rs b/src/librustc_trans/consts.rs index 9974155f7c0..ae8c2433fed 100644 --- a/src/librustc_trans/consts.rs +++ b/src/librustc_trans/consts.rs @@ -277,7 +277,8 @@ pub fn trans_static<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, base::set_link_section(ccx, g, attrs); if attr::contains_name(attrs, "used") { - ccx.used_statics().borrow_mut().push(g); + let cast = llvm::LLVMConstPointerCast(g, Type::i8p(ccx).to_ref()); + ccx.used_statics().borrow_mut().push(cast); } Ok(g)