Can I use for example
gcc -o -S output.s abs.c
to generate an assembly file with name output.s? It seems like I can't. When I try to do that, I got following error message.
Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I do not intend to use the linker, just try to examine the assembly code.
GCC is an integrated collection of compilers for several major programming languages, which as of this writing are C, C++, Objective-C, Java, FORTRAN, and Ada.
“GCC” is a common shorthand term for the GNU Compiler Collection. This is both the most general name for the compiler, and the name used when the emphasis is on compiling C programs (as the abbreviation formerly stood for “GNU C Compiler”). When referring to C++ compilation, it is usual to call the compiler “G++”.
Linux is a set of open-source UNIX-like operating systems, and Ubuntu is a Linux-based operating system commonly used to run Linux-based applications. To install C on Linux and to build and run our C program file on Ubuntu, we need to install the GCC Compiler.
GCC was originally written as the compiler for the GNU operating system.
-o
must be followed by the name of the output file. So, this would work:
gcc -S abc.c -o output.s
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With