about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-11-03 19:32:26 +0100
committerGitHub <noreply@github.com>2020-11-03 19:32:26 +0100
commit52405f7c0cc3e8cc52293ea19b78da88eb79af2d (patch)
tree9278e073fba56162eb4f1cfe06cf1763ddcc2e83 /src
parent0cd1516696550e108863bf4b4fb81ce5c4f58968 (diff)
parent3296d5ca7b41154359eaec76d9f77310816c9913 (diff)
downloadrust-52405f7c0cc3e8cc52293ea19b78da88eb79af2d.tar.gz
rust-52405f7c0cc3e8cc52293ea19b78da88eb79af2d.zip
Rollup merge of #77950 - arlosi:sha256, r=eddyb
Add support for SHA256 source file hashing

Adds support for `-Z src-hash-algorithm sha256`, which became available in LLVM 11.

Using an older version of LLVM will cause an error `invalid checksum kind` if the hash algorithm is set to sha256.

r? `@eddyb`
cc #70401 `@est31`
Diffstat (limited to 'src')
-rw-r--r--src/doc/unstable-book/src/compiler-flags/src-hash-algorithm.md2
-rw-r--r--src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs7
-rw-r--r--src/tools/tidy/src/deps.rs2
3 files changed, 10 insertions, 1 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/src-hash-algorithm.md b/src/doc/unstable-book/src/compiler-flags/src-hash-algorithm.md
index 5a7d0655a44..ff776741b21 100644
--- a/src/doc/unstable-book/src/compiler-flags/src-hash-algorithm.md
+++ b/src/doc/unstable-book/src/compiler-flags/src-hash-algorithm.md
@@ -6,6 +6,6 @@ The tracking issue for this feature is: [#70401](https://github.com/rust-lang/ru
 
 The `-Z src-hash-algorithm` compiler flag controls which algorithm is used when hashing each source file. The hash is stored in the debug info and can be used by a debugger to verify the source code matches the executable.
 
-Supported hash algorithms are: `md5`, and `sha1`. Note that not all hash algorithms are supported by all debug info formats.
+Supported hash algorithms are: `md5`, `sha1`, and `sha256`. Note that not all hash algorithms are supported by all debug info formats.
 
 By default, the compiler chooses the hash algorithm based on the target specification.
diff --git a/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
new file mode 100644
index 00000000000..eaa9eafa1e8
--- /dev/null
+++ b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
@@ -0,0 +1,7 @@
+// compile-flags: -g -Z src-hash-algorithm=sha256
+// min-llvm-version: 11.0
+
+#![crate_type = "lib"]
+
+pub fn test() {}
+// CHECK: checksumkind: CSK_SHA256
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 0c52fee68a9..057b0884e28 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -80,6 +80,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
     "cloudabi",
     "cmake",
     "compiler_builtins",
+    "cpuid-bool",
     "crc32fast",
     "crossbeam-deque",
     "crossbeam-epoch",
@@ -160,6 +161,7 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
     "serde",
     "serde_derive",
     "sha-1",
+    "sha2",
     "smallvec",
     "snap",
     "stable_deref_trait",