[PATCH] Make it easier to use DwarfContext with MCJIT and add RelocVisitor support for Darwin

Keno Fischer kfischer at college.harvard.edu
Tue Jan 13 16:15:12 PST 2015


Hi lhames, echristo,

This supersedes http://reviews.llvm.org/D4010, hopefully properly dealing with the JIT case and also adds an actual test case. DwarfContext was basically already usable for the JIT (and back when we were overwriting ELF files it actually worked out of the box by accident), but in order to resolve relocations correctly it needs to know the load address of the section. Rather than trying to get this out of the ObjectFile or requiring the user to create a new ObjectFile just to get some debug info, this adds the capability to pass in that info directly. As part of this I separated out part of the LoadedObjectInfo struct from RuntimeDyld, since it is now required add a higher layer. For now I put that in ObjectFile.h, but I would be happy to receive suggestions for more appropriate places.

I also adjusted the line info handling in the dwarf code slightly, based on a problem I saw with the test case. Since addr+size will give the first address past the end of the function, we need to back up one line table entry. However, if we are doing the comparison with `<` rather than `<=`, we actually end up with the second entry past the end of the current function, if the next function starts at exactly addr+size (the first entry for the next function is at addr+size, so the next entry greater than it is the second entry for the next function). This comes up on MachO much more than on ELF, since MachO doesn't store the symbol size separately, hence making said situation always occur.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6961

Files:
  include/llvm/DebugInfo/DIContext.h
  include/llvm/DebugInfo/DWARFContext.h
  include/llvm/DebugInfo/DWARFDebugLine.h
  include/llvm/ExecutionEngine/RuntimeDyld.h
  include/llvm/Object/COFF.h
  include/llvm/Object/ELFObjectFile.h
  include/llvm/Object/MachO.h
  include/llvm/Object/ObjectFile.h
  include/llvm/Object/RelocVisitor.h
  lib/DebugInfo/DIContext.cpp
  lib/DebugInfo/DWARFContext.cpp
  lib/DebugInfo/DWARFDebugLine.cpp
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
  lib/Object/COFFObjectFile.cpp
  lib/Object/MachOObjectFile.cpp
  lib/Object/ObjectFile.cpp
  test/DebugInfo/debuglineinfo.test
  tools/llvm-objdump/MachODump.cpp
  tools/llvm-rtdyld/llvm-rtdyld.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6961.18120.patch
Type: text/x-patch
Size: 23868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150114/1eb1689c/attachment.bin>


More information about the llvm-commits mailing list