I don't know why I cannot print anything with printf
in GAS assembly if \n
(LF - newline) is missing at the end of the string. If I put the newline char \n
the line prints, but if I remove \n
the line doesn't print. Can someone tell me why?
.extern printf
.section .data
hello:
.string "Hello!" # doesn't print this way when \n is missing
.section .text
.globl _start
_start:
nop
movl $hello, %edi
movl $0, %eax
call printf
_end:
movq $60, %rax #use the _exit syscall
movq $0, %rdi #return error code 0
syscall #make syscall