Skip to content

Commit 4e75265

Browse files
committed
Truncate symbol hashes to 64 bits.
1 parent 8ec03b3 commit 4e75265

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/librustc/back/link.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use std::run;
3434
use std::str;
3535
use std::io;
3636
use std::io::fs;
37+
use extra::hex::ToHex;
3738
use extra::tempfile::TempDir;
3839
use syntax::abi;
3940
use syntax::ast;
@@ -494,8 +495,10 @@ pub fn build_link_meta(sess: Session,
494495
}
495496
}
496497

497-
pub fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str {
498-
symbol_hasher.result_str()
498+
fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str {
499+
let output = symbol_hasher.result_bytes();
500+
// 64 bits should be enough to avoid collisions.
501+
output.slice_to(8).to_hex()
499502
}
500503

501504

0 commit comments

Comments
 (0)