fn synthesize_crateid_attr(ecx: &EncodeContext) -> Attribute {
assert!(!ecx.link_meta.crateid.name.is_empty());
- attr::mk_attr(
+ attr::mk_attr_inner(
attr::mk_name_value_item_str(
InternedString::new("crate_id"),
token::intern_and_get_ident(ecx.link_meta.crateid.to_str())))
}
}
+ for i in ecx.tcx.lang_items.missing.iter() {
+ ebml_w.wr_tagged_u32(tag_lang_items_missing, *i as u32);
+ }
+
ebml_w.end_tag(); // tag_lang_items
}
use metadata::{csearch, encoder};
use middle::astencode;
use middle::lang_items::{LangItem, ExchangeMallocFnLangItem, StartFnLangItem};
+use middle::weak_lang_items;
use middle::trans::_match;
use middle::trans::adt;
use middle::trans::build::*;
let f = decl_rust_fn(ccx, false, inputs, output, name);
csearch::get_item_attrs(&ccx.sess().cstore, did, |meta_items| {
- set_llvm_fn_attrs(meta_items.iter().map(|&x| attr::mk_attr(x))
+ set_llvm_fn_attrs(meta_items.iter().map(|&x| attr::mk_attr_outer(x))
.collect::<Vec<_>>().as_slice(), f)
});
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
}
+ // The stack exhaustion lang item shouldn't have a split stack because
+ // otherwise it would continue to be exhausted (bad), and both it and the
+ // eh_personality functions need to be externally linkable.
+ let def = ast_util::local_def(node_id);
+ if ccx.tcx.lang_items.stack_exhausted() == Some(def) {
+ unset_split_stack(llfn);
+ lib::llvm::SetLinkage(llfn, lib::llvm::ExternalLinkage);
+ }
+ if ccx.tcx.lang_items.eh_personality() == Some(def) {
+ lib::llvm::SetLinkage(llfn, lib::llvm::ExternalLinkage);
+ }
+
+
if is_entry_fn(ccx.sess(), node_id) {
create_entry_wrapper(ccx, sp, llfn);
}
// Don't mangle
path.last().unwrap().to_str().to_strbuf()
} else {
- // Usual name mangling
- mangle_exported_name(ccx, path, ty, id)
+ match weak_lang_items::link_name(attrs) {
+ Some(name) => name.get().to_strbuf(),
+ None => {
+ // Usual name mangling
+ mangle_exported_name(ccx, path, ty, id)
+ }
+ }
}
})
}