<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I found the problem, my libraries contains both ARM and Thumb instructions.<div class=""><br class=""></div><div class="">When I specified the triple for thumb, all the arm function where not correctly disassemble.</div><div class=""><br class=""></div><div class="">This creates a shift that has repercussion into the thumb function.</div><div class=""><br class=""></div><div class="">You can simply disassemble function per function and used the triple : <span style="font-size: small; white-space: pre-wrap; widows: 1; background-color: rgb(255, 255, 255);" class="">thumbv7-unknown-unknown-macho or </span><span style="font-size: small; white-space: pre-wrap; widows: 1; background-color: rgb(255, 255, 255);" class="">armv7-unknown-unknown-macho<br class=""></span><br class=""><div><blockquote type="cite" class=""><div class="">On 20 Jun 2016, at 08:47, Johan Wehrli via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">After some digging, I found people with the same problem:<div class=""><br class=""></div><div class=""><a href="https://llvm.org/bugs/show_bug.cgi?id=15795" class="">https://llvm.org/bugs/show_bug.cgi?id=15795</a></div><div class=""><a href="https://groups.google.com/forum/#!topic/llvm-dev/Kf3jXQLUJtM" class="">https://groups.google.com/forum/#!topic/llvm-dev/Kf3jXQLUJtM</a></div><div class=""><br class=""></div><div class="">Does anyone know if there is a solution now? I can’t find anything.<br class="">
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On 20 Jun 2016, at 07:37, Johan Wehrli via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The standard objdump does not recognised the format.<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">This is why I was only working with llvm-objdump.<br class="">
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On 19 Jun 2016, at 15:03, Bruce Hoult <<a href="mailto:bruce@hoult.org" class="">bruce@hoult.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">What happens if you use the standard bunutils objdump e.g. from macports package arm-elf-binutils (if you're on a Mac)?<div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Jun 20, 2016 at 12:45 AM, Johan Wehrli via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Everyone,<br class="">
<br class="">
When I used llvm-objdump to disassemble an ELF armv7 or thumb I have this error message:<br class="">
<br class="">
llvm-objdump: warning: invalid instruction encoding<br class="">
<br class="">
This message appears directly into the output and the output is mostly wrong (the invalid instruction create a shift in the addresses) :<br class="">
<br class="">
<br class="">
1a6d: ff 2f e1 08 stmeq r1!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, sp} ^<br class="">
1a71: 30 90 e5 00 rsceq r9, r5, r0, lsr r0<br class="">
1a75: 10 a0 e1 00 rsceq r10, r1, r0, lsl r0<br class="">
1a79: 00 53 e3 1e cdpne p3, #14, c5, c3, c0, #0<br class="">
llvm-objdump: warning: invalid instruction encoding<br class="">
1a7e: 2f 01 01 00 andeq r0, r1, pc, lsr #2<br class="">
llvm-objdump: warning: invalid instruction encoding<br class="">
1a83: e3 13 ff 2f svchs #16716771<br class="">
llvm-objdump: warning: invalid instruction encoding<br class="">
<br class="">
The binaries I try to read are c++ dynamic libraries for Android.<br class="">
<br class="">
I have used the following parameters:<br class="">
<br class="">
-llvm-objcdump mylib.so -d -arch=arm<br class="">
-llvm-objcdump mylib.so -d -arch=armv7<br class="">
-llvm-objcdump mylib.so -d -arch=thumb<br class="">
<br class="">
or with the following triples:<br class="">
<br class="">
armv7-none-linux-android<br class="">
thumbv7-none-linux-android<br class="">
<br class="">
Does anyone know why I have this error? Am I missing some input parameters?<br class="">
<br class="">
This is strange because it works great on iOS binaries (both thumb or arm).<br class="">
<br class="">
Greetings,<br class="">
<br class="">
Johan<br class="">
_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
</blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class=""></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>