diff options
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectFileInfo.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index c910bd8..d3b9fa45 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -1165,18 +1165,20 @@ MCObjectFileInfo::getKCFITrapSection(const MCSection &TextSec) const { MCSection * MCObjectFileInfo::getPseudoProbeSection(const MCSection &TextSec) const { - if (Ctx->getObjectFileType() == MCContext::IsELF) { - const auto &ElfSec = static_cast<const MCSectionELF &>(TextSec); - // Create a separate section for probes that comes with a comdat function. - if (const MCSymbol *Group = ElfSec.getGroup()) { - auto *S = static_cast<MCSectionELF *>(PseudoProbeSection); - auto Flags = S->getFlags() | ELF::SHF_GROUP; - return Ctx->getELFSection(S->getName(), S->getType(), Flags, - S->getEntrySize(), Group->getName(), - /*IsComdat=*/true); - } + if (Ctx->getObjectFileType() != MCContext::IsELF) + return PseudoProbeSection; + + const auto &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; } - return PseudoProbeSection; + + return Ctx->getELFSection(PseudoProbeSection->getName(), ELF::SHT_PROGBITS, + Flags, 0, GroupName, true, ElfSec.getUniqueID(), + cast<MCSymbolELF>(TextSec.getBeginSymbol())); } MCSection * |