Skip to content

Commit c7d726f

Browse files
committed
sanitizers: Add documentation for stable sanitizers
1 parent cdf03da commit c7d726f

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
@@ -519,6 +519,46 @@ enabled. It takes one of the following values:
519519
* `y`, `yes`, `on`, `true` or no value: enable rpath.
520520
* `n`, `no`, `off` or `false`: disable rpath (the default).
521521

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

524564
This flag controls whether temporary files generated during compilation are

0 commit comments

Comments
 (0)