Skip to content

Commit

Permalink
Add -Z external-clangrt
Browse files Browse the repository at this point in the history
This adds the unstable `-Z external-clangrt` flag that will prevent
rustc from emitting linker paths for the in-tree LLVM sanitizer runtime
library.
  • Loading branch information
chriswailes committed Feb 16, 2024
1 parent 3f39cae commit f1d594e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,7 @@ fn add_sanitizer_libraries(sess: &Session, crate_type: CrateType, linker: &mut d
// are currently distributed as static libraries which should be linked to
// executables only.
let needs_runtime = !sess.target.is_like_android
&& !sess.opts.unstable_opts.external_clangrt
&& match crate_type {
CrateType::Executable => true,
CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro => sess.target.is_like_osx,
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,8 @@ options! {
"emit the bc module with thin LTO info (default: yes)"),
export_executable_symbols: bool = (false, parse_bool, [TRACKED],
"export symbols from executables, as if they were dynamic libraries"),
external_clangrt: bool = (false, parse_bool, [UNTRACKED],
"rely on user specified linker commands to find clangrt"),
extra_const_ub_checks: bool = (false, parse_bool, [TRACKED],
"turns on more checks to detect const UB, which can be slow (default: no)"),
#[rustc_lint_opt_deny_field_access("use `Session::fewer_names` instead of this field")]
Expand Down

0 comments on commit f1d594e

Please sign in to comment.