[llvm] [llvm-profgen] Support COFF binary (PR #83972)
Haohai Wen via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 21:57:26 PST 2024
================
----------------
HaohaiWen wrote:
I deleted the pdb file. It's safe without it.
The Symbolizer code I modified is still well tested by this lit test.
This patch make Symbolizer prefer using DWARF if it exists even if exe indicates there's PDB. We can't get mangled name from PDB so that using PDB to symbolize is meaningless for PGO (see changes https://github.com/llvm/llvm-project/pull/83972/commits/028e2476ab46af2af69576d3b8e8be493cf8a0f7).
`clang-cl.exe -O2 -gdwarf -gline-tables-only coff-profile.cpp -fuse-ld=lld -Xclang -fdebug-info-for-profiling -link -debug:dwarf`
One thing need to note is that although I had specified -debug:dwarf to lld, PDB file was still generated since clang driver inserted -debug prior to -debug:dwarf to lld linker. Therefore the coff-profile.exe contains both dwarf sections and path to PDB. This is very important to test our Symbolizer code otherwise Symbolizer will find there's no PDB binding to exe and will directly use DWARF.
If we delete the code which prefer using DWARF. The test will failed:
`llvm-profgen: error: E:\haohaiwe\compilers\llvm-project\llvm\test\tools\llvm-profgen/Inputs/coff-profile.exe: no such file or directory
`
The error message reports the exe file path and looks oddly. I've checked the code, the real reason is there's no PDB file.
https://github.com/llvm/llvm-project/pull/83972
More information about the llvm-commits
mailing list