[llvm] r263971 - [llvm-objdump] Printing relocations in executable and shared object files. This partially reverts r215844 by removing test objdump-reloc-shared.test which stated GNU objdump doesn't print relocations, it does.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 08:41:37 PDT 2016

On 22 March 2016 at 11:36, Colin LeMahieu <colinl at codeaurora.org> wrote:
> Thanks for the prompt reply and test case, I'll make sure this is considered.
> Admittedly I know less about the ELF spec than you do; I appreciate the patience while I try to contribute a fix for the incorrect logic in llvm-objdump and the ELFObjectFile.h that assumes relocations don't exist in executable or shared object files.
> If you have suggestions that could prevent future issues I appreciate the feedback.

The main one is: the assert is correct. Asking for the offset in a .so
file is a bug in whatever is asking. If a tool wants to know the
offset of a relocation in a section (objdump does), it needs to

* Find out if there is a section table at all, it is valid to omit it.
* Build a map of addresses to sections.
* Look up the address of a given relocation.
* Have a reasonable error/degradation if any of the above fails.


More information about the llvm-commits mailing list