[PATCH] D102296: [ELF] getRelocatedSection: remove the check for ET_REL object file

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 26 14:37:15 PDT 2021


ayermolo added a comment.

In D102296#2782996 <https://reviews.llvm.org/D102296#2782996>, @dblaikie wrote:

> In D102296#2782398 <https://reviews.llvm.org/D102296#2782398>, @Amir wrote:
>
>> @jhenderson, @dblaikie: BOLT recreates relocations implicitly as it uses MCStreamer for code emission. We don't reapply existing relocations from the binary. I should have pointed out that BOLT performs not just function reordering (where reapplying relocations might make sense), but rather full binary rewrite: splits text into hot and cold sections, splits functions, reorders basic blocks, reorders functions, applies PLT optimizations, and so on. Hope that makes it clear.
>
> "recreates relocations" - I'm not sure what that means, could you help me understand?
>
> The important thing, I think, is (can you confirm this, please) - static relocations in a linked binary do not need to be reapplied by the DWARF parser when reading the binary, right? They should be ignored. Presumably there's /some/ property of the binary that makes it clear that these are static relocations, already applied by the linker (or any post-link rewriting tool like BOLT) and should be ignored. The DWARF parser is making the mistake that their presence means they should be applied, when it should be checking some other property/feature to determine if they should be applied?

I think implicit assumption that unless binary is relocatable the assumption is relocations have been applied by the linker.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102296/new/

https://reviews.llvm.org/D102296



More information about the llvm-commits mailing list