@@ -19,8 +19,10 @@ The rustc compiler contains support for following sanitizers:
1919
2020To enable a sanitizer compile with ` -Z sanitizer=... ` option, where value is one
2121of ` address ` , ` cfi ` , ` hwaddress ` , ` kcfi ` , ` leak ` , ` memory ` or ` thread ` .
22- For more details on how to use sanitizers please refer to the sanitizer flag in [ the
23- unstable book] ( https://doc.rust-lang.org/unstable-book/ ) .
22+ For more details on how to use sanitizers,
23+ please refer to the sanitizer flag in [ The Unstable Book] .
24+
25+ [ The Unstable Book ] : https://doc.rust-lang.org/unstable-book
2426
2527## How are sanitizers implemented in rustc?
2628
@@ -43,13 +45,13 @@ Highlight of the most important aspects of the implementation:
4345* During LLVM code generation, the functions intended for instrumentation are
4446 [ marked] [ sanitizer-attribute ] with appropriate LLVM attribute:
4547 ` SanitizeAddress ` , ` SanitizeHWAddress ` , ` SanitizeMemory ` , or ` SanitizeThread ` .
46- By default all functions are instrumented, but this
48+ By default, all functions are instrumented, but this
4749 behaviour can be changed with ` #[sanitize(xyz = "on|off|<other>")] ` .
4850
4951* The decision whether to perform instrumentation or not is possible only at a
5052 function granularity.
5153 In the cases were those decision differ between
52- functions it might be necessary to inhibit inlining, both at [ MIR
54+ functions, it might be necessary to inhibit inlining, both at [ MIR
5355 level] [ inline-mir ] and [ LLVM level] [ inline-llvm ] .
5456
5557* The LLVM IR generated by rustc is instrumented by [ dedicated LLVM
@@ -59,8 +61,8 @@ Highlight of the most important aspects of the implementation:
5961* When producing an executable, the sanitizer specific runtime library is
6062 [ linked in] [ sanitizer-link ] .
6163 The libraries are searched for in the target libdir.
62- First relative to the overridden system root and subsequently
63- relative to the default system root.
64+ First, the search is relative to the overridden system root, and subsequently,
65+ it is relative to the default system root.
6466 Fall-back to the default system root
6567 ensures that sanitizer runtimes remain available when using sysroot overrides
6668 constructed by cargo ` -Z build-std ` or xargo.
@@ -82,20 +84,20 @@ Sanitizers are validated by code generation tests in
8284[ ` tests/ui/sanitizer/ ` ] [ test-ui ] directory.
8385
8486Testing sanitizer functionality requires the sanitizer runtimes (built when
85- ` sanitizer = true ` in ` bootstrap.toml ` ) and target providing support for particular sanitizer.
86- When sanitizer is unsupported on given target, sanitizers tests will be ignored.
87+ ` sanitizer = true ` in ` bootstrap.toml ` ) and target providing support for particular a sanitizer.
88+ When a sanitizer is unsupported on a given target, sanitizer tests will be ignored.
8789This behaviour is controlled by compiletest ` needs-sanitizer-* ` directives.
8890
8991[ test-cg ] : https://github.com/rust-lang/rust/tree/HEAD/tests/codegen-llvm
9092[ test-ui ] : https://github.com/rust-lang/rust/tree/HEAD/tests/ui/sanitizer
9193
92- ## Enabling sanitizer on a new target
94+ ## Enabling a sanitizer on a new target
9395
9496To enable a sanitizer on a new target which is already supported by LLVM:
9597
96981 . Include the sanitizer in the list of ` supported_sanitizers ` in [ the target
9799 definition] [ target-definition ] .
98- ` rustc --target .. -Zsanitizer=.. ` should now recognize sanitizer as supported.
100+ ` rustc --target .. -Zsanitizer=.. ` should now recognize the sanitizer as supported.
991012 . [ Build the runtime for the target and include it in the libdir.] [ sanitizer-targets ]
1001023 . [ Teach compiletest that your target now supports the sanitizer.] [ compiletest-definition ]
101103 Tests marked with ` needs-sanitizer-* ` should now run on the target.
0 commit comments