summaryrefslogtreecommitdiff
path: root/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorLogan Chien <tzuhsiang.chien@gmail.com>2013-02-05 14:18:59 +0000
committerLogan Chien <tzuhsiang.chien@gmail.com>2013-02-05 14:18:59 +0000
commitb0c899666a6c5397cf35fffd0f8d93749cb2cb38 (patch)
tree51eb9239606199d36aed24bfc275cfca05b7b713 /lib/MC/ELFObjectWriter.cpp
parente2d5590c33f1b5203c0104c1c82bf8e0f28b828e (diff)
downloadllvm-b0c899666a6c5397cf35fffd0f8d93749cb2cb38.tar.gz
llvm-b0c899666a6c5397cf35fffd0f8d93749cb2cb38.tar.bz2
llvm-b0c899666a6c5397cf35fffd0f8d93749cb2cb38.tar.xz
Link .ARM.exidx with corresponding text section.
The sh_link in the ELF section header of .ARM.exidx should be filled with the section index of the corresponding text section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174372 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/ELFObjectWriter.cpp')
-rw-r--r--lib/MC/ELFObjectWriter.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index 8805773a3e..d65f22709e 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/lib/MC/ELFObjectWriter.cpp
@@ -1332,6 +1332,24 @@ void ELFObjectWriter::WriteSection(MCAssembler &Asm,
break;
}
+ if (TargetObjectWriter->getEMachine() == ELF::EM_ARM &&
+ Section.getType() == ELF::SHT_ARM_EXIDX) {
+ StringRef SecName(Section.getSectionName());
+ if (SecName == ".ARM.exidx") {
+ sh_link = SectionIndexMap.lookup(
+ Asm.getContext().getELFSection(".text",
+ ELF::SHT_PROGBITS,
+ ELF::SHF_EXECINSTR | ELF::SHF_ALLOC,
+ SectionKind::getText()));
+ } else if (SecName.startswith(".ARM.exidx")) {
+ sh_link = SectionIndexMap.lookup(
+ Asm.getContext().getELFSection(SecName.substr(sizeof(".ARM.exidx") - 1),
+ ELF::SHT_PROGBITS,
+ ELF::SHF_EXECINSTR | ELF::SHF_ALLOC,
+ SectionKind::getText()));
+ }
+ }
+
WriteSecHdrEntry(SectionStringTableIndex[&Section], Section.getType(),
Section.getFlags(), 0, Offset, Size, sh_link, sh_info,
Alignment, Section.getEntrySize());