Commit 5eca8b6
authored
[PGO][HIP] Fix profile-only Windows link by gating ROCm interceptor macro (llvm#200859)
PR llvm#200111 stops compiling InstrProfilingPlatformROCm.cpp (which defines
the
HIP GPU helper __llvm_profile_hip_collect_device_data) in profile-only
builds.
But the compile define -DCOMPILER_RT_BUILD_PROFILE_ROCM=1 was still
added
whenever the COMPILER_RT_BUILD_PROFILE_ROCM option was on (the default),
so
InstrProfilingFile.c still referenced the helper from
__llvm_profile_write_file
even though it was never built.
On ELF the declaration is weak, so the undefined symbol folds to null
and the
address-guarded call is skipped. COFF/Windows has no such fallback:
error LNK2019: unresolved external symbol
__llvm_profile_hip_collect_device_data referenced in function
__llvm_profile_write_file
Add the define only when PROFILE_HAS_HIP_INTERCEPTOR is true, i.e. the
same
condition that keeps InstrProfilingPlatformROCm.cpp in the archive, so
the
macro is defined iff the helper is actually compiled in.
Reported by zmodem:
llvm#200111 (comment)1 parent 09f30ef commit 5eca8b6
1 file changed
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 161 | | |
168 | 162 | | |
169 | 163 | | |
| |||
190 | 184 | | |
191 | 185 | | |
192 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
193 | 198 | | |
194 | 199 | | |
195 | 200 | | |
| |||
0 commit comments