Undefined symbols when using ThinLTO + cs-profile-generate
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This is my simple compile script. CC is clang-cl.exe, LD is lld-link.exe and PROFILE is the path to clang_rt.profile.lib
```
%CC% /c /Fotest_pgo.obj -fprofile-generate=pgo.profraw -flto=thin test.cpp
%LD% /out:test_pgo.exe test_pgo.obj %PROFILE%
.\test_pgo.exe
%PD% merge -o default.prof pgo.profraw
%CC% /c /Fotest.obj -fcs-profile-generate -fprofile-use=default.prof -flto=thin test.cpp
%LD% /out:test.exe test.obj %PROFILE% /lto-cs-profile-generate
```
This leads to the following error:
```
lld-link: error: undefined symbol: __llvm_profile_counter_bias
>>> referenced by clang_rt.profile.lib(InstrProfilingFile.c.obj):(mmapForContinuousMode)
```
In another project I also see that `__llvm_profile_filename` is undefined.
I tired to define these in the source but it doesn't seem to make a difference.
Anyone using CS PGO on Windows? @zmodem @teresajohnson
Contributor guide
Research direction
Reproduce the Windows commands using clang-cl.exe, lld-link.exe, test.cpp, and clang_rt.profile.lib, including ThinLTO and /lto-cs-profile-generate. Start with the reported undefined symbols __llvm_profile_counter_bias and __llvm_profile_filename; done means the CS PGO build links successfully and the resulting executable can run through the profiling and merge steps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100