ld 中 -Bstatic 标志的各种表示

Various representations of -Bstatic flags in ld

ld 的联机帮助页(来自 binutils)中,有关于 -Bstatic 标志的变体的这一部分:

-Bstatic
-dn
-non_shared
-static
Do not link against shared libraries. This is only meaningful on platforms for which shared libraries are supported. The different variants of this option are for compatibility with various systems. You may use this option multiple times on the command line: it affects library searching for -l options which follow it. This option also implies --unresolved-symbols=report-all. This option can be used with -shared. Doing so means that a shared library is being created but that all of the library's external references must be resolved by pulling in entries from static libraries.

我的问题是关于加粗的句子:这些变体究竟要兼容哪些系统?我在各种项目中都看到了 -Bstatic-static,但到目前为止还没有看到有人使用剩下的两个变体。为了获得最大的兼容性(就跨平台而言),最好使用哪个?

目前使用的是-Bstatic-static选项,不同:

  • -static 表示:执行完全静态的 link(完全没有使用共享库 )。
  • -Bstatic 表示:对于 之后 的任何 -lfoo,仅使用库的存档版本。

其他选项:-dn(1993 年添加)和 -non_shared(1994 年添加)用于与长期过时的操作系统兼容。