<p dir="ltr"><br>
On Mar 24, 2016 4:08 PM, "Colin LeMahieu" <<a href="mailto:colinl@codeaurora.org">colinl@codeaurora.org</a>> wrote:<br>
><br>
> llvm-objdump wants to print the relocationOffset, so it calls RelocationRef::relocationOffset which calls ELFObjectFile::getRelocationOffset<br>
><br>
> Since objdump wants the relocation offset, and this pipes down to ELFObjectFile::getRelocationOffset, at what point is the address supposed to be asked for?<br>
></p>
<p dir="ltr">In llvm-objdump. It can then search the sections to see if one happens to include that address.<br></p>
<p dir="ltr">> -----Original Message-----<br>
> From: Rafael Espíndola [mailto:<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>]<br>
> Sent: Thursday, March 24, 2016 2:45 PM<br>
> To: <a href="mailto:reviews%2BD15965%2Bpublic%2B319b19c852e3c4e3@reviews.llvm.org">reviews+D15965+public+319b19c852e3c4e3@reviews.llvm.org</a><br>
> Cc: <a href="mailto:colinl@codeaurora.org">colinl@codeaurora.org</a>; Hemant Kulkarni <<a href="mailto:khemant@codeaurora.org">khemant@codeaurora.org</a>>; Shankar Easwaran <<a href="mailto:shankare@codeaurora.org">shankare@codeaurora.org</a>>; llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>><br>
> Subject: Re: [PATCH] D15965: Add support for dumping relocations in non-relocatable files<br>
><br>
> On 24 March 2016 at 15:35, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org">shankare@codeaurora.org</a>> wrote:<br>
> > shankare added a reviewer: shankare.<br>
> > shankare added a comment.<br>
> ><br>
> > <a href="http://www.sco.com/developers/gabi/latest/ch4.reloc.html">http://www.sco.com/developers/gabi/latest/ch4.reloc.html</a><br>
> ><br>
> >   r_offset<br>
> >   This member gives the location at which to apply the relocation action. For a relocatable file, the value is the byte offset from the beginning of the section to the storage unit affected by the relocation. For an executable file or a shared object, the value is the virtual address of the storage unit affected by the relocation.<br>
> ><br>
> > This shows that the assertion is incorrect, as the ELF ABI suggests reading relocation records is valid in Executables as well.<br>
> ><br>
> > While relocation offset is not looked up for shared libraries from<br>
> > .rela.dyn and .rela.plt sections, there is a usecase where relocation<br>
> > sections are generated with the linker switch **--emit-relocs**<br>
><br>
> And those records have addresses, not offsets. Therefore the assertion is correct and you may *NOT* remove it.<br>
><br>
> CHeers,<br>
> Rafael<br>
><br>
</p>