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

Add new rustc_panic_abort_runtime attribute for libpanic_abort #66489

Closed
wants to merge 2 commits into from

Commits on Dec 21, 2019

  1. Add new rustc_panic_abort_runtime attribute for libpanic_abort

    Supersedes rust-lang#66311
    
    This replaces the hack in `bootstrap`, allowing the special handling for
    `libpanic_abort` to be encoded into the crate source itself, rather than
    existing as special knowledge in the build system. This will allow Miri
    (and any other users of Xargo) to correctly build `libpanic_abort`
    without relying on `bootstrap` or custom wrapepr hacks.
    
    The trickeist part of this PR is how we handle LLVM. The `emscripten`
    target family requires the "-enable-emscripten-cxx-exceptions" flag
    to be passed to LLVM when the panic strategy is set to "unwind".
    
    Unfortunately, the location of this emscripten-specific check ends up
    creating a circular dependency between LLVM and attribute resoltion.
    When we check the panic strategy, we need to have already parsed crate
    attributes, so that we determine if `rustc_panic_abort_runtime` was set.
    However, attribute parsing requires LLVM to be initialized, so that we
    can proerly handle cfg-gating of target-specific features. However, the
    whole point of checking the panic strategy is to determinne which flags
    to use during LLVM initialization!
    
    To break this circular dependency, we explicitly set the
    "-enable-emscripten-cxx-exceptions" in LLVM's argument-parsing framework
    (using public but poorly-documented APIs). While this approach is
    unfortunate, it only affects emscripten, and only modifies a
    command-line flag which is never used until much later (when we create a
    `PassManager`).
    Aaron1011 committed Dec 21, 2019
    Configuration menu
    Copy the full SHA
    635c76b View commit details
    Browse the repository at this point in the history
  2. Fix typos

    Co-Authored-By: Thomas Lively <7121787+tlively@users.noreply.github.com>
    Aaron1011 and tlively committed Dec 21, 2019
    Configuration menu
    Copy the full SHA
    6ea7226 View commit details
    Browse the repository at this point in the history