Various representations of -Bstatic flags in ld
The manpage ld
(from binutils) has this section on flag changes -Bstatic
:
-Bstatic
-dn
-non_shared
-static
Do not link with shared libraries. This only makes sense on platforms for which shared libraries are supported. The different variants of this option are designed for compatibility with different systems. You can use this option multiple times on the command line: it affects library searches for the -l options that follow it. This parameter also implies--unresolved-symbols=report-all
. This parameter can be used with -shared. This means that a shared library is created, but that all external library references must be resolved by pulling in entries from static libraries.
My question is about the biased proposal: for which systems are these variants trying to be compatible? I've seen -Bstatic
and -static
in a variety of projects, but have not yet seen anyone ever used the remaining two options. For maximum compatibility (from a cross platform perspective), which one is the best to use?
source to share
Currently used parameters -Bstatic
and -static
and are not the same:
-
-static
means: do a completely static link (no shared libraries are used at all). -
-Bstatic
means: for later-lfoo
use only the archived version of the library.
Other options: -dn
(added in 1993) and -non_shared
(added in 1994) are for compatibility with legacy operating systems.
source to share