about summary refs log tree commit diff
path: root/src/doc/unstable-book
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/doc/unstable-book
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/doc/unstable-book')
-rw-r--r--src/doc/unstable-book/src/compiler-flags/src-hash-algorithm.md11
1 files changed, 11 insertions, 0 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
new file mode 100644
index 00000000000..5a7d0655a44
--- /dev/null
+++ b/src/doc/unstable-book/src/compiler-flags/src-hash-algorithm.md
@@ -0,0 +1,11 @@
+# `src-hash-algorithm`
+
+The tracking issue for this feature is: [#70401](https://github.com/rust-lang/rust/issues/70401).
+
+------------------------
+
+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.
+
+By default, the compiler chooses the hash algorithm based on the target specification.