Stop propagating link arguments across crates
This is a fairly brittle modle that doesn't scale well across many crates. It's unlikely that all of the downstream crates will have all of the original native dependencies of all the upstream crates. In the case that FFI functions are reachable, then it should be the responsibility of the downstream crate to link against the correct library, or the upstream crate should prevent the functions from being reachable.
This commit is contained in:
parent
c15038db08
commit
2b9c7742b9
@ -16,7 +16,7 @@ use lib::llvm::llvm;
|
||||
use lib::llvm::ModuleRef;
|
||||
use lib;
|
||||
use metadata::common::LinkMeta;
|
||||
use metadata::{encoder, csearch, cstore, filesearch};
|
||||
use metadata::{encoder, cstore, filesearch};
|
||||
use middle::trans::context::CrateContext;
|
||||
use middle::trans::common::gensym_name;
|
||||
use middle::ty;
|
||||
@ -1043,14 +1043,6 @@ pub fn link_args(sess: Session,
|
||||
let ula = cstore::get_used_link_args(cstore);
|
||||
for arg in ula.iter() { args.push(arg.to_owned()); }
|
||||
|
||||
// Add all the link args for external crates.
|
||||
do cstore::iter_crate_data(cstore) |crate_num, _| {
|
||||
let link_args = csearch::get_link_args_for_crate(cstore, crate_num);
|
||||
for link_arg in link_args.move_iter() {
|
||||
args.push(link_arg);
|
||||
}
|
||||
}
|
||||
|
||||
// # Extern library linking
|
||||
|
||||
// User-supplied library search paths (-L on the cammand line) These are
|
||||
|
@ -261,13 +261,6 @@ pub fn get_item_visibility(cstore: @mut cstore::CStore,
|
||||
decoder::get_item_visibility(cdata, def_id.node)
|
||||
}
|
||||
|
||||
pub fn get_link_args_for_crate(cstore: @mut cstore::CStore,
|
||||
crate_num: ast::CrateNum)
|
||||
-> ~[~str] {
|
||||
let cdata = cstore::get_crate_data(cstore, crate_num);
|
||||
decoder::get_link_args_for_crate(cdata)
|
||||
}
|
||||
|
||||
pub fn each_impl(cstore: @mut cstore::CStore,
|
||||
crate_num: ast::CrateNum,
|
||||
callback: &fn(ast::DefId)) {
|
||||
|
@ -1456,16 +1456,6 @@ pub fn translate_def_id(cdata: Cmd, did: ast::DefId) -> ast::DefId {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_link_args_for_crate(cdata: Cmd) -> ~[~str] {
|
||||
let link_args = reader::get_doc(reader::Doc(cdata.data), tag_link_args);
|
||||
let mut result = ~[];
|
||||
do reader::tagged_docs(link_args, tag_link_args_arg) |arg_doc| {
|
||||
result.push(arg_doc.as_str());
|
||||
true
|
||||
};
|
||||
result
|
||||
}
|
||||
|
||||
pub fn each_impl(cdata: Cmd, callback: &fn(ast::DefId)) {
|
||||
let impls_doc = reader::get_doc(reader::Doc(cdata.data), tag_impls);
|
||||
let _ = do reader::tagged_docs(impls_doc, tag_impls_impl) |impl_doc| {
|
||||
|
@ -75,7 +75,6 @@ struct Stats {
|
||||
attr_bytes: u64,
|
||||
dep_bytes: u64,
|
||||
lang_item_bytes: u64,
|
||||
link_args_bytes: u64,
|
||||
impl_bytes: u64,
|
||||
misc_bytes: u64,
|
||||
item_bytes: u64,
|
||||
@ -1610,19 +1609,6 @@ fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
|
||||
ebml_w.end_tag(); // tag_lang_items
|
||||
}
|
||||
|
||||
fn encode_link_args(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
|
||||
ebml_w.start_tag(tag_link_args);
|
||||
|
||||
let link_args = cstore::get_used_link_args(ecx.cstore);
|
||||
for link_arg in link_args.iter() {
|
||||
ebml_w.start_tag(tag_link_args_arg);
|
||||
ebml_w.writer.write(link_arg.as_bytes());
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
struct ImplVisitor<'self> {
|
||||
ecx: &'self EncodeContext<'self>,
|
||||
ebml_w: &'self mut writer::Encoder,
|
||||
@ -1740,7 +1726,6 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
|
||||
attr_bytes: 0,
|
||||
dep_bytes: 0,
|
||||
lang_item_bytes: 0,
|
||||
link_args_bytes: 0,
|
||||
impl_bytes: 0,
|
||||
misc_bytes: 0,
|
||||
item_bytes: 0,
|
||||
@ -1797,11 +1782,6 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
|
||||
encode_lang_items(&ecx, &mut ebml_w);
|
||||
ecx.stats.lang_item_bytes = wr.tell() - i;
|
||||
|
||||
// Encode the link args.
|
||||
i = wr.tell();
|
||||
encode_link_args(&ecx, &mut ebml_w);
|
||||
ecx.stats.link_args_bytes = wr.tell() - i;
|
||||
|
||||
// Encode the def IDs of impls, for coherence checking.
|
||||
i = wr.tell();
|
||||
encode_impls(&ecx, crate, &mut ebml_w);
|
||||
@ -1838,7 +1818,6 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
|
||||
println!(" attribute bytes: {}", ecx.stats.attr_bytes);
|
||||
println!(" dep bytes: {}", ecx.stats.dep_bytes);
|
||||
println!(" lang item bytes: {}", ecx.stats.lang_item_bytes);
|
||||
println!(" link args bytes: {}", ecx.stats.link_args_bytes);
|
||||
println!(" impl bytes: {}", ecx.stats.impl_bytes);
|
||||
println!(" misc bytes: {}", ecx.stats.misc_bytes);
|
||||
println!(" item bytes: {}", ecx.stats.item_bytes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user