Skip to content

Commit 80188cf

Browse files
committed
---
yaml --- r: 153156 b: refs/heads/try2 c: 1007739 h: refs/heads/master v: v3
1 parent c5c2029 commit 80188cf

File tree

6 files changed

+21
-2
lines changed

6 files changed

+21
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 50ee1ec1b4f107122d8037ac7b0b312afa6eb0ac
8+
refs/heads/try2: 1007739b20110bf7af654354815e2a1265282ec2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/back/link.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,10 @@ pub fn crate_name_hash(sess: &Session, crate_name: &str) -> String {
593593
// the crate id in the hash because lookups are only done by (name/vers),
594594
// not by path.
595595
let mut s = Sha256::new();
596-
s.input_str(crate_id.short_name_with_version().as_slice());
596+
s.input_str(crate_name);
597+
for meta in sess.crate_metadata.borrow().iter() {
598+
s.input_str(meta.as_slice());
599+
}
597600
truncated_hash_result(&mut s).as_slice().slice_to(8).to_string()
598601
}
599602

@@ -626,6 +629,9 @@ fn symbol_hash(tcx: &ty::ctxt,
626629
symbol_hasher.input_str(link_meta.crate_name.as_slice());
627630
symbol_hasher.input_str("-");
628631
symbol_hasher.input_str(link_meta.crate_hash.as_str());
632+
for meta in tcx.sess.crate_metadata.borrow().iter() {
633+
symbol_hasher.input_str(meta.as_slice());
634+
}
629635
symbol_hasher.input_str("-");
630636
symbol_hasher.input_str(encoder::encoded_ty(tcx, t).as_slice());
631637
// Prefix with 'h' so that it never blends into adjacent digits

branches/try2/src/librustc/driver/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ cgoptions!(
318318
"use an external assembler rather than LLVM's integrated one"),
319319
relocation_model: String = ("pic".to_string(), parse_string,
320320
"choose the relocation model to use (llc -relocation-model for details)"),
321+
metadata: Vec<String> = (Vec::new(), parse_list,
322+
"metadata to mangle symbol names with"),
321323
)
322324

323325
pub fn build_codegen_options(matches: &getopts::Matches) -> CodegenOptions

branches/try2/src/librustc/driver/driver.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
186186

187187
*sess.crate_types.borrow_mut() =
188188
collect_crate_types(sess, krate.attrs.as_slice());
189+
*sess.crate_metadata.borrow_mut() =
190+
collect_crate_metadata(sess, krate.attrs.as_slice());
189191

190192
time(time_passes, "gated feature checking", (), |_|
191193
front::feature_gate::check_crate(sess, &krate));
@@ -848,6 +850,11 @@ pub fn collect_crate_types(session: &Session,
848850
}).collect()
849851
}
850852

853+
pub fn collect_crate_metadata(session: &Session,
854+
_attrs: &[ast::Attribute]) -> Vec<String> {
855+
session.opts.cg.metadata.clone()
856+
}
857+
851858
pub struct OutputFilenames {
852859
pub out_directory: Path,
853860
pub out_filestem: String,

branches/try2/src/librustc/driver/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ fn print_crate_info(sess: &Session,
311311
}
312312
if crate_file_name {
313313
let crate_types = driver::collect_crate_types(sess, attrs.as_slice());
314+
let metadata = driver::collect_crate_metadata(sess, attrs.as_slice());
315+
*sess.crate_metadata.borrow_mut() = metadata;
314316
for &style in crate_types.iter() {
315317
let fname = link::filename_for_input(sess, style, id.as_slice(),
316318
&t_outputs.with_extension(""));

branches/try2/src/librustc/driver/session.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub struct Session {
4747
pub lints: RefCell<NodeMap<Vec<(lint::LintId, codemap::Span, String)>>>,
4848
pub node_id: Cell<ast::NodeId>,
4949
pub crate_types: RefCell<Vec<config::CrateType>>,
50+
pub crate_metadata: RefCell<Vec<String>>,
5051
pub features: front::feature_gate::Features,
5152

5253
/// The maximum recursion limit for potentially infinitely recursive
@@ -243,6 +244,7 @@ pub fn build_session_(sopts: config::Options,
243244
lints: RefCell::new(NodeMap::new()),
244245
node_id: Cell::new(1),
245246
crate_types: RefCell::new(Vec::new()),
247+
crate_metadata: RefCell::new(Vec::new()),
246248
features: front::feature_gate::Features::new(),
247249
recursion_limit: Cell::new(64),
248250
};

0 commit comments

Comments
 (0)