Skip to content

Commit

Permalink
give rust_metadata internal linkage but mark it as used. This allows
Browse files Browse the repository at this point in the history
multiple static crates to be used.
  • Loading branch information
cixtor committed Jul 20, 2011
1 parent a467e8e commit b7a7120
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/comp/middle/trans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b7a7120

Please sign in to comment.