summaryrefslogtreecommitdiff
path: root/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-11 18:13:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-11 18:13:52 +0000
commit2ff9e83a826c1c2ee0f1c6072d3d97d5b10678ee (patch)
tree7b0da82eca52b236bf7259f9d451dde58a1f7689 /lib/MC/MCContext.cpp
parent56653f0df85f8e4ee60941a6ca31c17ca6f936ff (diff)
downloadllvm-2ff9e83a826c1c2ee0f1c6072d3d97d5b10678ee.tar.gz
llvm-2ff9e83a826c1c2ee0f1c6072d3d97d5b10678ee.tar.bz2
llvm-2ff9e83a826c1c2ee0f1c6072d3d97d5b10678ee.tar.xz
Initial comdat implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCContext.cpp')
-rw-r--r--lib/MC/MCContext.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index bafa10a174..311f383a3a 100644
--- a/lib/MC/MCContext.cpp
+++ b/lib/MC/MCContext.cpp
@@ -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,