rust: remove crate hash & metadata from symbol hashing

Rust's symbol hashes break sstate, because a subsequent build of the same
input hash may generate different symbol hashes.  This means that
packages that previously built against the "same" (from bitbake's
perspective) rustc would no longer run, and bitbake would not know to
rebuild them because the input hash is the same.  This is because the
crate metadata contains some data that differs from build-to-build.

This problem actually extends beyond the compiler to any arbitrary
crate, for the same reason.  If a crate in the middle of the dependency
chain had to be rebuilt, bitbake wouldn't realized that all its
dependencies have to be relink, and the dependent packages would fail
due to missing symbols.

Fortunately, bitbake's input hash makes this mechanism largely
unnecessary; any change to rust's source or configuration will cause
rustc and all dependencies to rebuild.  Therefore, it's safe to remove
crate metadata from the hashing.
This commit is contained in:
Steven Walter
2015-06-18 15:51:14 -04:00
parent 3a57f02b1d
commit 29b5f6eadd
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
From 9db9d253355cc0e9e885bb1e63b054e318f9395a Mon Sep 17 00:00:00 2001
From: Steven Walter <swalter@lexmark.com>
Date: Tue, 7 Jul 2015 14:57:42 -0400
Subject: [PATCH] Remove crate metadata from symbol hashing
---
src/librustc_trans/back/link.rs | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 2f2ba16..ea3e897 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -205,9 +205,4 @@ fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>,
symbol_hasher.input_str(&link_meta.crate_name);
- symbol_hasher.input_str("-");
- symbol_hasher.input_str(link_meta.crate_hash.as_str());
- for meta in &*tcx.sess.crate_metadata.borrow() {
- symbol_hasher.input_str(&meta[..]);
- }
symbol_hasher.input_str("-");
symbol_hasher.input_str(&encoder::encoded_ty(tcx, t));
// Prefix with 'h' so that it never blends into adjacent digits
--
1.9.1

View File

@@ -28,6 +28,7 @@ SRC_URI_append = "\
file://${PP}/0007-mk-install-use-disable-rewrite-paths.patch \
file://${PP}/0008-install-disable-ldconfig.patch \
file://${PP}/0009-src-rt-arch-i386-morestack.S-call-rust_stack_exhaust.patch \
file://${PP}/0010-disable-symbol-version-hashing.patch \
\
file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \
"