gcc - 如何让 gcc 显示调用的内部命令?

标签 gcc

是否有可能让 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 GCCGCC 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/

相关文章:

gcc - Homebrew 软件找不到 gcc

xcode - 将 GCC 4.2 设置为 Mac OS X Leopard 上的默认编译器

c - C中的 "!!"是什么?

c - 堆栈中变量的顺序 (GCC)

c - 在Windows上允许C语言中的 "Special Characters"

c++ - 将 goto 标签暴露给符号表

gcc - 为什么库的链接顺序有时会导致 GCC 中出现错误?

c++ - mingw中的时间函数

linux - 海湾合作委员会/G++ : building without GNU unique object symbols for older Linux kernels

c - 如何从 gcc 限制 C 指令集