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 note about x86 instruction prefixes in asm! to unstable book #90533

Merged
merged 2 commits into from
Nov 5, 2021

Conversation

syvb
Copy link
Contributor

@syvb syvb commented Nov 3, 2021

Since rustc doesn't do the assembly parsing itself, it is unable to detect when inline assembly ends with an instruction prefix, which doesn't make sense since it would apply to instructions from the compiler. This fixes #82314 by mentioning that x86 instruction prefixes must not be used in inline assembly. AFAICT x86 is the only instruction set with instruction prefixes.

Since rustc doesn't do the assembly parsing itself, it is unable
to detect when inline assembly ends with an instruction prefix,
which doesn't make sense since it would apply to instructions from
the compiler. This fixes rust-lang#82314 by mentioning that x86 instruction
prefixes must not be used in inline assembly.
@rust-highfive
Copy link
Collaborator

r? @GuillaumeGomez

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 3, 2021
@GuillaumeGomez
Copy link
Member

r? @Amanieu

@joshtriplett
Copy link
Member

joshtriplett commented Nov 4, 2021

Made one suggestion to further clarify this. r=me with that applied.

Also, thank you for qualifying this as "that would apply to instructions generated by the compiler". There are valid reasons to have a prefix separated from an instruction for other purposes, such as for patching instructions.

Separately from this PR, would you please submit a report to upstream LLVM, requesting that its assembler catch trailing instruction prefixes like this?

@Amanieu
Copy link
Member

Amanieu commented Nov 4, 2021

@bors r=joshtriplett

@bors
Copy link
Contributor

bors commented Nov 4, 2021

📌 Commit 773cc4f has been approved by joshtriplett

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 4, 2021
@syvb
Copy link
Contributor Author

syvb commented Nov 4, 2021

LLVM bug: https://bugs.llvm.org/show_bug.cgi?id=52405

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 4, 2021
Add note about x86 instruction prefixes in asm! to unstable book

Since rustc doesn't do the assembly parsing itself, it is unable to detect when inline assembly ends with an instruction prefix, which doesn't make sense since it would apply to instructions from the compiler. This fixes rust-lang#82314 by mentioning that x86 instruction prefixes must not be used in inline assembly. AFAICT x86 is the only instruction set with instruction prefixes.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 4, 2021
Add note about x86 instruction prefixes in asm! to unstable book

Since rustc doesn't do the assembly parsing itself, it is unable to detect when inline assembly ends with an instruction prefix, which doesn't make sense since it would apply to instructions from the compiler. This fixes rust-lang#82314 by mentioning that x86 instruction prefixes must not be used in inline assembly. AFAICT x86 is the only instruction set with instruction prefixes.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 4, 2021
Add note about x86 instruction prefixes in asm! to unstable book

Since rustc doesn't do the assembly parsing itself, it is unable to detect when inline assembly ends with an instruction prefix, which doesn't make sense since it would apply to instructions from the compiler. This fixes rust-lang#82314 by mentioning that x86 instruction prefixes must not be used in inline assembly. AFAICT x86 is the only instruction set with instruction prefixes.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 5, 2021
Rollup of 9 pull requests

Successful merges:

 - rust-lang#90507 (Suggest `extern crate alloc` when using undeclared module `alloc`)
 - rust-lang#90530 (Simplify js tester a bit)
 - rust-lang#90533 (Add note about x86 instruction prefixes in asm! to unstable book)
 - rust-lang#90537 (Update aarch64 `target_feature` list for LLVM 12.)
 - rust-lang#90544 (Demote metadata load warning to "info".)
 - rust-lang#90554 (Clean up some `-Z unstable-options` in tests.)
 - rust-lang#90556 (Add more text and examples to `carrying_{add|mul}`)
 - rust-lang#90563 (rustbot allow labels)
 - rust-lang#90571 (Fix missing bottom border for headings in sidebar)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dbaf2de into rust-lang:master Nov 5, 2021
@rustbot rustbot added this to the 1.58.0 milestone Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x86 asm! accepts "lock" as a standalone instruction
7 participants