I'm just a noob trying to write a simple "Hello World" program in 32-bit Linux assembly (AT&T syntax). Here's my code:
.section .data
msg:
.ascii "Text\n"
msgLen:
.long 5
.section .text
.globl _start
_start:
movl $4, %eax
movl $1, %ebx
movl msg, %ecx
movl msgLen, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80
I assemble the program, link it, run it, and... nothing. I don't get any errors whatsoever; it just doesn't work and I don't get any output. I tried changing the value of msgLen
, but nothing I do seems to work. It's driving me mad at this point. Any help would be greatly appreciated!
Update: So after looking at Peter Cordes's comment, I prepended $
before msg
and msgLen
, and my program successfully printed "Text" and a newline, but also other gibberish. This is the output I get:
Text
�`�@�` �`'�`print.omsgmsgLen__bss_start_edata_end.symtab.strtab.shstrtab.text.data@�"!�`� �� �,�'$