[llvm-dev] X86 assembler cannot jump NEAR?

Jun Koi via llvm-dev llvm-dev at lists.llvm.org
Sat Feb 27 02:36:17 PST 2016


On Feb 27, 2016 6:07 PM, "Hlide via llvm-dev" <llvm-dev at lists.llvm.org>
wrote:
>
> Is there any reason to prefer a NEAR jump to a SHORT jump if the
assembler deemed it is okay to keep it as a SHORT one?
>
> The only reason you may want to have it as a NEAR jump is because you
need to alter the target of this jump to another address which may be out
of a byte range.

The problem is that llvm-mc always compiles "jmp" this as short jump, no
matter where the target is. Hence my question. I dont know if there is any
way to change this behavior. Looks like a bug to me so far.

Craig said there is a trick with object file, but I dont know how to do
that. Also, why compiling to object file changes the result?

Thanks.





>
> Regards
>
>
> On 27/02/2016 06:00:54, Jun Koi via llvm-dev (llvm-dev at lists.llvm.org)
wrote:
> > Hi,
> >
> >
> > Currently X86 assembler seems to always compile "jmp _label" as a SHORT
> > jump with "EB" opcode:
> >
> > $ echo "jmp _label"|llvm-mc -assemble -triple=i386 -show-encoding
> >     .text
> >     jmp    _label                  # encoding: [0xeb,A]
> >
> >
> >
> > My question is: can X86 assembler supports NEAR jump with opcode "E9"?
> > I try with "near" keyword, but it is not accepted:
> >
> > $ echo "jmp near _label"|llvm-mc -assemble -triple=i386 -show-encoding
> >     .text
> > <stdin>:1:10: error: unexpected token in argument list
> > jmp near _label
> >          ^
> >
> >
> >
> > Thanks,
> >
> > Jun
>
> _______________________________________________
> 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/20160227/b2e38140/attachment.html>


More information about the llvm-dev mailing list