Initial comdat implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118805 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2010-11-11 18:13:52 +00:00
parent 56653f0df8
commit 2ff9e83a82
8 changed files with 213 additions and 38 deletions

View File

@ -150,7 +150,13 @@ getMachOSection(StringRef Segment, StringRef Section,
const MCSectionELF *MCContext::
getELFSection(StringRef Section, unsigned Type, unsigned Flags,
SectionKind Kind, unsigned EntrySize) {
SectionKind Kind) {
return getELFSection(Section, Type, Flags, Kind, 0, "");
}
const MCSectionELF *MCContext::
getELFSection(StringRef Section, unsigned Type, unsigned Flags,
SectionKind Kind, unsigned EntrySize, StringRef Group) {
if (ELFUniquingMap == 0)
ELFUniquingMap = new ELFUniqueMapTy();
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
@ -163,12 +169,24 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
if (!EntrySize) {
EntrySize = MCSectionELF::DetermineEntrySize(Kind);
}
MCSymbol *GroupSym = NULL;
if (!Group.empty())
GroupSym = GetOrCreateSymbol(Group);
MCSectionELF *Result = new (*this) MCSectionELF(Entry.getKey(), Type, Flags,
Kind, EntrySize);
Kind, EntrySize, GroupSym);
Entry.setValue(Result);
return Result;
}
const MCSectionELF *MCContext::CreateELFGroupSection() {
MCSectionELF *Result =
new (*this) MCSectionELF(".group", MCSectionELF::SHT_GROUP, 0,
SectionKind::getReadOnly(), 4, NULL);
return Result;
}
const MCSection *MCContext::getCOFFSection(StringRef Section,
unsigned Characteristics,
int Selection,