Eric Christopher
2014-Aug-09 00:56 UTC
[LLVMdev] Looking for ideas on how to make llvm-objdump handle both arm and thumb disassembly from the same object file
On Thu, Aug 7, 2014 at 7:09 AM, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:>> The implementation of llvm-objdump does have a MachODump.cpp for use with the -m option that I could do the a similar hack otool(1) like hack and special case 32-bit ARM cpus. And at least it contains the ugliness. But this does not really help the non -m case and I suspect ELF objects may face a similar problem. > > My gut feeling would be to do this first and keep an eye for how to > refactor it when we want to add support for ELF or for things like > mips16. > > CCing Eric since he is now the expert on the target/subtarget relationship. >Sure. Probably the easiest way would be to take all of the disparate classes and throw them under the MCSubtargetInfo as best as can be done, then you can just create a single object for each target you want to disassemble for in the binary. arm/thumb mips/mips16 might be a bit more difficult as you'll need to swap on a function by function basis, but as long as you've got an index of subtargets to handle disassembly it should be possible. Right now the arm/thumb interface is a bit wonky there, but I think mips/mips16 should work - at least it does for code generation, I haven't looked heavily at the disassembler in a while. If you're interested in going down this path though I'll give it some thought and see what I can do. -eric
James Courtier-Dutton
2014-Aug-09 05:02 UTC
[LLVMdev] Looking for ideas on how to make llvm-objdump handle both arm and thumb disassembly from the same object file
Wouldn't you hit a similar problem in x86 if you were disassembling a section on code that switched from 16 bit real mode to 32 bit or 64 bit mode? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140809/cb1f363d/attachment.html>
Eric Christopher
2014-Aug-09 05:04 UTC
[LLVMdev] Looking for ideas on how to make llvm-objdump handle both arm and thumb disassembly from the same object file
Good possibility. -eric On Fri, Aug 8, 2014 at 10:02 PM, James Courtier-Dutton <james.dutton at gmail.com> wrote:> Wouldn't you hit a similar problem in x86 if you were disassembling a > section on code that switched from 16 bit real mode to 32 bit or 64 bit > mode?