Hello World - Linux 32bit - libc printf version

This is the 32bit version of the famous: "hello, world" program written in assembly language for a Linux system. Instead of using a system call to write the string to stdout, this version uses libc's printf function.

.section .data
	msg: .asciz "Hello, world\n"

.section .text
    .global _start
	# printf
	push $msg
	call printf
	add $4, %esp

	# exit
	push $0
	call exit

Assuming the file is called helloprintf32.s, compile and link as follows:

as --32 -o helloprintf32.o helloprintf32.s
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o helloprintf32 -lc helloprintf32.o