Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6783289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:50:45+00:00 2026-05-26T16:50:45+00:00

How do I compile to assembly instead of an executable with gcc. I know

  • 0

How do I compile to assembly instead of an executable with gcc. I know there is an -S flag, but where do I use it in the makefile. For example, if I use flags -O3 -o exe_name, where should I put the -S flag?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:50:46+00:00Added an answer on May 26, 2026 at 4:50 pm

    I suggest also using -fverbose-asm because then the generated assembler has some generated comments which “explains” the code. For example:

    gcc -S -fverbose-asm -O2 foo.c
    

    would generate in foo.s (with some comments) the assembler code produced by compiling foo.c

    And to understand what the GCC optimizations are doing one could even try -fdump-tree-all (but this produces hundreds of files!).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Is there any reason to use C instead of C++ for embedded
I am trying to use NAnt in order to compile and sign an assembly
When I try to compile an assembly in VS 2008, I got (occasionally, usually
While writing some C code, I decided to compile it to assembly and read
Problem 1: Is there a way to explicitly load a library at runtime instead
I'm trying to get GCC (or clang) to consistently use the SSE instruction for
I want to use the bts and bt x86 assembly instructions to speed up
I'm trying to learn assembly (so bear with me) and I'm getting a compile
I'm struggling to get some x86 assembly to compile on a Core 2 Duo
Is there a way to write a program using pure x86 intel opcodes instead

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.