GCC calling GNU assembler

Bob Plantz plantz@cds1.net
Thu Feb 4 07:15:00 GMT 2010

On Wed, 2010-02-03 at 10:21 +0000, Andrew Haley wrote:
> On 02/03/2010 09:26 AM, Nikola Ikonic wrote:
> > Could anybody please answer me on following question:
> > 
> > where is GCC callin assembler where it recognizes assembler code in C
> > function? For example, let's say that there is this line in C code:
> > 
> > asm("mov r1,r0");
> > 
> > So, the parser parses this as an assembler string. But where, in GCC
> > code, is assembler called to process this string?
> > Or maybe the question is where this "mov r1, r0" string is passed to
> > assembler. Anyway, I think you got my question.
> The compiler driver, a program called "gcc", first calls another program
> called "cc1" to translate C into assembly language.  It then calls "as"
> to translate assembly language into object code.  It does this regardless
> of whether there are any asm() statements in the program.

And you can see this assembly language by using the -S option for the
compiler. It will create the file yourFileName.s, which is the assembly
language that gcc generated for yourFileName.c, and stop.


More information about the Gcc-help mailing list