Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22202

How do I link .obj assembler file correctly? [duplicate]

$
0
0

I want to check, that my assembler code works and copy "hello world" program. It compiles and links succesfully, but it doesn't have output. I use NASM, WinGW64

  1. a.asm code
global _startsection .text_start:  mov rax, 1        ; write(  mov rdi, 1        ;   STDOUT_FILENO,  mov rsi, msg      ;   "Hello, world!\n",  mov rdx, msglen   ;   sizeof("Hello, world!\n")  syscall           ; );  mov rax, 60       ; exit(  mov rdi, 0        ;   EXIT_SUCCESS  syscall           ; );section .rodata  msg: db "Hello, world!", 10  msglen: equ $ - msg
  1. compile using cmd command: "nasm -f win64 a.asm"
  2. link with "ld a.obj"
  3. run and no output in cmd

Viewing all articles
Browse latest Browse all 22202

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>