.intel_syntax noprefix
.global _start
.text
_start:
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, 15
int 0x80
mov eax, 1
mov ebx, 14
int 0x80
.data
msg:
.ascii "Hello, World!\n"
I am trying to compile the above code via GNU AS using the following commands:
asad@Arcturus:~/Desktop/ZJNK$ as --32 -msyntax=intel code.S -o code.o
asad@Arcturus:~/Desktop/ZJNK$ ld -m elf_i386 code.o -o a.out
asad@Arcturus:~/Desktop/ZJNK$ ./a.out
asad@Arcturus:~/Desktop/ZJNK$
But I cannot get any output on the terminal. However, the exit code is still readable:
asad@Arcturus:~/Desktop/ZJNK$ echo $?
14
I am using 64-bit Linux and am able to run the above code via nasm after required changes.
What could have gone wrong?
To load the address of msg, use
mov ecx, offset msg