[llvm-dev] [PATCH] D15965: Add support for dumping relocations in non-relocatable files

Rafael Espíndola via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 28 10:25:37 PDT 2016


On 24 March 2016 at 16:35, Colin LeMahieu <colinl at codeaurora.org> wrote:
> It sounds like what you’re asking is, rather that universally calling
> RelocationRef::getOffset inside llvm-objdump.cpp
>
> I should:
>
> ·        Check if Obj “isRelocatableObject”
>
> ·        If it is, call RelocationRef::getOffset()
>
> ·        If it isn’t
>
> o   Call RelocationRef::getAddress()
>
> o   Build an ordered map of all sections and their bounds, check if the
> relocation lands within a section
>
> o   Subtract the section address from the relocation address
>

That is the overall structure, yes. You do have to handle the case of
there being no section that covers the address.

I will take a look at the updated patch.

Cheers,
Rafael


More information about the llvm-dev mailing list