[llvm-dev] llvm-bjdump and ELF-ARM/Thumb
Johan Wehrli via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 20 02:06:46 PDT 2016
I found the problem, my libraries contains both ARM and Thumb instructions.
When I specified the triple for thumb, all the arm function where not correctly disassemble.
This creates a shift that has repercussion into the thumb function.
You can simply disassemble function per function and used the triple : thumbv7-unknown-unknown-macho or armv7-unknown-unknown-macho
> On 20 Jun 2016, at 08:47, Johan Wehrli via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> After some digging, I found people with the same problem:
>
> https://llvm.org/bugs/show_bug.cgi?id=15795 <https://llvm.org/bugs/show_bug.cgi?id=15795>
> https://groups.google.com/forum/#!topic/llvm-dev/Kf3jXQLUJtM <https://groups.google.com/forum/#!topic/llvm-dev/Kf3jXQLUJtM>
>
> Does anyone know if there is a solution now? I can’t find anything.
>
>> On 20 Jun 2016, at 07:37, Johan Wehrli via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>> The standard objdump does not recognised the format.
>>
>> It works if I used an arm-linux-androideabi-objdump from the Android ndk but I am using the clang API to read binary inside my soft.
>>
>> This is why I was only working with llvm-objdump.
>>
>>> On 19 Jun 2016, at 15:03, Bruce Hoult <bruce at hoult.org <mailto:bruce at hoult.org>> wrote:
>>>
>>> What happens if you use the standard bunutils objdump e.g. from macports package arm-elf-binutils (if you're on a Mac)?
>>>
>>>
>>> On Mon, Jun 20, 2016 at 12:45 AM, Johan Wehrli via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>> Hi Everyone,
>>>
>>> When I used llvm-objdump to disassemble an ELF armv7 or thumb I have this error message:
>>>
>>> llvm-objdump: warning: invalid instruction encoding
>>>
>>> This message appears directly into the output and the output is mostly wrong (the invalid instruction create a shift in the addresses) :
>>>
>>>
>>> 1a6d: ff 2f e1 08 stmeq r1!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, sp} ^
>>> 1a71: 30 90 e5 00 rsceq r9, r5, r0, lsr r0
>>> 1a75: 10 a0 e1 00 rsceq r10, r1, r0, lsl r0
>>> 1a79: 00 53 e3 1e cdpne p3, #14, c5, c3, c0, #0
>>> llvm-objdump: warning: invalid instruction encoding
>>> 1a7e: 2f 01 01 00 andeq r0, r1, pc, lsr #2
>>> llvm-objdump: warning: invalid instruction encoding
>>> 1a83: e3 13 ff 2f svchs #16716771
>>> llvm-objdump: warning: invalid instruction encoding
>>>
>>> The binaries I try to read are c++ dynamic libraries for Android.
>>>
>>> I have used the following parameters:
>>>
>>> -llvm-objcdump mylib.so -d -arch=arm
>>> -llvm-objcdump mylib.so -d -arch=armv7
>>> -llvm-objcdump mylib.so -d -arch=thumb
>>>
>>> or with the following triples:
>>>
>>> armv7-none-linux-android
>>> thumbv7-none-linux-android
>>>
>>> Does anyone know why I have this error? Am I missing some input parameters?
>>>
>>> This is strange because it works great on iOS binaries (both thumb or arm).
>>>
>>> Greetings,
>>>
>>> Johan
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
>>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160620/7cf97e31/attachment.html>
More information about the llvm-dev
mailing list