[PATCH] D36279: [Object] Fix ELFObjectFile<ELFT>::getRelocationOffset
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 3 12:24:44 PDT 2017
alexshap created this revision.
The assert in ELFObjectFile<ELFT>::getRelocationOffset appears to be incorrect.
For example, dynamic libraries have e_type set to ET_DYN and contain relocations at the same time.
The same issue might arise for some executables (e_type set to ET_EXEC).
Repository:
rL LLVM
https://reviews.llvm.org/D36279
Files:
ELFObjectFile.h
Index: ELFObjectFile.h
===================================================================
--- ELFObjectFile.h
+++ ELFObjectFile.h
@@ -781,12 +781,9 @@
template <class ELFT>
uint64_t ELFObjectFile<ELFT>::getRelocationOffset(DataRefImpl Rel) const {
- assert(EF.getHeader()->e_type == ELF::ET_REL &&
- "Only relocatable object files have relocation offsets");
const Elf_Shdr *sec = getRelSection(Rel);
if (sec->sh_type == ELF::SHT_REL)
return getRel(Rel)->r_offset;
-
return getRela(Rel)->r_offset;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36279.109614.patch
Type: text/x-patch
Size: 530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170803/cddb571a/attachment.bin>
More information about the llvm-commits
mailing list