Colin LeMahieu via llvm-dev
2016-Mar-24 17:14 UTC
[llvm-dev] [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.
While trying to fix a bug where llvm-objdump isn't printing relocations retained with ld -emit-relocs in shared object or executables, it seems like there isn't a way to split printing dynamic relocations from non-dynamic relocations as with GNU objdump -r and -R. I was thinking of adding a function RelocationRef::isDynamic() and filtering them this way when printing. Since RelocationRef covers ELF/COFF/MachO we would need reasonable behaviors for each platform. Does this seem like a good approach and does anyone have input on how this function should behave on COFF/MachO? -----Original Message----- From: Rafael EspĂndola [mailto:rafael.espindola at gmail.com] Sent: Tuesday, March 22, 2016 10:42 AM To: Colin LeMahieu <colinl at codeaurora.org> Cc: llvm-commits <llvm-commits at lists.llvm.org> Subject: Re: [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. 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. Cheers, Rafael
Apparently Analagous Threads
- [PATCH] D15965: Add support for dumping relocations in non-relocatable files
- [LLVMdev] Moving towards a singular pointer type
- Re: How to use unicorn server on Rails 3 [Solved]
- Problem using rvm in bash script
- Bundler - how to re-install all gems after os update?