File tree Expand file tree Collapse file tree 6 files changed +21
-2
lines changed
branches/try2/src/librustc Expand file tree Collapse file tree 6 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: 50ee1ec1b4f107122d8037ac7b0b312afa6eb0ac
8
+ refs/heads/try2: 1007739b20110bf7af654354815e2a1265282ec2
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -593,7 +593,10 @@ pub fn crate_name_hash(sess: &Session, crate_name: &str) -> String {
593
593
// the crate id in the hash because lookups are only done by (name/vers),
594
594
// not by path.
595
595
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
+ }
597
600
truncated_hash_result ( & mut s) . as_slice ( ) . slice_to ( 8 ) . to_string ( )
598
601
}
599
602
@@ -626,6 +629,9 @@ fn symbol_hash(tcx: &ty::ctxt,
626
629
symbol_hasher. input_str ( link_meta. crate_name . as_slice ( ) ) ;
627
630
symbol_hasher. input_str ( "-" ) ;
628
631
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
+ }
629
635
symbol_hasher. input_str ( "-" ) ;
630
636
symbol_hasher. input_str ( encoder:: encoded_ty ( tcx, t) . as_slice ( ) ) ;
631
637
// Prefix with 'h' so that it never blends into adjacent digits
Original file line number Diff line number Diff line change @@ -318,6 +318,8 @@ cgoptions!(
318
318
"use an external assembler rather than LLVM's integrated one" ) ,
319
319
relocation_model: String = ( "pic" . to_string( ) , parse_string,
320
320
"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" ) ,
321
323
)
322
324
323
325
pub fn build_codegen_options ( matches : & getopts:: Matches ) -> CodegenOptions
Original file line number Diff line number Diff line change @@ -186,6 +186,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
186
186
187
187
* sess. crate_types . borrow_mut ( ) =
188
188
collect_crate_types ( sess, krate. attrs . as_slice ( ) ) ;
189
+ * sess. crate_metadata . borrow_mut ( ) =
190
+ collect_crate_metadata ( sess, krate. attrs . as_slice ( ) ) ;
189
191
190
192
time ( time_passes, "gated feature checking" , ( ) , |_|
191
193
front:: feature_gate:: check_crate ( sess, & krate) ) ;
@@ -848,6 +850,11 @@ pub fn collect_crate_types(session: &Session,
848
850
} ) . collect ( )
849
851
}
850
852
853
+ pub fn collect_crate_metadata ( session : & Session ,
854
+ _attrs : & [ ast:: Attribute ] ) -> Vec < String > {
855
+ session. opts . cg . metadata . clone ( )
856
+ }
857
+
851
858
pub struct OutputFilenames {
852
859
pub out_directory : Path ,
853
860
pub out_filestem : String ,
Original file line number Diff line number Diff line change @@ -311,6 +311,8 @@ fn print_crate_info(sess: &Session,
311
311
}
312
312
if crate_file_name {
313
313
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;
314
316
for & style in crate_types. iter ( ) {
315
317
let fname = link:: filename_for_input ( sess, style, id. as_slice ( ) ,
316
318
& t_outputs. with_extension ( "" ) ) ;
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ pub struct Session {
47
47
pub lints : RefCell < NodeMap < Vec < ( lint:: LintId , codemap:: Span , String ) > > > ,
48
48
pub node_id : Cell < ast:: NodeId > ,
49
49
pub crate_types : RefCell < Vec < config:: CrateType > > ,
50
+ pub crate_metadata : RefCell < Vec < String > > ,
50
51
pub features : front:: feature_gate:: Features ,
51
52
52
53
/// The maximum recursion limit for potentially infinitely recursive
@@ -243,6 +244,7 @@ pub fn build_session_(sopts: config::Options,
243
244
lints : RefCell :: new ( NodeMap :: new ( ) ) ,
244
245
node_id : Cell :: new ( 1 ) ,
245
246
crate_types : RefCell :: new ( Vec :: new ( ) ) ,
247
+ crate_metadata : RefCell :: new ( Vec :: new ( ) ) ,
246
248
features : front:: feature_gate:: Features :: new ( ) ,
247
249
recursion_limit : Cell :: new ( 64 ) ,
248
250
} ;
You can’t perform that action at this time.
0 commit comments