about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-04 03:00:47 +0000
committerbors <bors@rust-lang.org>2020-04-04 03:00:47 +0000
commit6050e523bae6de61de4e060facc43dc512adaccd (patch)
tree478ebbe47d71b3ca029be2a56d13d78f29ca6de7 /src/test/codegen/src-hash-algorithm
parent9e55101bb681010c82c3c827305e2665fc8f2aa0 (diff)
parentf86b078e2df79968e40185c91b0dce81bc580872 (diff)
downloadrust-6050e523bae6de61de4e060facc43dc512adaccd.tar.gz
rust-6050e523bae6de61de4e060facc43dc512adaccd.zip
Auto merge of #69718 - arlosi:debughash, r=eddyb
Add hash of source files in debug info

LLVM supports placing the hash of source files inside the debug info.
This information can be used by a debugger to verify that the source code matches
the executable.

This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option.

* DWARF only supports MD5
* LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11).
* CodeView (.PDB) supports MD5, SHA1, and SHA256.

Fixes #68980.

Tracking issue: #70401

rustc dev guide PR with further details: https://github.com/rust-lang/rustc-dev-guide/pull/623
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
-rw-r--r--src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs6
-rw-r--r--src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
new file mode 100644
index 00000000000..64be1127786
--- /dev/null
+++ b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
@@ -0,0 +1,6 @@
+// compile-flags: -g -Z src-hash-algorithm=md5
+
+#![crate_type = "lib"]
+
+pub fn test() {}
+// CHECK: checksumkind: CSK_MD5
diff --git a/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
new file mode 100644
index 00000000000..54e07152142
--- /dev/null
+++ b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
@@ -0,0 +1,6 @@
+// compile-flags: -g -Z src-hash-algorithm=sha1
+
+#![crate_type = "lib"]
+
+pub fn test() {}
+// CHECK: checksumkind: CSK_SHA1