[PATCH] D36279: [Object] Fix ELFObjectFile<ELFT>::getRelocationOffset

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 12:37:42 PDT 2017


Test case?

On Thu, Aug 3, 2017 at 12:24 PM Alexander Shaposhnikov via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170803/700b20c4/attachment.html>


More information about the llvm-commits mailing list