<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 17, 2013 at 10:55 AM, Stephen Checkoway <span dir="ltr"><<a href="mailto:s@pahtak.org" target="_blank">s@pahtak.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In creating a test case for a bug fix in llvm-objdump, I noticed that it differs in its output of pc-relative immediates from objdump:<br>
<br>
[secdev:/tmp] s$ cat a.s<br>
main:<br>
jmp .LBL0<br>
.LBL0:<br>
ret<br>
[secdev:/tmp] s$ llvm-mc -filetype=obj a.s > a.o<br>
[secdev:/tmp] s$ objdump -d a.o |tail -n 2<br>
0: eb 00 jmp 2 <main+0x2><br>
2: c3 retq<br>
[secdev:/tmp] s$ llvm-objdump -d a.o |tail -n 2<br>
0: eb 00 jmp 0<br>
2: c3 ret<br>
<br>
Is this intended behavior?<br></blockquote><div><br></div><div>I haven't looked at the source code but I'm guessing that llvm-objdump is just being "dumb" in the sense that the disassembly API's probably just return the imm8 as the raw field value and llvm-objdump is just printing that, rather than actually interpreting it as an address (relative to the instruction). In other words, binutils objdump is printing the operand of the JMP as the address it jumps to, while llvm-objdump is printing the raw imm8 field value. The binutils behavior is the desirable behavior, because the semantics of the written operand to a JMP instruction in assembler is the actual address (usually represented as a symbolic label), not the raw displacement.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
As an aside, obj2yaml can't handle this object file:<br>
[secdev:/tmp] s$ ~/build-master/bin/obj2yaml a.o<br>
LLVM ERROR: The end of the file was unexpectedly encountered<br></blockquote><div><br></div><div>FYI, obj2yaml only handles COFF currently. It should probably diagnose being fed and ELF file better than dying randomly though.</div>
<div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Stephen Checkoway<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</font></span></blockquote></div><br></div></div>