Skip to content

Commit 1f873f9

Browse files
committed
Fix linking to sanitizers on Apple targets
1 parent 35977b4 commit 1f873f9

File tree

1 file changed

+7
-3
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+7
-3
lines changed

Diff for: compiler/rustc_codegen_ssa/src/back/link.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -2099,10 +2099,14 @@ fn add_library_search_dirs(
20992099

21002100
// Toolchains for some targets may ship `libunwind.a`, but place it into the main sysroot
21012101
// library directory instead of the self-contained directories.
2102+
// Sanitizer libraries have the same issue and are also linked by name on Apple targets.
21022103
// The targets here should be in sync with `copy_third_party_objects` in bootstrap.
2103-
// FIXME: implement `-Clink-self-contained=+/-unwind`, move the shipped libunwind
2104-
// to self-contained directory, and stop adding this search path.
2105-
if sess.target.vendor == "fortanix" || sess.target.os == "linux" || sess.target.os == "fuchsia"
2104+
// FIXME: implement `-Clink-self-contained=+/-unwind,+/-sanitizers`, move the shipped libunwind
2105+
// and sanitizers to self-contained directory, and stop adding this search path.
2106+
if sess.target.vendor == "fortanix"
2107+
|| sess.target.os == "linux"
2108+
|| sess.target.os == "fuchsia"
2109+
|| sess.target.is_like_osx && !sess.opts.unstable_opts.sanitizer.is_empty()
21062110
{
21072111
let lib_path = sess.target_filesearch(PathKind::Native).get_lib_path();
21082112
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));

0 commit comments

Comments
 (0)