rust/src/librustrt
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
..
args.rs Port Rust to DragonFlyBSD 2014-07-29 16:44:39 +02:00
at_exit_imp.rs rustrt: Don't conditionally init the at_exit QUEUE 2014-07-31 07:30:53 -07:00
bookkeeping.rs green: Prevent runtime corruption on spawn failure 2014-07-30 08:33:53 -07:00
c_str.rs Add a null pointer check to CString::new 2014-07-24 07:25:48 -07:00
exclusive.rs std: Stabilize unit, bool, ty, tuple, arc, any 2014-07-26 13:12:20 -07:00
lib.rs Revert "Use fewer instructions for fail!" 2014-07-25 15:57:15 -07:00
libunwind.rs Port Rust to DragonFlyBSD 2014-07-29 16:44:39 +02:00
local_data.rs Add some benchmarks for TLD 2014-07-31 13:14:06 -07:00
local_heap.rs librustc: Remove the fallback to int for integers and f64 for 2014-06-29 11:47:58 -07:00
local_ptr.rs Stabilization for owned (now boxed) and cell 2014-07-13 12:52:51 -07:00
local.rs rustrt: Allow dropping a brand-new Task 2014-07-30 07:06:44 -07:00
macros.rs
mutex.rs Port Rust to DragonFlyBSD 2014-07-29 16:44:39 +02:00
rtio.rs libsyntax: Remove ~self and mut ~self from the language. 2014-07-24 07:26:03 -07:00
stack.rs Port Rust to DragonFlyBSD 2014-07-29 16:44:39 +02:00
task.rs Test fixes from the rollup 2014-07-31 13:05:12 -07:00
thread_local_storage.rs Port Rust to DragonFlyBSD 2014-07-29 16:44:39 +02:00
thread.rs Stabilization for owned (now boxed) and cell 2014-07-13 12:52:51 -07:00
unwind.rs rustc: Link entire archives of native libraries 2014-08-04 11:02:26 -07:00
util.rs ignore-lexer-test to broken files and remove some tray hyphens 2014-07-21 10:59:58 -07:00