-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Cleanup and document -C relocation-model
#71490
Conversation
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
Could we add some validation to check that a relocation model is valid for a particular target? For example ropi, rwpi, ropi-rwpi are only supported on ARM targets (clang actually validates this before passing it on to LLVM). Also dynamic-no-pic is only support on Darwin targets. Question: should the choice of relocation model have an impact on the TLS model? For example, if a crate is only going to be used in an executable and not in a shared library then we can use the local-exec TLS model. |
This comment has been minimized.
This comment has been minimized.
Yeah, it would be nice to warn about this, if not error. I'm not sure we can emit errors here due to compatibility. I've made an issue about this - #71552. (EDIT: I'll look at the TLS model question a bit later.) |
I'm more concerned that we are passing relocation models to LLVM on targets that do not support them. These code paths are untested since clang doesn't do this, which is likely to lead to LLVM assert failures down the line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation LGTM, r=me after discussion about validation is resolved.
Looks like LLVM does that automatically, see It's not yet clear to me what we need to do for LLVM to set |
I don't disagree, I just think it's better done in a separate PR. |
Introduce `enum RelocModel` instead.
The referenced `sanitizer-address/Makefile` no longer exists, so perhaps these options are no longer necessary as well. Even if they are still necessary, they should use `-C relocation-model=static` instead.
c8a07d6
to
45fbe8f
Compare
@bors r=davidtwco |
📌 Commit 45fbe8f has been approved by |
Rollup of 5 pull requests Successful merges: - rust-lang#71490 (Cleanup and document `-C relocation-model`) - rust-lang#71562 (fix more clippy warnings) - rust-lang#71571 (Fix since attribute for nonzero_bitor impl's) - rust-lang#71574 (proc_macro: Fix since attributes for new Span methods) - rust-lang#71575 (Fix stable(since) attribute for BTreeMap::remove_entry) Failed merges: r? @ghost
As the title says, this is mostly a refactoring and documentation.
One potentially observable change here is that
-C relocation-model=default
now takes the default from the Rust target, rather than from the underlying LLVM target. In other words,-C relocation-model=default
is now equivalent to not specifying the relocation model on command line at all.Apparently no one used that option because it has other bugs as well, e.g. PIC
default
wasn't treated as PIC in some places.