[PATCH] D24636: llvm-objdump Allow disassembly of ARM and thumb code mix in ELF object file.

khemant@codeaurora.org via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 15 15:08:36 PDT 2016


khemant created this revision.
khemant added reviewers: echristo, compnerd, rafael.
khemant added subscribers: echristo, compnerd, rafael, llvm-commits.
khemant set the repository for this revision to rL LLVM.
Herald added subscribers: samparker, mehdi_amini, rengolin, aemerson.

This is a patch that tries to enable something that is not usually possible in present design. If the patch looks a little weird bear with me. I want ideas on this issue and any workable solutions if any.

 llvm-objdump with no triple or mcpu tries to infer the architecture based on
    the details present in file. This works on most architectures and file formats
    except ET_ARM type object type. The presence of thumb if any is not indicated
    anywhere except in .ARM.attributes and using mapping symbols $t.* Also not all
    architectures have all instructions available. This makes the disassembly of ARM
    ELF full linked image that has thumb and ARM mix  virtually useless.

    The objdump in its present state  has only one disassembler and hence cannot
    make use of the above information. This commit will crack open the ELF binary if
    it is ET_ARM type and try to see CPU name and if it is thumb only processor.

    The tool will create a second disassembler for ARM ELF and try using that if the
    first one fails. The change also makes use of mapping symbols $a, $t. The
    mapping symbols will determine which disassembler should be used. This makes
    usage more user friendly as the CPU no longer needs to be explicit if the
    attributes are present in the file. If the attributes are not present, the usage
    remains the old way (using -mcpu and -triple options).


Repository:
  rL LLVM

https://reviews.llvm.org/D24636

Files:
  test/tools/llvm-objdump/ARM/Inputs/arm-thumb-mix.elf-arm
  test/tools/llvm-objdump/ARM/disassemble-arm-thumb-elf-mix.test
  tools/llvm-objdump/llvm-objdump.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24636.71565.patch
Type: text/x-patch
Size: 20006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160915/d7860cfd/attachment-0001.bin>


More information about the llvm-commits mailing list