-
Notifications
You must be signed in to change notification settings - Fork 13k
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 -Z llvm_module_flag #116555
Add -Z llvm_module_flag #116555
Conversation
r? |
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @compiler-errors (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
892f482
to
bdfffdc
Compare
This comment has been minimized.
This comment has been minimized.
bdfffdc
to
6e75bb1
Compare
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.
For rustc
, perma-unstable compiler flags tend to mostly be used by people working on the compiler itself rather than features users might want to rely on. Could you explain a bit why you want to adjust LLVM module flags in this way?
Thanks! 🙂
Currently only u32 values are supported but the type is required to be specified | ||
for forward compatibility. The `behavior` element must match one of the named | ||
LLVM [metadata behaviors](https://llvm.org/docs/LangRef.html#module-flags-metadata) |
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.
It might be good to have a practical example of why you might want to use this flag here.
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.
For setting the small data limit to 0 to prevent the use of .sdata (the purpose of this PR), the flag can be specified as -Zllvm_module_flag=SmallDataLimit:u32:0:Error
My immediate motivation is that I'm working on an embedded system where I really need LLVM to not put symbols into the "small data segment" ( The platforms where LLVM supports small data segments each have their own way of controlling the threshold for what might get put in the small data segments. Three of them (MIPS, M68K, Hexagon) use LLVM arguments (although different args for each platform) so if I was targeting those platforms the existing Possibly the better solution to the underlying problem would be a rustc flag, something like But,
So I figured that a module-flags analogue of the existing |
☔ The latest upstream changes (presumably #115214) made this pull request unmergeable. Please resolve the merge conflicts. |
r? @wesleywiser |
27b2be8
to
10ed802
Compare
☔ The latest upstream changes (presumably #117706) made this pull request unmergeable. Please resolve the merge conflicts. |
Allow adding values to the `!llvm.module.flags` metadata for a generated module. The syntax is `-Z llvm_module_flag=<name>:<type>:<value>:<behavior>` Currently only u32 values are supported but the type is required to be specified for forward compatibility. The `behavior` element must match one of the named LLVM metadata behaviors.viors. This flag is expected to be perma-unstable.
10ed802
to
2e6b575
Compare
Thanks @paulmenage! I agree, since we already have @bors r+ rollup |
☀️ Test successful - checks-actions |
Finished benchmarking commit (0b24479): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 674.873s -> 675.256s (0.06%) |
Allow adding values to the
!llvm.module.flags
metadata for a generated module. The syntax is-Z llvm_module_flag=<name>:<type>:<value>:<behavior>
Currently only u32 values are supported but the type is required to be specified for forward compatibility. The
behavior
element must match one of the named LLVM metadata behaviors.This flag is expected to be perma-unstable.