[compiler-rt] [PGO][HIP] Skip ROCm interceptor in profile-only compiler-rt builds (PR #200111)

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 08:09:33 PDT 2026


zmodem wrote:

This broke our builds on Windows. I guess it relates to this:

> The host-side hook __llvm_profile_hip_collect_device_data is already declared weak in InstrProfilingFile.c (PR https://github.com/llvm/llvm-project/pull/200101), so its absence is fine at link time.

because we get undefined symbol errors for `__llvm_profile_hip_collect_device_data` and looking at #200101 it does not declare that symbol weak on Windows.

Here's a reproducer:

```
cmake -Bbuild.foo -GNinja -DCMAKE_BUILD_TYPE=Release -DCOMPILER_RT_BUILD_CRT=ON -DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCOMPILER_RT_BUILD_CTX_PROFILE=OFF -DCOMPILER_RT_BUILD_MEMPROF=OFF -DCOMPILER_RT_BUILD_ORC=OFF -DCOMPILER_RT_BUILD_PROFILE=ON -DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_RUNTIMES=compiler-rt -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG_ENABLE_ARCMT=OFF llvm && ninja -C build.foo check-runtimes
...
********************
FAIL: Profile-x86_64 :: Windows/instrprof-multiprocess.test (404 of 405, 3 of 3 attempts)
******************** TEST 'Profile-x86_64 :: Windows/instrprof-multiprocess.test' FAILED ********************
Exit Code: 1120

Command Output (stdout):
--
# RUN: at line 1
C:/src/llvm-project/build.foo/./bin/clang.exe    -D_MT -D_DLL -Wl,-nodefaultlib:libcmt,-defaultlib:msvcrt,-defaultlib:oldnames  -Wl,-incremental:no  -fprofile-instr-generate C:\src\llvm-project\compiler-rt\test\profile\Windows/Inputs/instrprof-multiprocess.c -o C:\src\llvm-project\build.foo\runtimes\runtimes-bins\compiler-rt\test\profile\Profile-x86_64\Windows\Output\instrprof-multiprocess.test.tmp
# executed command: C:/src/llvm-project/build.foo/./bin/clang.exe -D_MT -D_DLL -Wl,-nodefaultlib:libcmt,-defaultlib:msvcrt,-defaultlib:oldnames -Wl,-incremental:no -fprofile-instr-generate 'C:\src\llvm-project\compiler-rt\test\profile\Windows/Inputs/instrprof-multiprocess.c' -o 'C:\src\llvm-project\build.foo\runtimes\runtimes-bins\compiler-rt\test\profile\Profile-x86_64\Windows\Output\instrprof-multiprocess.test.tmp'
# .---command stdout------------
# | clang_rt.profile-x86_64.lib(InstrProfilingFile.c.obj) : error LNK2019: unresolved external symbol __llvm_profile_hip_collect_device_data referenced in function __llvm_profile_write_file
# | C:\src\llvm-project\build.foo\runtimes\runtimes-bins\compiler-rt\test\profile\Profile-x86_64\Windows\Output\instrprof-multiprocess.test.tmp : fatal error LNK1120: 1 unresolved externals
# `-----------------------------
# .---command stderr------------
# | C:\src\llvm-project\compiler-rt\test\profile\Windows/Inputs/instrprof-multiprocess.c:12:3: warning: '_itow' is deprecated: This function or variable may be unsafe. Consider using _itow_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
# |    12 |   _itow(child_num, child_str, 10);
# |       |   ^
# | C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_wstdlib.h:68:5: note: '_itow' has been explicitly marked deprecated here
# |    68 |     __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
# |       |     ^
# | C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:847:5: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1'
# |   847 |     __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _HType1, _HArg1, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1)
# |       |     ^
# | C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt.h:1906:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1_EX'
# |  1906 |                 _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_HType1 _HArg1, _SalAttributeDst _DstType *_Dst, _TType1 _TArg1);
# |       |                 ^
# | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\vcruntime.h:320:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
# |   320 |         #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
# |       |                                                       ^
# | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\vcruntime.h:310:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
# |   310 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
# |       |                                               ^
# | C:\src\llvm-project\compiler-rt\test\profile\Windows/Inputs/instrprof-multiprocess.c:68:21: warning: 'getenv' is deprecated: This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
# |    68 |   char *child_str = getenv("CHILD_NUM");
# |       |                     ^
# | C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdlib.h:1183:20: note: 'getenv' has been explicitly marked deprecated here
# |  1183 |     _Check_return_ _CRT_INSECURE_DEPRECATE(_dupenv_s)
# |       |                    ^
# | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\vcruntime.h:320:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
# |   320 |         #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
# |       |                                                       ^
# | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\vcruntime.h:310:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
# |   310 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
# |       |                                               ^
# | 2 warnings generated.
# | clang: error: linker command failed with exit code 1120 (use -v to see invocation)
# `-----------------------------
# error: command failed with exit status: 0x460

--

********************
********************
Failed Tests (42):
  Profile-x86_64 :: ContinuousSyncMode/runtime-counter-relocation.c
  Profile-x86_64 :: Windows/coverage-linkage.cpp
  Profile-x86_64 :: Windows/instrprof-multiprocess.test
  Profile-x86_64 :: coverage-inline.cpp
  Profile-x86_64 :: coverage_comments.cpp
  Profile-x86_64 :: coverage_emptylines.cpp
  Profile-x86_64 :: gcc-flag-compatibility.test
  Profile-x86_64 :: infinite_loop.c
  Profile-x86_64 :: instrprof-api.c
  Profile-x86_64 :: instrprof-basic.c
  Profile-x86_64 :: instrprof-binary-correlate.c
  Profile-x86_64 :: instrprof-block-coverage.c
  Profile-x86_64 :: instrprof-bufferio.c
  Profile-x86_64 :: instrprof-dump.c
  Profile-x86_64 :: instrprof-entry-coverage.c
  Profile-x86_64 :: instrprof-error.c
  Profile-x86_64 :: instrprof-get-filename.c
  Profile-x86_64 :: instrprof-groups.c
  Profile-x86_64 :: instrprof-merge-empty-data.test
  Profile-x86_64 :: instrprof-merge-error.c
  Profile-x86_64 :: instrprof-no-mmap-during-merging.c
  Profile-x86_64 :: instrprof-override-filename-then-reset-default.c
  Profile-x86_64 :: instrprof-override-filename-with-env.c
  Profile-x86_64 :: instrprof-override-filename.c
  Profile-x86_64 :: instrprof-path.c
  Profile-x86_64 :: instrprof-reset-counters.c
  Profile-x86_64 :: instrprof-set-file-object-merging.c
  Profile-x86_64 :: instrprof-set-file-object.c
  Profile-x86_64 :: instrprof-set-filename-then-reset-default.c
  Profile-x86_64 :: instrprof-set-filename.c
  Profile-x86_64 :: instrprof-timestamp.c
  Profile-x86_64 :: instrprof-tmpdir.c
  Profile-x86_64 :: instrprof-value-prof-2.c
  Profile-x86_64 :: instrprof-value-prof-evict.test
  Profile-x86_64 :: instrprof-value-prof-reset.c
  Profile-x86_64 :: instrprof-value-prof.c
  Profile-x86_64 :: instrprof-value-prof.test
  Profile-x86_64 :: instrprof-version-mismatch.c
  Profile-x86_64 :: instrprof-write-file-atexit-explicitly.c
  Profile-x86_64 :: instrprof-write-file-only.c
  Profile-x86_64 :: instrprof-write-file.c
  Profile-x86_64 :: runtime_infinite.c


Testing Time: 5.41s

Total Discovered Tests: 405
  Unsupported      : 224 (55.31%)
  Passed           : 135 (33.33%)
  Expectedly Failed:   4 (0.99%)
  Failed           :  42 (10.37%)
```

https://github.com/llvm/llvm-project/pull/200111


More information about the llvm-commits mailing list