It sounds like what you’re asking is, rather that universally calling RelocationRef::getOffset inside llvm-objdump.cpp
· 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
Since getAddress isn’t in RelocationRef at the moment, this is going to have to be getAddress for MachO and COFF.
COFFObjectFile::getRelocationOffset returns R->VirtualAddress, so inside here I’m going to have to find the section it belongs to, add it to the result so it can later be subtracted off by llvm-objdump
MachOObjectFile::getRelocationOffset also returns getAnyRelocationAddress so I’ll have to also find its containing section and add this in just so llvm-objdump can later subtract it.
Can you detail why this is a better plan?