Does gcc compile to assembly or machine code ?
Does gcc compile to assembly or machine code ?
"without goto we would be wtf'd"
GCC 9.2 Manual section 3.2 Options Controlling the Kind of Output
Note that "object file" and "executable file" imply "machine code" in this context, although not all object files or executable files necessarily involve machine code (e.g., a shell script could be considered an "executable file", but that's in a completely different context).
Last edited by laserlight; 01-07-2020 at 07:30 AM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Both
First it runs the preprocessor to expand macros, compiles to assembler, compiles that to object code and links it into the final output.
-Greg.
Linker (computing) - Wikipedia ?compiles that to object code and links it into the final output.
"without goto we would be wtf'd"
Is object compiling required as in you can't skip it in a compiler ?but that's in a completely different context
"without goto we would be wtf'd"
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
gcc actually stands for gnu compiler collection and it while you are asking about C (since it's a C forum) it can compile other languages as well and be extended by a programmer to do other things. It actually produces an intermediary form called RTL which is used in optimization passes - something many compilers do. If you are interested you can read more here: GNU Compiler Collection (GCC) Internals: Top.
x86 Disassembly/Assemblers and Compilers - Wikibooks, open books for an open worldSome compilers... compile C and C++ source code directly into machine code... GCC on the other hand compiles C and C++ into assembly language...
"without goto we would be wtf'd"
You would have found that more authoritatively just by reading the manual entry I linked:
So it's clear that the output of "compilation proper" is in assembly language, but more loosely speaking the overall compilation process can involve any or all of the four stages listed, the last two of which result in machine code.Compilation can involve up to four stages: preprocessing, compilation proper, assembly and linking, always in that order. GCC is capable of preprocessing and compiling several files either into several assembler input files, or into one assembler input file; then each assembler input file produces an object file, and linking combines all the object files (those newly compiled, and those specified as input) into an executable file.
(...)
If you only want some of the stages of compilation, you can use -x (or filename suffixes) to tell gcc where to start, and one of the options -c, -S, or -E to say where gcc is to stop.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)