Is there anything special I need to do for assembly on amd64?

I am having trouble with the following code:

.data                   

msg:
    .ascii "Hello\n"  
    len = . - msg 

.text                  

.global _start          

_syscall:              
    int     $0x80
    ret

_start:
    xor  %rax, %rax
    cdq
    push $len          
    push $msg        
    push $1           
    movb $4,%al       
    call _syscall       

    push $0           
    movb $1,%al        
    call _syscall      

Here is how I am attempting to assemble the above:

as -o test1.o test1.s
ld -e _start -o test1 test1.o

I tried elf2olf -o openbsd test1, but I receive this error:

elf2olf: test1: Exec format error.

Is there something that I am missing that I need to do on amd64?

Thanks,

Brian

Note: NASM is not an option since it's not available on amd64; there isn't a 
      port of YASM available yet.  And I ran into problems trying to compile 
      the YASM's source.


                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 

Reply via email to