mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-25 22:22:44 +00:00
give rust_metadata internal linkage but mark it as used. This allows
multiple static crates to be used.
This commit is contained in:
parent
a467e8e4e6
commit
b7a7120804
@ -8564,6 +8564,17 @@ fn write_metadata(&@trans::crate_ctxt cx, &@ast::crate crate) {
|
||||
str::buf("rust_metadata"));
|
||||
llvm::LLVMSetInitializer(llglobal, llconst);
|
||||
llvm::LLVMSetSection(llglobal, str::buf(x86::get_meta_sect_name()));
|
||||
llvm::LLVMSetLinkage(llglobal,
|
||||
lib::llvm::LLVMInternalLinkage as llvm::Linkage);
|
||||
|
||||
auto t_ptr_i8 = T_ptr(T_i8());
|
||||
llglobal = llvm::LLVMConstBitCast(llglobal, t_ptr_i8);
|
||||
auto llvm_used =
|
||||
llvm::LLVMAddGlobal(cx.llmod, T_array(t_ptr_i8, 1u),
|
||||
str::buf("llvm_used"));
|
||||
llvm::LLVMSetLinkage(llvm_used,
|
||||
lib::llvm::LLVMAppendingLinkage as llvm::Linkage);
|
||||
llvm::LLVMSetInitializer(llvm_used, C_array(t_ptr_i8, ~[llglobal]));
|
||||
}
|
||||
|
||||
fn trans_crate(&session::session sess, &@ast::crate crate, &ty::ctxt tcx,
|
||||
|
Loading…
Reference in New Issue
Block a user