Skip to content

Commit 07c1374

Browse files
authored
Merge pull request #37610 from compnerd/5.5-profiling
2 parents 6cd005c + 99db287 commit 07c1374

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

lib/Driver/WindowsToolChains.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +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));
175+
Arguments.push_back(context.Args.MakeArgString("-Xlinker"));
183176
Arguments.push_back(context.Args.MakeArgString(
184-
Twine("-u", llvm::getInstrProfRuntimeHookVarName())));
177+
Twine({"-include:", llvm::getInstrProfRuntimeHookVarName()})));
178+
Arguments.push_back(context.Args.MakeArgString("-lclang_rt.profile"));
185179
}
186180

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

test/Driver/profiling.swift

Lines changed: 2 additions & 2 deletions
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
55-
// WINDOWS: -u__llvm_profile_runtime
54+
// 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)