Skip to content

Commit f1d594e

Browse files
committed
Add -Z external-clangrt
This adds the unstable `-Z external-clangrt` flag that will prevent rustc from emitting linker paths for the in-tree LLVM sanitizer runtime library.
1 parent 3f39cae commit f1d594e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,7 @@ fn add_sanitizer_libraries(sess: &Session, crate_type: CrateType, linker: &mut d
11921192
// are currently distributed as static libraries which should be linked to
11931193
// executables only.
11941194
let needs_runtime = !sess.target.is_like_android
1195+
&& !sess.opts.unstable_opts.external_clangrt
11951196
&& match crate_type {
11961197
CrateType::Executable => true,
11971198
CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro => sess.target.is_like_osx,

compiler/rustc_session/src/options.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,8 @@ options! {
16211621
"emit the bc module with thin LTO info (default: yes)"),
16221622
export_executable_symbols: bool = (false, parse_bool, [TRACKED],
16231623
"export symbols from executables, as if they were dynamic libraries"),
1624+
external_clangrt: bool = (false, parse_bool, [UNTRACKED],
1625+
"rely on user specified linker commands to find clangrt"),
16241626
extra_const_ub_checks: bool = (false, parse_bool, [TRACKED],
16251627
"turns on more checks to detect const UB, which can be slow (default: no)"),
16261628
#[rustc_lint_opt_deny_field_access("use `Session::fewer_names` instead of this field")]

0 commit comments

Comments
 (0)