I can’t create a executable in my Assembler code windows

Asked

Viewed 15 times

0

ola personal do stackoverflow, I’m starting my studies in Assembly and I’m going through some beginner difficulties and would like you to help me. i wrote a code in ammbly, and when I create an object of it through the NASM and Linko I can’t create a executable in windows, I believe nasm is only for linux, I tried to compile by nasm and force the program to create a windows executable The way to create an obejto that I’m using through the NASM eh

nasm -f elf64 -o Nominarquivo. o Nominarquivo.asm

in this case generates an object in the format Filename. o and I Linko it as follows

Ld hello. o -o hello

of this method it generates a file that is not recognized by windows, even when I try to force to generate a executable

Ld hello. o -o hello.exe

nasm generates a executable but when run does not print the message I put on the screen, I tried to compile the file using MASM instead of NASM but still did not succeed, if someone could tell me how to create a executable in windows, or because this code does not work in MASM I would be very grateful.

follows the code:

section .data

        text db "hello, World!", 10

section  .text

        global _start

_start: 
       
        mov rax, 1 
        mov rdi, 1
        mov rsi, text
        mov rdx, 14
        syscall
        
        mov rax, 60
        mov rdi, 0 
        syscall

i’m doing everything by windows 10.

  • The format elf64 not natively supported by windows. For windows generates a PE with the option -f win64.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.