The exit syscall (equivalent to _exit
in C) doesn't flush the stdout buffer.
Outputting a newline causes a flush on line-buffered streams, which stdout will be if it is pointed to a terminal.
If you're willing to call printf
in libc, you shouldn't feel bad about calling exit
the same way. Having an int $0x80
in your program doesn't make you a bare-metal badass.
At minimum you need to push stdout;call fflush
before exiting. Or push $0;call fflush
. (fflush(NULL)
flushes all output streams)