简体   繁体   中英

`-Wl,` prefix to compiler flag

I'm new to a codebase and I'm looking through a Makefile. I see several compiler flags specified with a -Wl, prefix (ie -Wl,--no-undefined specified). 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:

 -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. When using the GNU linker, you can also get the same effect with ' -Wl,-Map=output.map '.

man 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. When using the GNU linker, you can also get the same effect with -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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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