[PATCH] Change getRelocationAdditionalInfo to be ELF only and rename to getRelocationAddend.

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Thu May 2 12:34:52 PDT 2013


Hi Bigcheese,

Some peculiarities of each object format I don't think we should try to abstract. In the case of MachO, there are scattered relocations. In the case of ELF, there is the explicit addend.

Anything looking for the addend knows it is looking at an ELF file. This patch then removes the virtual getRelocationAdditionalInfo and replaces it with a ELF only getRelocationAddend. Templated code can now avoid the virtual call. For non templeted code there a convenience getELFRelocationAddend function.

Some of the problems of having getRelocationAdditionalInfo include
* MachO used to have a completely bogus implementation. Someone implementing it thought the "additional info" was something else.
* llvm-readobj currently print an "info" field for relocations, which is extremely confusing, since it is printing r_addend, not r_info :-)


http://llvm-reviews.chandlerc.com/D735

Files:
  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/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
  lib/Object/COFFObjectFile.cpp
  lib/Object/MachOObjectFile.cpp
  test/Object/relocation-executable.test
  tools/llvm-readobj/ELFDumper.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D735.1.patch
Type: text/x-patch
Size: 14386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130502/1c8772b7/attachment.bin>


More information about the llvm-commits mailing list