#245 ✓resolved
Postmodern

amd64 registers/instructions are not recognized when using the binary output format and the GAS parser

Reported by Postmodern | December 5th, 2011 @ 02:01 AM

Even when specifying --machine=amd64 with the GAS parser and default output format of bin, YASM does not recognize amd64 registers or instructions.

_start:
    push    $0x3b   
    popq    %rax                # set %rax to 0x3b
    cltd                    # %rdx (arg 3: envp) is set to 0
    movq    $0x68732f2f6e69622f,%rbx    # set %rbx to "/bin//sh"
    pushq   %rdx                # push 0
    pushq   %rbx                # push "/bin//sh"
    pushq   %rsp    
    popq    %rdi                # %rdi (arg 1: path) points to "/bin//sh"
    pushq   %rdx                # push 0
    pushq   %rdi                # push ptr to path
    pushq   %rsp    
    popq    %rsi                # %rsi (arg 2: argv) points to ["/bin//sh",0]
    syscall                 # execve(path,argv,envp)
$ yasm --parser=gas --arch=x86 --machine=amd64 test.s -o test.o
test.s:3: error: Unrecognized register name `%rax'
test.s:3: warning: `rax' is a register in 64-bit mode
test.s:3: warning: `popq' is an instruction in 64-bit mode
test.s:5: error: Unrecognized register name `%rbx'
test.s:5: warning: `rbx' is a register in 64-bit mode
test.s:6: error: Unrecognized register name `%rdx'
test.s:6: warning: `rdx' is a register in 64-bit mode
test.s:6: warning: `pushq' is an instruction in 64-bit mode
test.s:7: error: Unrecognized register name `%rbx'
test.s:7: warning: `rbx' is a register in 64-bit mode
test.s:7: warning: `pushq' is an instruction in 64-bit mode
test.s:8: error: Unrecognized register name `%rsp'
test.s:8: warning: `rsp' is a register in 64-bit mode
test.s:8: warning: `pushq' is an instruction in 64-bit mode
test.s:9: error: Unrecognized register name `%rdi'
test.s:9: warning: `rdi' is a register in 64-bit mode
test.s:9: warning: `popq' is an instruction in 64-bit mode
test.s:10: error: Unrecognized register name `%rdx'
test.s:10: warning: `rdx' is a register in 64-bit mode
test.s:10: warning: `pushq' is an instruction in 64-bit mode
test.s:11: error: Unrecognized register name `%rdi'
test.s:11: warning: `rdi' is a register in 64-bit mode
test.s:11: warning: `pushq' is an instruction in 64-bit mode
test.s:12: error: Unrecognized register name `%rsp'
test.s:12: warning: `rsp' is a register in 64-bit mode
test.s:12: warning: `pushq' is an instruction in 64-bit mode
test.s:13: error: Unrecognized register name `%rsi'
test.s:13: warning: `rsi' is a register in 64-bit mode
test.s:13: warning: `popq' is an instruction in 64-bit mode

YASM version: 1.1.0.2352

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Yasm Modular Assembler Project

Shared Ticket Bins

People watching this ticket

Pages