How to assemble the output of gcc -S ?
I am reading a book on Assembly Language (Programming from the ground up)... and suddenly had the urge to learn by examining gcc's assembly output, because some of the computer architecture stuff boring to me now and seems not really necessary(I know the general picture pretty well) for getting the basics of asm.
SO, I compiled
But this does not have a _start and the following fails to assemble and link it correctly.
.type main, @function
movl %esp, %ebp
movl $0, %eax
.size main, .-main
.ident "GCC: (GNU) 4.6.1 20110908 (Red Hat 4.6.1-9)"
How should I modify the assembly and linking commands to correctly assemble the code without modification ?
as foo.s -o foo.o
ld foo.o -o foo
1. gcc's verbose option may show it .. but I am unable to decipher the gobbledygook.
2. Linking libc in the linker step leads to a segfault at execution .