[clang] [llvm] [X86][COFF] Enable basic-block-address-map emission (PR #191347)
Haohai Wen via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 21 03:04:13 PDT 2026
================
@@ -1266,23 +1266,42 @@ MCObjectFileInfo::getStackSizesSection(const MCSection &TextSec) const {
MCSection *
MCObjectFileInfo::getBBAddrMapSection(const MCSection &TextSec) const {
- if (Ctx->getObjectFileType() != MCContext::IsELF)
- return nullptr;
+ constexpr StringLiteral Name = ".llvm_bb_addr_map";
+ if (Ctx->getObjectFileType() == MCContext::IsELF) {
+ const MCSectionELF &ElfSec = static_cast<const MCSectionELF &>(TextSec);
+ unsigned Flags = ELF::SHF_LINK_ORDER;
+ StringRef GroupName;
+ if (const MCSymbol *Group = ElfSec.getGroup()) {
+ GroupName = Group->getName();
+ Flags |= ELF::SHF_GROUP;
+ }
- const MCSectionELF &ElfSec = static_cast<const MCSectionELF &>(TextSec);
- unsigned Flags = ELF::SHF_LINK_ORDER;
- StringRef GroupName;
- if (const MCSymbol *Group = ElfSec.getGroup()) {
- GroupName = Group->getName();
- Flags |= ELF::SHF_GROUP;
+ // Use the text section's begin symbol and unique ID to create a separate
+ // .llvm_bb_addr_map section associated with every unique text section.
+ return Ctx->getELFSection(
+ Name, ELF::SHT_LLVM_BB_ADDR_MAP, Flags, 0, GroupName, true,
+ ElfSec.getUniqueID(),
+ static_cast<const MCSymbolELF *>(TextSec.getBeginSymbol()));
+ } else if (Ctx->getObjectFileType() == MCContext::IsCOFF) {
+ StringRef COMDATSymName = "";
----------------
HaohaiWen wrote:
Done
https://github.com/llvm/llvm-project/pull/191347
More information about the cfe-commits
mailing list