[PATCH] Remove getRelocationAddress
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Wed Apr 24 10:28:02 PDT 2013
Hi Bigcheese,
There is no such thing as a relocation address in relocatable files (.o). In all 3 supported file formats what there is is a relocation offset from the beginning of the section (with a possible arbitrary delta added on COFF that is recommended to always be 0).
Given the lack of a proper definition, the implementations were different for different formats.
COFF: same as offset.
MachO: Offest + virtual address of the section.
ELF: The address was the offset (r_offset) and getRelocationOffset was returning the offset minus the section virtual address.
We could have a getRelocationAddress that asserts that it is given non-relocatable object (i.e., not a .o), but for now it is probably best to just remove it.
The attached patch passes all tests and I checked that the values llvm-readobj prints match the ones printed by the native tools otool (macho) and readelf.
http://llvm-reviews.chandlerc.com/D721
Files:
bindings/python/llvm/object.py
include/llvm-c/Object.h
include/llvm/Object/COFF.h
include/llvm/Object/ELF.h
include/llvm/Object/MachO.h
include/llvm/Object/ObjectFile.h
include/llvm/Object/RelocVisitor.h
lib/DebugInfo/DWARFContext.cpp
lib/Object/COFFObjectFile.cpp
lib/Object/MachOObjectFile.cpp
lib/Object/Object.cpp
tools/llvm-objdump/MachODump.cpp
tools/llvm-objdump/llvm-objdump.cpp
tools/llvm-readobj/llvm-readobj.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D721.1.patch
Type: text/x-patch
Size: 11459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130424/760f4fae/attachment.bin>
More information about the llvm-commits
mailing list