From 63b2f8c710ec42aa5304cbe8a5e8013e3ac66b8e Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Thu, 13 Oct 2011 22:30:10 +0000 Subject: ELF: Fix the section that relocations apply to. Add test to verify. Patch by Danil Malyshev! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141901 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Object/ELFObjectFile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/Object') diff --git a/lib/Object/ELFObjectFile.cpp b/lib/Object/ELFObjectFile.cpp index f30d6a0369..257d08cadf 100644 --- a/lib/Object/ELFObjectFile.cpp +++ b/lib/Object/ELFObjectFile.cpp @@ -762,7 +762,7 @@ relocation_iterator ELFObjectFile const Elf_Shdr *sec = reinterpret_cast(Sec.p); typename RelocMap_t::const_iterator ittr = SectionRelocMap.find(sec); if (sec != 0 && ittr != SectionRelocMap.end()) { - RelData.w.a = getSection(ittr->second[0])->sh_link; + RelData.w.a = getSection(ittr->second[0])->sh_info; RelData.w.b = ittr->second[0]; RelData.w.c = 0; } @@ -780,7 +780,7 @@ relocation_iterator ELFObjectFile // Get the index of the last relocation section for this section. std::size_t relocsecindex = ittr->second[ittr->second.size() - 1]; const Elf_Shdr *relocsec = getSection(relocsecindex); - RelData.w.a = relocsec->sh_link; + RelData.w.a = relocsec->sh_info; RelData.w.b = relocsecindex; RelData.w.c = relocsec->sh_size / relocsec->sh_entsize; } @@ -1114,7 +1114,7 @@ ELFObjectFile::ELFObjectFile(MemoryBuffer *Object SymbolTableSections.push_back(sh); } if (sh->sh_type == ELF::SHT_REL || sh->sh_type == ELF::SHT_RELA) { - SectionRelocMap[getSection(sh->sh_link)].push_back(i); + SectionRelocMap[getSection(sh->sh_info)].push_back(i); } ++sh; } -- cgit v1.2.3