简体   繁体   English

`-Wl,`编译标志的前缀

[英]`-Wl,` prefix to compiler flag

I'm new to a codebase and I'm looking through a Makefile. 我是一个新的代码库,我正在浏览一个Makefile。 I see several compiler flags specified with a -Wl, prefix (ie -Wl,--no-undefined specified). 我看到用-Wl,前缀指定了几个编译器标志(即-Wl,--no-undefined指定-Wl,--no-undefined )。 I have not encountered this syntax before and it is difficult to Google search. 我之前没有遇到过这种语法,谷歌搜索很难。

What is the prefix doing? 前缀是做什么的? It looks like it has to do with warnings, but I don't know and I'm hesitant to mess with it. 看起来它与警告有关,但我不知道,我犹豫要不要惹它。

It has nothing to do with warnings. 它与警告无关。

From GCC manual: 从GCC手册:

 -Wl,option 

Pass option as an option to the linker. 传递选项作为链接器的选项。 If option contains commas, it is split into multiple options at the commas. 如果选项包含逗号,则会在逗号中将其拆分为多个选项。 You can use this syntax to pass an argument to the option. 您可以使用此语法将参数传递给该选项。 For example, ' -Wl,-Map,output.map ' passes ' -Map output.map ' to the linker. 例如,'- -Wl,-Map,output.map '将' -Map output.map '传递给链接器。 When using the GNU linker, you can also get the same effect with ' -Wl,-Map=output.map '. 使用GNU链接器时,您也可以使用' -Wl,-Map=output.map '获得相同的效果。

man gcc: 男人gcc:

-Wl,option

Pass option as an option to the linker. 传递选项作为链接器的选项。 If option contains commas, it is split into multiple options at the commas. 如果选项包含逗号,则会在逗号中将其拆分为多个选项。 You can use this syntax to pass an argument to the option. 您可以使用此语法将参数传递给该选项。 For example, -Wl,-Map,output.map passes -Map output.map to the linker. 例如, -Wl,-Map,output.map将-Map output.map传递给链接器。 When using the GNU linker, you can also get the same effect with -Wl,-Map=output.map . 使用GNU链接器时,您也可以使用-Wl,-Map=output.map获得相同的效果。

Also important tip for google, add quotes for search that include special character. 也是谷歌的重要提示,添加包含特殊字符的搜索引号。 The following search led me to an answer: "-wl" flag 以下搜索引出了一个答案: "-wl" flag

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM