Skip to content

Commit 87540fe

Browse files
committed
Fix PGO lld build
1 parent 1be41d2 commit 87540fe

File tree

1 file changed

+11
-6
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+11
-6
lines changed

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,13 +1037,18 @@ impl Step for Lld {
10371037
// when doing PGO on CI, cmake or clang-cl don't automatically link clang's
10381038
// profiler runtime in. In that case, we need to manually ask cmake to do it, to avoid
10391039
// linking errors, much like LLVM's cmake setup does in that situation.
1040-
if builder.config.llvm_profile_generate && target.is_msvc() {
1041-
if let Some(clang_cl_path) = builder.config.llvm_clang_cl.as_ref() {
1042-
// Find clang's runtime library directory and push that as a search path to the
1043-
// cmake linker flags.
1044-
let clang_rt_dir = get_clang_cl_resource_dir(builder, clang_cl_path);
1045-
ldflags.push_all(format!("/libpath:{}", clang_rt_dir.display()));
1040+
if builder.config.llvm_profile_generate {
1041+
if target.is_msvc() {
1042+
if let Some(clang_cl_path) = builder.config.llvm_clang_cl.as_ref() {
1043+
// Find clang's runtime library directory and push that as a search path to the
1044+
// cmake linker flags.
1045+
let clang_rt_dir = get_clang_cl_resource_dir(builder, clang_cl_path);
1046+
ldflags.push_all(format!("/libpath:{}", clang_rt_dir.display()));
1047+
}
1048+
} else {
1049+
ldflags.push_all("-L/opt/homebrew/Cellar/llvm/20.1.2/lib/clang/20/lib/darwin/lib -lclang_rt.profile_osx");
10461050
}
1051+
10471052
}
10481053

10491054
// LLD is built as an LLVM tool, but is distributed outside of the `llvm-tools` component,

0 commit comments

Comments
 (0)