cast the #[used] static to *i8
to match the type signature of the llvm.used variable
This commit is contained in:
parent
c759eea7a6
commit
c1635d7e61
@ -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());
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user