Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: Group linked libraries where needed #49316

Merged
merged 1 commit into from
Mar 30, 2018

Commits on Mar 29, 2018

  1. 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 rust-lang#18807
    Closes rust-lang#47074
    alexcrichton committed Mar 29, 2018
    Configuration menu
    Copy the full SHA
    88114f6 View commit details
    Browse the repository at this point in the history