Martin Rosenau
Martin Rosenau

Reputation: 18493

How to make gcc show the internal commands called?

Is there a possibility to let gcc (MinGW/Windows) to show all command lines called?

Example:

gcc -o test.exe test.c -desiredOption

... should output something like this:

cc1 -o intermediate.s test.c
as -o intermediate.o intermediate.s
ld - o test.exe intermediate.o crt0.o -lsomelibrary -e __start

Background:

Sometimes some assembler-related options work well when I call "gcc" but they do not work at all when I try to call "ld.exe" directly. Therefore I want to know which option is really passed to "ld.exe" by "gcc.exe".

Under Linux I would use something like:

strace -f gcc -o test.exe test.c

... to see the command lines (as arguments of the execve system calls).

Upvotes: 12

Views: 4266

Answers (1)

Read the Invoking GCC chapter of the GCC documentation.You want the -v option:

Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper.

Notice that on Linux, strace(1) does not show command lines, but system calls.

Upvotes: 16

Related Questions