[PATCH] Remove getRelocationAddress

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Apr 24 13:16:49 PDT 2013


On 24 April 2013 15:08, Eric Christopher <echristo at gmail.com> wrote:
> Yeah. I rather like getRelocationAddress as the spelling for that if
> that's what it does.
>
> On Wed, Apr 24, 2013 at 8:06 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
>>
>>   So this means getOffset now returns the full address of the relocation in executable files?

On ELF it does, given how r_offset is defined. In fact, with this
change llvm-readobj -r now prints the same offset values for
executables as readelf -r. I will add a test with that.

If we want a getRelocationAddress, for ELF it could just check that it
is not called on a relocatable object and just forward the call.

For COFF I am not sure if a getRelocationAddress would make sense,
since it has a different representation (.reloc section).

Looks like MachO would be the one with an non trivial
getRelocationAddress. The documentation says of r_address:

In images used by the dynamic linker, this is an offset from the
virtual memory address of the data of the first segment_command that
appears in the file (not necessarily the one with the lowest address).
For images with the MH_SPLIT_SEGS flag set, this is an offset from the
virtual memory address of data of the first read/write
segment_command.

Cheers,
Rafael



More information about the llvm-commits mailing list