diff options
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCObjectFileInfo.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/MC/MCObjectFileInfo.cpp b/lib/MC/MCObjectFileInfo.cpp index b075f225ed2..2b5c9c7762b 100644 --- a/lib/MC/MCObjectFileInfo.cpp +++ b/lib/MC/MCObjectFileInfo.cpp @@ -948,3 +948,24 @@ MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const { return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP, 0, utostr(Hash)); } + +MCSection * +MCObjectFileInfo::getStackSizesSection(const MCSection &TextSec) const { + if (Env != IsELF) + return StackSizesSection; + + 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 MCSymbol *Link = TextSec.getBeginSymbol(); + auto It = StackSizesUniquing.insert({Link, StackSizesUniquing.size()}); + unsigned UniqueID = It.first->second; + + return Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, Flags, 0, + GroupName, UniqueID, cast<MCSymbolELF>(Link)); +} |