[LLVMdev] llvm-objdump related patch

Michael Spencer bigcheesegs at gmail.com
Tue Oct 11 12:40:19 PDT 2011

On Tue, Oct 11, 2011 at 12:15 AM, Neo <smtian at ingenic.cn> wrote:
> Hi,
>    I am new to llvm, not familiar with c++, after some use with
> llvm-objdump, and finding the broken output, I try to debug and fix the code
> so it can become usable. Please help review the patch, so that they can be
> merged.
>    And there's still two major problem I have found about arm disassembler:
> 1. arm instruction decoder cannot recognise bx series instructions.
> 2. As gcc will generate thumb and arm instruction mixed binary, we have to
> switch from each other.
> we can tell if a function is thumb or arm code by looking at the symbol
> table entry, when in thumb code, the lowest bit of the symbol value will be
> set to '1'.
> so how these logic can be implemented while still adapt to the structure of
> the code?
> Songmao

For the first patch. The code is only valid for executable files, not
relocatable files. st_shndx should be used to determine if the symbol
is in the given section. Also st_value can hold the offset into
st_shndx, not the actual address. Also it doesn't handle non-function

For the second patch. Could you explain what exactly you are trying to
fix? I see some stuff that I know is wrong, but it would help if I
knew the intent. As for what I do know.
* The error function already prints out the error. If you want to
print additional info, add an overload of error that allows that.
* Please use spaces instead of tabs. Lots of the code doesn't line up
properly for me.
* Setting the size to 4 to skip bytes is arbitrary, and won't always
give decent results on different platforms.

Thank you for working on this.

As for your comments on the arm disassembler.

1) I am not familiar with ARM, but I do know the decoder is currently
being worked on.

2) We were just discussing this in IRC. The idea is to simply handle
ARM disassembly as a special case and inspect the bit to decide how to
disassemble the symbol.

- Michael Spencer

More information about the llvm-dev mailing list