aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-08-17 17:56:13 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-08-17 17:56:13 +0000
commit53237b1027420591c676a1bc3ed89b15c19b4e2f (patch)
treeab1dad84ed0d75da0a6ccc8642f35d896253a169
parent064eff7d5699a0dbdeeece5a36a601f673662f55 (diff)
downloadexternal_llvm-53237b1027420591c676a1bc3ed89b15c19b4e2f.zip
external_llvm-53237b1027420591c676a1bc3ed89b15c19b4e2f.tar.gz
external_llvm-53237b1027420591c676a1bc3ed89b15c19b4e2f.tar.bz2
Use the correct entry size for relocation entries, from Roman Divacky.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111259 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/MC/ELFObjectWriter.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index 9b399eb..23c2dd5 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/lib/MC/ELFObjectWriter.cpp
@@ -748,9 +748,13 @@ void ELFObjectWriterImpl::WriteRelocation(MCAssembler &Asm, MCAsmLayout &Layout,
const StringRef SectionName = Section.getSectionName();
std::string RelaSectionName = HasRelocationAddend ? ".rela" : ".rel";
-
RelaSectionName += SectionName;
- unsigned EntrySize = Is64Bit ? ELF::SYMENTRY_SIZE64 : ELF::SYMENTRY_SIZE32;
+
+ unsigned EntrySize;
+ if (HasRelocationAddend)
+ EntrySize = Is64Bit ? sizeof(ELF::Elf64_Rela) : sizeof(ELF::Elf32_Rela);
+ else
+ EntrySize = Is64Bit ? sizeof(ELF::Elf64_Rel) : sizeof(ELF::Elf32_Rel);
RelaSection = Ctx.getELFSection(RelaSectionName, HasRelocationAddend ?
ELF::SHT_RELA : ELF::SHT_REL, 0,