[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
Mon Nov 4 01:49:47 PST 2024


================
@@ -1165,6 +1188,23 @@ void Writer::createMiscChunks() {
   llvm::TimeTraceScope timeScope("Misc chunks");
   Configuration *config = &ctx.config;
 
+  auto searchForPgoMagicSection = [this](char sectionName[]) {
+    for (auto *obj : ctx.objFileInstances) {
+      for (auto &chunk : obj->getChunks()) {
+        if (chunk->kind() == Chunk::SectionKind &&
+            chunk->getSectionName() == sectionName) {
+          return true;
+        }
+      }
+    }
+    return false;
+  };
----------------
mikolaj-pirog wrote:

I don't see how this content is guaranteed to be folded into the debug data directory. I can create a debug dir entry in the COFF with COMDAT, and this will be folded, but then I still have to adjust pointers in the optional header `Debug` field to point to debug dir, and to specific entries in the debug dir `AddressOfRawData` field. This has to be done during the linking phase, because this structures don't exist in the COFF files

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


More information about the cfe-commits mailing list