From the beginning of the basics of gcc

gcc Unless otherwise specified, the gcc command batches the processes of preprocess → compile → assemble → link. You can do these individually by specifying options (excluding links), but I often forget the option name, so a memorandum

Preprocess

** Results are output to standard output.

$gcc -E <FILE.c>

Preprocess & compile

** A .s file (assembly language code) is generated.


$gcc -S <FILE.c>

Assemble or preprocess & compile & assemble

** A .o file (machine language code) is generated.


$gcc -c <FILE.s>

Reference: Character string defined internally by #define

Many of the strings internally defined by #define start with __ (two underscores), but sometimes they don't. Occasionally, these and the names of variables you define conflict with each other, causing unintended program rewriting (environment-dependent). You can prevent this by knowing the string defined internally by #define.

Display a list of character strings internally defined by #define

** Output to standard output


$gcc -dM -xc -E /dev/null

Recommended Posts