rust/src/libstd
Alex Crichton 1ae1461fbf rustc: Link entire archives of native libraries
As discovered in #15460, a particular #[link(kind = "static", ...)] line is not
actually guaranteed to link the library at all. The reason for this is that if
the external library doesn't have any referenced symbols in the object generated
by rustc, the entire library is dropped by the linker.

For dynamic native libraries, this is solved by passing -lfoo for all downstream
compilations unconditionally. For static libraries in rlibs this is solved
because the entire archive is bundled in the rlib. The only situation in which
this was a problem was when a static native library was linked to a rust dynamic
library.

This commit brings the behavior of dylibs in line with rlibs by passing the
--whole-archive flag to the linker when linking native libraries. On OSX, this
uses the -force_load flag. This flag ensures that the entire archive is
considered candidate for being linked into the final dynamic library.

This is a breaking change because if any static library is included twice in the
same compilation unit then the linker will start emitting errors about duplicate
definitions now. The fix for this would involve only statically linking to a
library once.

Closes #15460
[breaking-change]
2014-08-04 11:02:26 -07:00
..
collections Fix misspelled comments. 2014-08-01 19:42:52 -04:00
io Fix misspelled comments. 2014-08-01 19:42:52 -04:00
num collections: Move push/pop to MutableSeq 2014-07-23 13:20:10 -07:00
path Add logic to skip the doc tests on windows since these examples are unix-specific 2014-07-31 11:50:23 -07:00
rand doc: use //! instead of /*! ... */ in std::rand 2014-07-28 17:52:48 +02:00
rt rustc: Link entire archives of native libraries 2014-08-04 11:02:26 -07:00
sync libstd: set baseline stability levels. 2014-06-30 22:49:18 -07:00
ascii.rs Add deprecated aliases for the old {Owned,}StrAsciiExt trait names. 2014-07-29 23:59:19 +01:00
bitflags.rs Derive PartialOrd, Ord and Hash for bitflags types. 2014-07-30 16:04:33 -04:00
c_vec.rs Implement slice::Vector for Option<T> and CVec<T> 2014-07-31 11:50:24 -07:00
dynamic_lib.rs Port Rust to DragonFlyBSD 2014-07-29 16:44:39 +02:00
failure.rs Stabilization for owned (now boxed) and cell 2014-07-13 12:52:51 -07:00
fmt.rs auto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichton 2014-07-22 07:16:17 +00:00
from_str.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
gc.rs libstd: set baseline stability levels. 2014-06-30 22:49:18 -07:00
hash.rs mark std::hash experimental 2014-07-11 14:25:15 -07:00
lib.rs collections: Move push/pop to MutableSeq 2014-07-23 13:20:10 -07:00
macros.rs rustrt: Make begin_unwind take a single file/line pointer 2014-07-31 07:30:17 -07:00
os.rs Fix misspelled comments. 2014-08-01 19:42:52 -04:00
prelude.rs Remove OwnedStr trait 2014-07-24 07:25:43 -07:00
rtdeps.rs rustc: Link entire archives of native libraries 2014-08-04 11:02:26 -07:00
task.rs Rename to_str to to_string 2014-07-21 09:54:52 -07:00
to_string.rs Rename to_str to to_string 2014-07-21 09:54:52 -07:00