summaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2013-07-10 20:58:17 +0000
committerTim Northover <tnorthover@apple.com>2013-07-10 20:58:17 +0000
commitf5b1c5043de4d485ff17d8b2aad709c63a5a9ff3 (patch)
tree024aea140d04106e1a9d725fdb1a6d2bb2ac15dd /lib/MC
parent75d13065fda4b470f272311520f5dfe6c11460ce (diff)
downloadllvm-f5b1c5043de4d485ff17d8b2aad709c63a5a9ff3.tar.gz
llvm-f5b1c5043de4d485ff17d8b2aad709c63a5a9ff3.tar.bz2
llvm-f5b1c5043de4d485ff17d8b2aad709c63a5a9ff3.tar.xz
Put ELF COMDAT relocations into the relevant COMDAT group.
Patch from Игорь Пашев (I do hope we support utf-8 commit messages; I also hope he'll forgive me for transliterating it as Igor Pashev in case things go horribly wrong). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/ELFObjectWriter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index 4f66156f6d..2db59acd50 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/lib/MC/ELFObjectWriter.cpp
@@ -1002,11 +1002,18 @@ void ELFObjectWriter::CreateRelocationSections(MCAssembler &Asm,
else
EntrySize = is64Bit() ? sizeof(ELF::Elf64_Rel) : sizeof(ELF::Elf32_Rel);
+ unsigned Flags = 0;
+ StringRef Group = "";
+ if (Section.getFlags() & ELF::SHF_GROUP) {
+ Flags = ELF::SHF_GROUP;
+ Group = Section.getGroup()->getName();
+ }
+
const MCSectionELF *RelaSection =
Ctx.getELFSection(RelaSectionName, hasRelocationAddend() ?
- ELF::SHT_RELA : ELF::SHT_REL, 0,
+ ELF::SHT_RELA : ELF::SHT_REL, Flags,
SectionKind::getReadOnly(),
- EntrySize, "");
+ EntrySize, Group);
RelMap[&Section] = RelaSection;
Asm.getOrCreateSectionData(*RelaSection);
}