[clang] [lld] [llvm] [Windows] Add support for emitting PGO/LTO magic strings in the Windows PE debug directory (PR #114260)

Mikołaj Piróg via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 31 05:05:33 PDT 2024


================
@@ -1165,6 +1188,23 @@ void Writer::createMiscChunks() {
   llvm::TimeTraceScope timeScope("Misc chunks");
   Configuration *config = &ctx.config;
 
+  auto searchForPgoMagicSection = [this](char sectionName[]) {
----------------
mikolaj-pirog wrote:

I haven't measured that yet. I was thinking of other solutions to this, but this is the best I came up with. The fundamental problem is that the lld linker has to know about pgu/pgi -- to do that I pass this info by creating special sections in the COFF object files, and later look for them in the linking phase. The other option is creating a new flag and pass it down to the linker, but that is also far from ideal. I was hoping to maybe put some flag in some header in the COFF file, I think COFF doesn't support that. As such, I opted for the creating-and-later-looking-for section approach 

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


More information about the cfe-commits mailing list