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

[WIP] parameterize -C prefer-dynamic #88101

Commits on Aug 17, 2021

  1. extra details about library mismatches.

    Added reverse map that tells us for a given dependency and its preferred format,
    what were the parent crates that requested that dependency+format combination.
    pnkfelix committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    a8ed3a4 View commit details
    Browse the repository at this point in the history
  2. improve debugging experience slightly.

    (type annotations are to help rust-analyzer as much as humans.)
    pnkfelix committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    dbe4d27 View commit details
    Browse the repository at this point in the history
  3. Generalize -C prefer-dyanmic to carry an optional subset of the cra…

    …tes to prefer dynamic linkage on.
    
    Note: carrying an empty set here is *not* the same as `-C prefer-dyanmic=no`
    (and the latter is the default behavior for `rustc`). As discussed in detail in
    the comments for `enum PreferDynamicSet` (and also in the comments of
    `rustc_metadata::dependency_format`), `-C prefer-dynamic=no` asks the compiler
    to guess what linkage to use, and it currently guesses all static first, and if
    that fails, then it prefers dynamic linkage for all crates that provide both
    dynamic and static libraries.
    
    Using an empty set for `-C prefer-dynamic`, on the other hand, means the
    compiler should never prefer dynamic linkage over static linkage, even if that
    means it won't be able to successfully link the build product.
    pnkfelix committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    bf817f6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5d77479 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0099f6b View commit details
    Browse the repository at this point in the history
  6. Some tests of the current behavior, including the elaborated output w…

    …hen we fail due to repeated static library.
    pnkfelix committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    8d63ba2 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2021

  1. A collection of test cases showing how the new `-C prefer-dynamic=cra…

    …te,...` flag can be used to resolve issue 82151.
    
    These differ from the diamonds-*.rs in a couple of ways:
     * The most foundational library is being compiled to multiple crate output types, and
     * The most foundational library is being compiled to a `cdylib`, not a `dylib`.
    
    These two details seemed to be critical for reproducing the exact set of
    unfortunate link-time behaviors that we observed on issue 82151, as illustrated
    by the family of tests named `issue-82151-serverctl-*.rs`.
    
    ----
    
    issue-82151-serverctl-prefdyn.rs works around ld-binary specific details by
    adding extra normalization to test, including normalizing stage number in output.
    pnkfelix committed Aug 18, 2021
    Configuration menu
    Copy the full SHA
    172ba70 View commit details
    Browse the repository at this point in the history
  2. Variations on the dylibs/diamonds tests inspired by issue 82151.

    These tests specifically show the effects of having both rlib and dylib library
    variants present, as well as what happens when you mix in various settings for
    `-C prefer-dynamic=...`.
    pnkfelix committed Aug 18, 2021
    Configuration menu
    Copy the full SHA
    a2231a4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5509ab2 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2021

  1. Configuration menu
    Copy the full SHA
    21778cb View commit details
    Browse the repository at this point in the history