about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-29 23:19:52 +0000
committerbors <bors@rust-lang.org>2018-03-29 23:19:52 +0000
commit491f4bf5a5861ab6a9bbf4f263d87e68c6730cda (patch)
treec5e4446bfcc983fd1b7c3cb4bc615eee80cdf310 /src/rustllvm/PassWrapper.cpp
parentae544ee1c90afc0f939753014dc5e884cb2749a0 (diff)
parent88114f61b44dba22c6fa180e17d7638f2cf7a9d7 (diff)
downloadrust-491f4bf5a5861ab6a9bbf4f263d87e68c6730cda.tar.gz
rust-491f4bf5a5861ab6a9bbf4f263d87e68c6730cda.zip
Auto merge of #49316 - alexcrichton:start-group-end-group, r=michaelwoerister
rustc: Group linked libraries where needed

This commit fixes a longstanding issue with the compiler with circular
dependencies between libcore and libstd. The `core` crate requires at least one
symbol, the ability to unwind. The `std` crate is the crate which actually
defines this symbol, but the `std` crate also depends on the `core` crate.

This circular dependency is in general disallowed in Rust as crates cannot have
cycles amongst them. A special exception is made just for core/std, but this is
also unfortunately incompatible with how GNU linkers work. GNU linkers will
process undefined symbols in a left-to-right fashion, only actually linking an
rlib like libstd if there are any symbols used from it. This strategy is
incompatible with circular dependencies because if we otherwise don't use
symbols from libstd we don't discover that we needed it until we're later
processing libcore's symbols!

To fix this GNU linkers support the `--start-group` and `--end-group` options
which indicate "libraries between these markers may have circular dependencies
amongst them. The linker invocation has been updated to automatically pass these
arguments when we're invoking a GNU linker and automatically calculate where the
arguments need to go (around libstd and libcore)

Closes #18807
Closes #47074
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions