Skip to content

Commit 99c837b

Browse files
authored
Merge pull request #37609 from compnerd/profiling
Driver: simplify the profiler linking on Windows
2 parents 432f36e + fc3ccdc commit 99c837b

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

lib/Driver/WindowsToolChains.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,10 @@ toolchains::Windows::constructInvocation(const DynamicLinkJobAction &job,
172172
}
173173

174174
if (context.Args.hasArg(options::OPT_profile_generate)) {
175-
SmallString<128> LibProfile(SharedResourceDirPath);
176-
llvm::sys::path::remove_filename(LibProfile); // remove platform name
177-
llvm::sys::path::append(LibProfile, "clang", "lib");
178-
179-
llvm::sys::path::append(LibProfile, getTriple().getOSName(),
180-
Twine("clang_rt.profile-") +
181-
getTriple().getArchName() + ".lib");
182-
Arguments.push_back(context.Args.MakeArgString(LibProfile));
183175
Arguments.push_back(context.Args.MakeArgString("-Xlinker"));
184176
Arguments.push_back(context.Args.MakeArgString(
185177
Twine({"-include:", llvm::getInstrProfRuntimeHookVarName()})));
178+
Arguments.push_back(context.Args.MakeArgString("-lclang_rt.profile"));
186179
}
187180

188181
context.Args.AddAllArgs(Arguments, options::OPT_Xlinker);

test/Driver/profiling.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
// LINUX: -u__llvm_profile_runtime
5252

5353
// WINDOWS: clang{{(\.exe)?"? }}
54-
// WINDOWS: lib{{(\\\\|/)}}swift{{(\\\\|/)}}clang{{(\\\\|/)}}lib{{(\\\\|/)}}windows{{(\\\\|/)}}clang_rt.profile-x86_64.lib
5554
// WINDOWS: -Xlinker -include:__llvm_profile_runtime
55+
// WINDOWS: -lclang_rt.profile
5656

5757
// WASI: clang{{(\.exe)?"? }}
5858
// WASI: lib{{(\\\\|/)}}swift{{(\\\\|/)}}clang{{(\\\\|/)}}lib{{(\\\\|/)}}wasi{{(\\\\|/)}}libclang_rt.profile-wasm32.a

0 commit comments

Comments
 (0)