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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160227/903ef415/attachment.html>
Craig Topper via llvm-dev
2016-Feb-27 07:12 UTC
[llvm-dev] X86 assembler cannot jump NEAR?
I think this is really because the assembler doesn't run layout and relaxation when not dumping to an object file. I disassembled an object file with this same test case and got e9 00 00 00 00. On Fri, Feb 26, 2016 at 9:00 PM, 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 > >-- ~Craig -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160226/211d7149/attachment.html>
On Sat, Feb 27, 2016 at 3:12 PM, Craig Topper <craig.topper at gmail.com> wrote:> I think this is really because the assembler doesn't run layout and > relaxation when not dumping to an object file. I disassembled an object > file with this same test case and got e9 00 00 00 00. >How can I tell llvm-mc to compile above assembly instruction to an object file? Thanks.> On Fri, Feb 26, 2016 at 9:00 PM, 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 >> >> > > > -- > ~Craig >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160227/ec25976a/attachment.html>