是否有可能让 gcc (MinGW/Windows) 显示所有调用的命令行?
例子:
gcc -o test.exe test.c -desiredOption
...应该输出如下内容:
cc1 -o intermediate.s test.c
as -o intermediate.o intermediate.s
ld - o test.exe intermediate.o crt0.o -lsomelibrary -e __start
背景:
有时,当我调用“gcc”时,某些与汇编程序相关的选项运行良好,但当我尝试直接调用“ld.exe”时,它们根本不起作用。因此我想知道哪个选项是由“gcc.exe”真正传递给“ld.exe”的。
在 Linux 下,我会使用类似的东西:
strace -f gcc -o test.exe test.c
...查看命令行(作为
execve
系统调用的参数)。
最佳答案
阅读 Invoking GCC 的 GCC documentation 章节。你想要 -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.
请注意,在 Linux 上, strace(1) 不显示命令行,而是 system calls 。
关于gcc - 如何让 gcc 显示调用的内部命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40572041/