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

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 3 21:42:13 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;
+  };
----------------
compnerd wrote:

Hmm, my thinking was that if we have content that is guaranteed to be folded into the debug data directory, the directory will be emitted. As such, the linker will link the directory in the header and emit that. This would avoid the need to iterate all the sections, it would simply force the emission of the debug directory without `/debug` being passed.

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


More information about the cfe-commits mailing list