Skip to content

Commit fbe9fec

Browse files
committed
Add section to sanitizer doc for -Zexternal-clangrt
After spending a week looking for answers to how to do the very thing this flag lets me do, it felt appropriate to document it where I would've expected it to be.
1 parent af4a5a1 commit fbe9fec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/doc/unstable-book/src/compiler-flags/sanitizer.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,18 @@ functionality][build-std].
853853
854854
[build-std]: ../../cargo/reference/unstable.html#build-std
855855
856+
# Working with other languages
857+
858+
Sanitizers rely on compiler runtime libraries to function properly. Rust links
859+
in its own compiler runtime which might conflict with runtimes required by
860+
languages such as C++. Since Rust's runtime doesn't always contain the symbols
861+
required by C++ instrumented code, you might need to skip linking it so another
862+
runtime can be linked instead.
863+
864+
A separate unstable option `-Zexternal-clangrt` can be used to make rustc skip
865+
linking the compiler runtime for the sanitizer. This will require you to link
866+
in an external runtime, such as from clang instead.
867+
856868
# Build scripts and procedural macros
857869
858870
Use of sanitizers together with build scripts and procedural macros is

0 commit comments

Comments
 (0)