Reputation: 34217
$ gcc -S buffer-overflow.c && cat buffer-overflow.s
_foo:
pushl %ebp ;2
movl %esp, %ebp ;3
subl $16, %esp ;4
movl LC1, %eax ;5
movl %eax, -4(%ebp) ;6
leal -4(%ebp), %eax ;7
leal 8(%eax), %edx ;8
movl $_bad, %eax ;9
movl %eax, (%edx) ;10
leave
ret
_main:
...
call _foo ;1
...
The help information says it should not compile nor assemble:
-S Compile only; do not assemble or link
Why are they contradictory?
Upvotes: 0
Views: 289
Reputation: 129559
This is due to the difference of similarly-rooted "assembly" language (aka assembler) and "assembling" of the code (the process that "-S" help refers to).
Upvotes: 1
Reputation: 95020
A good explanation of the compiling
and linking
concepts is here.
Also, see this SO thread (difference between compiling and linking).
Upvotes: 2
Reputation: 507413
assemble
means to translate the result of the compile
phase, and link
means to combine the results of the assemble phases of different executions of gcc together into an executable or library.
The compile
phase takes the result of the preprocessing phase and results in assembler code, roughly.
Upvotes: 0