deadlock Message Board
[ December Full List | Reply ]

Re: Assemblers vs. compilers? A question for code-heads...
From Rich on 27 Dec '98
replying to Assemblers vs. compilers? A question for code-heads... posted by Nicholas

>I'm posting this somewhat off-topic question in the hope
>of avoiding a trip through Usenet:
>
>I understand what a compiler does, and likewise
>that one can use chunks of assembly language in
>a C program -- but where is the assembler itself?
>Is it still part of the process of code to compiler
>to binary to execution?

The average modern C compiler doesn't actually produce
assembly on disk unless asked to do so. Generally you can
get the assembly if you want. In Unix use the -S switch to cc and
see the as manpage if you want to assemble the output. With
other platforms check the manual. Remember that assembly is
essentially the same as binary, one readable to man, one to
CPU, and so it is little different to the compiler to output
assembly and stop.

The traditional C compilation went through several
passes, assembly being one of them. That way other languages'
compilers could output assembly too and there would be just
one assembler to maintain. It also saved a bit of RAM, which
was an issue 29 years ago. When you inlined assembly it just
dropped your code in the assembler output verbatim and let the
assembler take it from there.

These days the different languages tend to meet up at a
higher intermediate level, internal to the compiler, and
assemblers are rarely invoked directly. Whether a particular
compiler has the assembler in the same executable as other parts
or whether it runs another program is of little practical
interest since it all happens through one front end, cc or an
IDE.

You might find a C programming list a better place for
questions like this. Ex. linux-c-programming: talk to
majordomo@vger.rutgers.edu.




Reply to this message

Required Details
Your name:
Subject:

Optional Details
Home page title:
Home page URL:
Email:
(if you'd like to receive
automatic replies by email)

Your Message