Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22288

Is there a way to output the assembly of a single function in isolation?

$
0
0

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;}

Viewing all articles
Browse latest Browse all 22288

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>