[llvm] [yaml2obj][COFF] Add BBAddrMap support to yaml2coff (PR #224504)

Haohai Wen via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 03:51:21 PDT 2026


================
@@ -193,6 +193,22 @@ static bool writeSectionContent(COFFParser &CP, COFFYAML::Section &S,
   bool HasContent = S.SectionData.binary_size() != 0;
   for (const auto &E : S.StructuredData)
     HasContent |= E.size() != 0;
+  // Every BB address map entry encodes at least a version and a feature field.
+  if (S.BBAddrMapEntries && !S.BBAddrMapEntries->empty())
+    HasContent = true;
+
+  // Warn as ELF BBAddrMap does.
+  const std::vector<BBAddrMapYAML::PGOAnalysisMapEntry> *PGOAnalyses = nullptr;
+  if (S.PGOAnalyses) {
+    if (!S.BBAddrMapEntries)
+      WithColor::warning() << "PGOAnalyses should not exist in "
----------------
HaohaiWen wrote:

Yes, it is from ELFEmitter:
https://github.com/llvm/llvm-project/blob/7f133e72828d68cbd8ce06bf64ea0fe8b8528c06/llvm/lib/ObjectYAML/ELFEmitter.cpp#L1344-L1348

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


More information about the llvm-commits mailing list