Generate assembly code using GCC

To generate assembly code using GCC, use following command:

gcc -S {XYZ GCC compiler flags} -c test.c

{XYZ GCC compiler flags} –> Feel free to add other compiler options as per your requirement. Above command will generate test.s for assembly code.

To mix C language code alongwith assembly language for ease of code review/understanding, use following command:

gcc -g -Wa,-a,-ad {XYZ GCC compiler flags} -c test.c > test.list

test.list will have C & Assembly language.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s