如何获取GCC链接器命令? [英] How to get GCC linker command?
问题描述
我如何获得GCC用来调用ld的命令行?
我有一个AVR目标的问题,其中GCC显然添加一个链接器选项,我想
使用 gcc -v
以查看它运行的命令。如,
gcc -v -o hello hello.c
这将打印很多输出,包括链接器命令。实际输出取决于平台,但链接命令应该接近结束。或者,使用
gcc - ### -o hello hello.c
这就像 -v
,但实际上不运行任何命令和引号的选项。 p>
另一个选项是
gcc -dumpspecs
查找链接
的条目。
上述命令行标志列在 gcc --help
中,并在手册页上解释。以下是规范文件的GCC文档。
How can I get the command line GCC uses to invoke ld?
I have a problem for an AVR target where GCC apparently adds a linker option which I am trying to override, so I would like to look at the exact options GCC uses for ld.
Use gcc -v
to see what commands it runs. As in,
gcc -v -o hello hello.c
This will print a lot of output, including the linker command. The actual output depends on the platform, but the linking command should be near the end. Alternatively, use
gcc -### -o hello hello.c
This is like -v
, but does not actually run any commands and quotes the options.
Another option is
gcc -dumpspecs
Look for the entry for link
.
The above command line flags are listed in gcc --help
and explained on the man page. Here's GCC documentation for the spec files.
这篇关于如何获取GCC链接器命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!