I am learning how a C file is compiled to machine code. I know I can generate assembly from gcc
with the -S
flag, however it also produces a lot of code to do with main()
and printf()
that I am not interested in at the moment.
Is there a way to get gcc
or clang
to "compile" a function in isolation and output the assembly?
I.e. get the assembly for the following c in isolation:
int add( int a, int b ) { return a + b;}