-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Change binary_asm_labels
to only fire on x86 and x86_64
#127935
Conversation
In <rust-lang#126922>, the `binary_asm_labels` lint was added which flags labels such as `0:` and `1:`. Before that change, LLVM was giving a confusing error on x86/x86_64 because of an incorrect interpretation. However, targets other than x86 and x86_64 never had the error message and have not been a problem. This means that the lint was causing code that previously worked to start failing (e.g. `compiler_builtins`), rather than only providing a more clear messages where there has always been an error. Adjust the lint to only fire on x86 and x86_64 assembly to avoid this regression.
9b7d5a8
to
cc4b217
Compare
This comment has been minimized.
This comment has been minimized.
cc4b217
to
300da2c
Compare
The link pointed to a closed issue. Create a new one and point the link to it. Also add a help message to hint what change the user could make. Fixes: rust-lang#127821
300da2c
to
8410348
Compare
Seems to work now, tested locally on both x86 and aarch64. r? @Urgau |
Ideally, the lint would not gate on the platform being compiled, but rather gated on whether the code could be run from x86. Namely, if the @bors r+ |
Do you mean that you would expect the following to lint even if building on aarch64 or other targets? #[cfg(target_arch = "x86")]
fn foo() {
unsafe { asm!("0: jmp 0b") };
} Does that kind of machinery exist? I thought if it was behind a cfg then it doesn't even know the Thanks for the review |
…y, r=estebank Change `binary_asm_labels` to only fire on x86 and x86_64 In <rust-lang#126922>, the `binary_asm_labels` lint was added which flags labels such as `0:` and `1:`. Before that change, LLVM was giving a confusing error on x86/x86_64 because of an incorrect interpretation. However, targets other than x86 and x86_64 never had the error message and have not been a problem. This means that the lint was causing code that previously worked to start failing (e.g. `compiler_builtins`), rather than only providing a more clear messages where there has always been an error. Adjust the lint to only fire on x86 and x86_64 assembly to avoid this regression. Also update the help message. Fixes: rust-lang#127821
We have a very basic collection of items that got cfg'd out for the purposes of telling users that an item that wasn't found is behind a feature flag. We collect those during expansion, which would make my request harder to accomplish, as you would need to implement the lint to be able to work with an |
For this specific lint, it seems like effort is probably better spent fixing LLVM than attempting to improve the ergonomics much more. But being able to leverage that for other inline asm sounds amazing, since it is so platform dependent and easy to make mistakes, we should be able to at least perform Rust's validation on it. I'll update #127938 to reflect that if it sounds accurate. |
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#121533 (Handle .init_array link_section specially on wasm) - rust-lang#123196 (Add Process support for UEFI) - rust-lang#127621 (Rewrite and rename `issue-22131` and `issue-26006` `run-make` tests to rmake) - rust-lang#127928 (Migrate `lto-smoke-c` and `link-path-order` `run-make` tests to rmake) - rust-lang#127935 (Change `binary_asm_labels` to only fire on x86 and x86_64) r? `@ghost` `@rustbot` modify labels: rollup
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#121533 (Handle .init_array link_section specially on wasm) - rust-lang#123196 (Add Process support for UEFI) - rust-lang#127621 (Rewrite and rename `issue-22131` and `issue-26006` `run-make` tests to rmake) - rust-lang#127928 (Migrate `lto-smoke-c` and `link-path-order` `run-make` tests to rmake) - rust-lang#127935 (Change `binary_asm_labels` to only fire on x86 and x86_64) r? `@ghost` `@rustbot` modify labels: rollup
@bors r- failed rollup #127941 (comment) |
Disable a test that now only passes on x86 and make the link point to the new (open) LLVM bug.
8b66164
to
5686720
Compare
I didn't update the docs so it tried to run the assembly example on all platforms. Added a commit to fix this, looking at other tests I guess the best thing we can do is I'll let somebody double check the third commit changes (@estebank), @rustbot review |
Changes looks good. @bors r=estebank,Urgau |
Rollup of 7 pull requests Successful merges: - rust-lang#121533 (Handle .init_array link_section specially on wasm) - rust-lang#127825 (Migrate `macos-fat-archive`, `manual-link` and `archive-duplicate-names` `run-make` tests to rmake) - rust-lang#127891 (Tweak suggestions when using incorrect type of enum literal) - rust-lang#127902 (`collect_tokens_trailing_token` cleanups) - rust-lang#127928 (Migrate `lto-smoke-c` and `link-path-order` `run-make` tests to rmake) - rust-lang#127935 (Change `binary_asm_labels` to only fire on x86 and x86_64) - rust-lang#127953 ([compiletest] Search *.a when getting dynamic libraries on AIX) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#127935 - tgross35:binary_asm_labels-x86-only, r=estebank,Urgau Change `binary_asm_labels` to only fire on x86 and x86_64 In <rust-lang#126922>, the `binary_asm_labels` lint was added which flags labels such as `0:` and `1:`. Before that change, LLVM was giving a confusing error on x86/x86_64 because of an incorrect interpretation. However, targets other than x86 and x86_64 never had the error message and have not been a problem. This means that the lint was causing code that previously worked to start failing (e.g. `compiler_builtins`), rather than only providing a more clear messages where there has always been an error. Adjust the lint to only fire on x86 and x86_64 assembly to avoid this regression. Also update the help message. Fixes: rust-lang#127821
In #126922, the
binary_asm_labels
lint was added which flags labels such as0:
and1:
. Before that change, LLVM was giving a confusing error on x86/x86_64 because of an incorrect interpretation.However, targets other than x86 and x86_64 never had the error message and have not been a problem. This means that the lint was causing code that previously worked to start failing (e.g.
compiler_builtins
), rather than only providing a more clear messages where there has always been an error.Adjust the lint to only fire on x86 and x86_64 assembly to avoid this regression.
Also update the help message.
Fixes: #127821