Skip to content

Commit 970d047

Browse files
committed
sanitizers: Add documentation for stable sanitizers
1 parent cb37a27 commit 970d047

File tree

1 file changed

+40
-0
lines changed
  • src/doc/rustc/src/codegen-options

1 file changed

+40
-0
lines changed

src/doc/rustc/src/codegen-options/index.md

+40
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,46 @@ enabled. It takes one of the following values:
516516
* `y`, `yes`, `on`, `true` or no value: enable rpath.
517517
* `n`, `no`, `off` or `false`: disable rpath (the default).
518518

519+
## sanitize
520+
521+
Sanitizers are tools that help detect and prevent various types of bugs and
522+
vulnerabilities in software. They are available in compilers and work by
523+
instrumenting the code to add additional runtime checks. While they provide
524+
powerful tools for identifying bugs or security issues, it's important to note
525+
that using sanitizers can introduce runtime overhead and might not catch all
526+
possible issues. Therefore, they are typically used alongside other best
527+
practices in software development, such as testing and fuzzing, to ensure the
528+
highest level of software quality and security.
529+
530+
This option allows for use of one or more of these sanitizers:
531+
532+
* [AddressSanitizer](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/sanitizer.html#addresssanitizer)
533+
a fast memory error detector.
534+
* [LeakSanitizer](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/sanitizer.html#leaksanitizer)
535+
a run-time memory leak detector.
536+
537+
These are the valid values for this option for targets that support one or more
538+
of these sanitizers:
539+
540+
| Target | Sanitizers |
541+
|--------|------------|
542+
| aarch64-unknown-linux-gnu | address, leak |
543+
| i586-pc-windows-msvc | address |
544+
| i586-unknown-linux-gnu | address |
545+
| i686-pc-windows-msvc | address |
546+
| i686-unknown-linux-gnu | address |
547+
| x86_64-apple-darwin | address, leak |
548+
| x86_64-pc-windows-msvc | address |
549+
| x86_64-unknown-linux-gnu | address, leak |
550+
551+
For more information on sanitizers, see the
552+
[sanitizer
553+
feature](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/sanitizer.html)
554+
in the [The Rust Unstable
555+
Book](https://doc.rust-lang.org/nightly/unstable-book/). For more information on
556+
stable and supported sanitizers, see the [supported sanitizers
557+
table](https://github.com/rust-lang/rust/issues/123615#issuecomment-2041791236).
558+
519559
## save-temps
520560

521561
This flag controls whether temporary files generated during compilation are

0 commit comments

Comments
 (0)