to match the type signature of the llvm.used variable
// 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());
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)