[llvm-dev] x86: How to Force 2-byte `jmp` instruction in lowering

Nirav Davé via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 22 09:36:42 PDT 2016

Hmm. Odd. I just rebuilt from scratch and it seems to work with
the test/CodeGen/X86/xray-attribute-instrumentation.ll test case outputing
straight to obj:

   llc -filetype=obj -o ~/a.o -mtriple=x86_64-apple-macosx <

What test case are you using?

In any case, the issue appears to be that llvm doesn't realize that the
target address is resolved and erroneously applies branch relaxation to the
jump. I don't know why a linker private symbol would make a difference.


On Wed, Jun 22, 2016 at 12:14 PM, Dean Michael Berris <dberris at google.com>

> On Wed, Jun 22, 2016 at 6:05 AM Nirav Davé <niravd at google.com> wrote:
>> This appears to work:
>> auto Target = OutContext.createLinkerPrivateTempSymbol();
>> with
>> auto Target = OutContext.createTempSymbol();
>> -Nirav
> Thanks Nirav -- I tried this but I'm still getting a "jmpq <address>" with
> this incantation when I load and disassemble from gdb. I'm seeing a
> 5-instruction jump, followed by the nops.
> If I disassemble with llvm-objdump though I see the following:
> _Z3foov:
>   400c10:       e9 09 00 00 00  jmp     9 <_Z3foov+0xE>
>   400c15:       66 0f 1f 84 00 00 02 00 00      nopw    512(%rax,%rax)
> I'm not sure whether the extra 0's after '0xe9 0x09' are alignment padding
> (though I was expecing 0x90 to show up if this was an alignment issue).
> Is there anything else I can try here?
> Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160622/85b4ee04/attachment.html>

More information about the llvm-dev mailing list