Error on invalid macho section specifier#155065
Error on invalid macho section specifier#155065rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
Some changes occurred in compiler/rustc_hir/src/attrs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_attr_parsing |
|
just in case we're doing something weird that never got built or linked @bors try jobs=aarch64-apple |
This comment has been minimized.
This comment has been minimized.
error on invalid macho section specifier try-job: aarch64-apple
This comment has been minimized.
This comment has been minimized.
35e0a3f to
c90d31f
Compare
We're trying to move as many checks as possible to attribute parsing, with the "parse, don't validate" mentality, so if an attribute gets through parsing you can assume it is correct. Therefore I'd like this to be in the attribute parser |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
|
💔 Test for 3e6930f failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
c90d31f to
30b9c6e
Compare
This comment has been minimized.
This comment has been minimized.
30b9c6e to
db42ae2
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
…, r=JonathanBrouwer error on invalid macho section specifier The macho section specifier used by `#[link_section = "..."]` is more strict than e.g. the one for elf. LLVM will error when you get it wrong, which is easy to do if you're used to elf. So, provide some guidance for the simplest mistakes, based on the LLVM validation. Currently compilation fails with an LLVM error, see https://godbolt.org/z/WoE8EdK1K. The LLVM validation logic is at https://github.com/llvm/llvm-project/blob/a0f0d6342e0cd75b7f41e0e6aae0944393b68a62/llvm/lib/MC/MCSectionMachO.cpp#L199-L203 LLVM validates the other components of the section specifier too, but it feels a bit fragile to duplicate those checks. If you get that far, hopefully the LLVM errors will be sufficient to get unstuck. --- sidequest from rust-lang#147811 r? JonathanBrouwer specifically, is this the right place for this sort of validation? `rustc_attr_parsing` also does some validation.
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
Rfcbot didn't catch your review Niko. |
This comment has been minimized.
This comment has been minimized.
|
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. |
7aeba4e to
a4f5c6e
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=JonathanBrouwer |
…, r=JonathanBrouwer Error on invalid macho section specifier The macho section specifier used by `#[link_section = "..."]` is more strict than e.g. the one for elf. LLVM will error when you get it wrong, which is easy to do if you're used to elf. So, provide some guidance for the simplest mistakes, based on the LLVM validation. Currently compilation fails with an LLVM error, see https://godbolt.org/z/WoE8EdK1K. The LLVM validation logic is at https://github.com/llvm/llvm-project/blob/a0f0d6342e0cd75b7f41e0e6aae0944393b68a62/llvm/lib/MC/MCSectionMachO.cpp#L199-L203 LLVM validates the other components of the section specifier too, but it feels a bit fragile to duplicate those checks. If you get that far, hopefully the LLVM errors will be sufficient to get unstuck. --- sidequest from rust-lang#147811 r? JonathanBrouwer specifically, is this the right place for this sort of validation? `rustc_attr_parsing` also does some validation.
…uwer Rollup of 4 pull requests Successful merges: - #146181 (Add intrinsic for launch-sized workgroup memory on GPUs) - #155065 (Error on invalid macho section specifier) - #155676 ( Reject implementing const Drop for types that are not const `Destruct` already) - #155783 (Do not suggest internal cfg trace attributes)
…uwer Rollup of 9 pull requests Successful merges: - #146181 (Add intrinsic for launch-sized workgroup memory on GPUs) - #154803 (Fix ICE from cfg_attr_trace ) - #155065 (Error on invalid macho section specifier) - #155485 (Add an edge-case test for `--remap-path-prefix` for `rustc` & `rustdoc`) - #155659 (cleanup, restructure and merge `tests/ui/deriving` into `tests/ui/derives`) - #155676 ( Reject implementing const Drop for types that are not const `Destruct` already) - #155696 (Add a higher-level API for parsing attributes) - #155769 (triagebot.toml: Ping Enselic when tests/debuginfo/basic-stepping.rs changes) - #155783 (Do not suggest internal cfg trace attributes)
Rollup merge of #155065 - folkertdev:macho-section-specifier, r=JonathanBrouwer Error on invalid macho section specifier The macho section specifier used by `#[link_section = "..."]` is more strict than e.g. the one for elf. LLVM will error when you get it wrong, which is easy to do if you're used to elf. So, provide some guidance for the simplest mistakes, based on the LLVM validation. Currently compilation fails with an LLVM error, see https://godbolt.org/z/WoE8EdK1K. The LLVM validation logic is at https://github.com/llvm/llvm-project/blob/a0f0d6342e0cd75b7f41e0e6aae0944393b68a62/llvm/lib/MC/MCSectionMachO.cpp#L199-L203 LLVM validates the other components of the section specifier too, but it feels a bit fragile to duplicate those checks. If you get that far, hopefully the LLVM errors will be sufficient to get unstuck. --- sidequest from #147811 r? JonathanBrouwer specifically, is this the right place for this sort of validation? `rustc_attr_parsing` also does some validation.
View all comments
The macho section specifier used by
#[link_section = "..."]is more strict than e.g. the one for elf. LLVM will error when you get it wrong, which is easy to do if you're used to elf. So, provide some guidance for the simplest mistakes, based on the LLVM validation.Currently compilation fails with an LLVM error, see https://godbolt.org/z/WoE8EdK1K.
The LLVM validation logic is at
https://github.com/llvm/llvm-project/blob/a0f0d6342e0cd75b7f41e0e6aae0944393b68a62/llvm/lib/MC/MCSectionMachO.cpp#L199-L203
LLVM validates the other components of the section specifier too, but it feels a bit fragile to duplicate those checks. If you get that far, hopefully the LLVM errors will be sufficient to get unstuck.
sidequest from #147811
r? JonathanBrouwer
specifically, is this the right place for this sort of validation?
rustc_attr_parsingalso does some validation.