You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to run this simple assembly program on Windows 10 Insider Build with the Ubuntu Bash. However I always get the Error message: "bash: ./hello: cannot execute binary file: Exec format error".
So I've run said file on Ubuntu VM where it works without problems. Both operating systems are 64 bit. It turns out Windows can compile the code but not run it.
I use nasm -f elf32 hello.asm, gcc -m32 hello.o -o hello and ./hello as commands.
I appreciate any help.
section .text
global main
main:
mov eax, 4 ;system call number (sys_write)
mov ebx, 1 ;file descriptor (stdout)
mov ecx, mymsg ;message to write
mov edx, mylen ;message length
int 80h ;call kernel
mov eax, 1 ;system call number (sys_exit)
mov ebx, 0 ;exit with error code 0
int 80h ;call kernel
section .data
mymsg db 'Hello World!', 0xa
mylen equ $-mymsg
The text was updated successfully, but these errors were encountered:
I've tried to run this simple assembly program on Windows 10 Insider Build with the Ubuntu Bash. However I always get the Error message: "bash: ./hello: cannot execute binary file: Exec format error".
So I've run said file on Ubuntu VM where it works without problems. Both operating systems are 64 bit. It turns out Windows can compile the code but not run it.
I use nasm -f elf32 hello.asm, gcc -m32 hello.o -o hello and ./hello as commands.
I appreciate any help.
section .text
global main
main:
mov eax, 4 ;system call number (sys_write)
mov ebx, 1 ;file descriptor (stdout)
mov ecx, mymsg ;message to write
mov edx, mylen ;message length
int 80h ;call kernel
mov eax, 1 ;system call number (sys_exit)
mov ebx, 0 ;exit with error code 0
int 80h ;call kernel
section .data
mymsg db 'Hello World!', 0xa
mylen equ $-mymsg
The text was updated successfully, but these errors were encountered: