Skip to content

Commit d9c3438

Browse files
committed
Add additional information about Rust implementation
1 parent 0a5c8e1 commit d9c3438

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Diff for: src/debugging-support-in-rustc.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,29 @@ The hash can also be used to prove that a given source file has not been modifie
280280
used to compile an executable. Because MD5 and SHA1 both have demonstrated vulnerabilities,
281281
using SHA256 is recommended for this application.
282282

283+
The Rust compiler stores the hash for each source file in the corresponding `SourceFile` in
284+
the `SourceMap`. The hashes of input files to external crates are stored in `rlib` metadata.
285+
286+
A default hashing algorithm is set in the target specification. This allows the target to
287+
specify the best hash available, since not all targets support all hash algorithms.
288+
289+
The hashing algorithm for a target can also be overridden with the `-Z source-file-checksum=`
290+
command-line option.
291+
283292
#### DWARF 5
284293
DWARF version 5 supports embedding an MD5 hash to validate the source file version in use.
285294
DWARF 5 - Section 6.2.4.1 opcode DW_LNCT_MD5
286295

287296
#### LLVM
288-
LLVM IR supports MD5, SHA1, and SHA256 source file checksums in the DIFile node.
297+
LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11+) source file checksums in the DIFile node.
289298

290-
LLVM DIFile documentation: [https://llvm.org/docs/LangRef.html#difile]
299+
[LLVM DIFile documentation](https://llvm.org/docs/LangRef.html#difile)
291300

292301
#### Microsoft Visual C++ Compiler /ZH option
293302
The MSVC compiler supports embedding MD5, SHA1, or SHA256 hashes in the PDB using the `/ZH`
294303
compiler option.
295304

296-
MSVC /ZH documentation: [https://docs.microsoft.com/en-us/cpp/build/reference/zh]
305+
[MSVC /ZH documentation](https://docs.microsoft.com/en-us/cpp/build/reference/zh)
297306

298307
#### Clang
299308
Clang always embeds an MD5 checksum, though this does not appear in documentation.
@@ -345,5 +354,3 @@ to do this bridge but may have to add some mode to let the compiler understand s
345354
[Apple developer documentation for System Integrity Protection]: https://developer.apple.com/library/archive/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_11.html#//apple_ref/doc/uid/TP40016227-SW11
346355
[https://github.com/rust-lang/lldb]: https://github.com/rust-lang/lldb
347356
[https://github.com/rust-lang/llvm-project]: https://github.com/rust-lang/llvm-project
348-
[https://llvm.org/docs/LangRef.html#difile]: https://llvm.org/docs/LangRef.html#difile
349-
[https://docs.microsoft.com/en-us/cpp/build/reference/zh]: https://docs.microsoft.com/en-us/cpp/build/reference/zh

0 commit comments

Comments
 (0)