我要评分
获取效率
正确性
完整性
易理解

Adding -Wl to Linker Parameters

Error Information

1
2
3
4
clang-10: error: unknown argument: '-znow' 
clang-10: error: unsupported option `--whole-archive` 
clang-10: error: unsupported option `--no-whole-archive` 
clang-10: error: unknown argument: `-soname`

Problem

Clang transfers options in a method different from that of GCC. Clang requires -Wl to be added to some parameters before they are transferred to the linker.

These parameters include but are not limited to:

  • -znow
  • --whole-archive
  • --no-whole-archive
  • -soname

If unknown argument or unsupported option is displayed and the option is to be transferred to the linker, -Wl must be added to the option.

Solution

Add -Wl, before these parameters. An example is as follows:

1
-Wl,-znow -Wl,--whole-archive -Wl,--no-whole-archive -Wl,-soname