]> git.lizzy.rs Git - rust.git/commit
rustc: Hint to the linker about static/shared libs
authorAlex Crichton <alex@alexcrichton.com>
Wed, 16 Apr 2014 23:31:45 +0000 (16:31 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 17 Apr 2014 18:39:51 +0000 (11:39 -0700)
commitad3de7fdb58cb2beb06780794006b4184807c75e
tree3ceea0731dd68ea6ee571070b83660a1a03cc9c1
parentacdee8b904178e13616cea8c31bcdb1f063ddef5
rustc: Hint to the linker about static/shared libs

If a linker finds both a static and a dynamic version of the same library, then
the linker often chooses the dynamic version. This is surprising when a native
library is specified as being "static" in rust source. This modifies the linker
command line to obey the hints given in rust source files and instructing the
linker to prefer a particular version of a found library.

Unfortunately, this patch has no effect on osx because the linker supports
no such hint, and it also has no effect on windows because the linker apparently
just ignores it. For now this is predominately used to enable the previous patch
of linking to libstdc++ statically, but more support would need to be added for
this in the future if we wanted to officially support it.

cc #12557 (doesn't close because it doesn't support OSX and windows)
src/librustc/back/link.rs