gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 19:35:05 25 4
gpt4 key购买 nike

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com