Skip to content

Commit b4f450a

Browse files
lhtgraydon
authored andcommitted
Using filename when finding libraries for linking
Revert #999 commit 16dad84
1 parent 887d970 commit b4f450a

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ endif
105105
CFG_RUNTIME :=$(call CFG_LIB_NAME,rustrt)
106106
CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm)
107107
CFG_CORELIB :=$(call CFG_LIB_NAME,core)
108-
CFG_STDLIB :=$(call CFG_LIB_NAME,ruststd)
108+
CFG_STDLIB :=$(call CFG_LIB_NAME,std)
109109
CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc)
110110

111111
# version-string calculation

src/comp/metadata/creader.rs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,25 +125,39 @@ fn find_library_crate(sess: session::session, ident: ast::ident,
125125
attr::require_unique_names(sess, metas);
126126
let metas = metas;
127127

128-
// Metadata "name" will be used to find the crate. Use `ident'
129-
// as "name" if the attribute is not explicitly specified
130-
if !attr::contains_name(metas, "name") {
131-
metas += [attr::mk_name_value_item_str("name", ident)];
132-
}
128+
let crate_name =
129+
{
130+
let name_items = attr::find_meta_items_by_name(metas, "name");
131+
alt vec::last(name_items) {
132+
some(i) {
133+
alt attr::get_meta_item_value_str(i) {
134+
some(n) { n }
135+
// FIXME: Probably want a warning here since the user
136+
// is using the wrong type of meta item
137+
_ { ident }
138+
}
139+
}
140+
none. { ident }
141+
}
142+
};
143+
133144
let nn = default_native_lib_naming(sess, sess.get_opts().static);
134145
let x =
135-
find_library_crate_aux(sess, nn, metas, sess.filesearch());
146+
find_library_crate_aux(sess, nn, crate_name,
147+
metas, sess.filesearch());
136148
if x != none || sess.get_opts().static { ret x; }
137149
let nn2 = default_native_lib_naming(sess, true);
138-
ret find_library_crate_aux(sess, nn2, metas, sess.filesearch());
150+
ret find_library_crate_aux(sess, nn2, crate_name, metas,
151+
sess.filesearch());
139152
}
140153

141154
fn find_library_crate_aux(sess: session::session,
142155
nn: {prefix: str, suffix: str},
156+
crate_name: str,
143157
metas: [@ast::meta_item],
144158
filesearch: filesearch::filesearch) ->
145159
option::t<{ident: str, data: @[u8]}> {
146-
let prefix: str = nn.prefix;
160+
let prefix: str = nn.prefix + crate_name;
147161
let suffix: str = nn.suffix;
148162

149163
ret filesearch::search(filesearch, { |path|

0 commit comments

Comments
 (0)