-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Emit error when trying to use assembler syntax directives in asm!
#82270
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
Changes from 1 commit
12c6a12
39dcd01
05ae666
4b13b81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#![feature(asm, llvm_asm)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test needs to be conditional on target, or specify via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test should also check the behaviour when the target isn't x86_64, this can be done through revisions, you can see how those are used in the same |
||
|
||
fn main() { | ||
unsafe { | ||
asm!(".intel_syntax noprefix", "nop"); | ||
//~^ ERROR intel sytnax is the default syntax | ||
asm!(".intel_syntax aaa noprefix", "nop"); | ||
//~^ ERROR intel sytnax is the default syntax | ||
asm!(".att_syntax noprefix", "nop"); | ||
//~^ ERROR using the .att_syntax directive may cause issues | ||
asm!(".att_syntax bbb noprefix", "nop"); | ||
//~^ ERROR using the .att_syntax directive may cause issues | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
error: intel sytnax is the default syntax, and trying to use this directive may cause issues | ||
--> $DIR/inline-syntax.rs:5:15 | ||
| | ||
LL | asm!(".intel_syntax noprefix", "nop"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^ help: Remove this assembler directive | ||
|
||
error: intel sytnax is the default syntax, and trying to use this directive may cause issues | ||
--> $DIR/inline-syntax.rs:7:15 | ||
| | ||
LL | asm!(".intel_syntax aaa noprefix", "nop"); | ||
| ^^^^^^^^^^^^^ help: Remove this assembler directive: `aaa noprefix` | ||
|
||
error: using the .att_syntax directive may cause issues, use the att_syntax option instead | ||
--> $DIR/inline-syntax.rs:9:15 | ||
| | ||
LL | asm!(".att_syntax noprefix", "nop"); | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
help: Remove the assembler directive and replace it with options(att_syntax) | ||
| | ||
LL | asm!("", "nop", options(att_syntax)); | ||
| -- ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: using the .att_syntax directive may cause issues, use the att_syntax option instead | ||
--> $DIR/inline-syntax.rs:11:15 | ||
| | ||
LL | asm!(".att_syntax bbb noprefix", "nop"); | ||
| ^^^^^^^^^^^ | ||
| | ||
help: Remove the assembler directive and replace it with options(att_syntax) | ||
| | ||
LL | asm!(" bbb noprefix", "nop", options(att_syntax)); | ||
| -- ^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 4 previous errors | ||
|
Uh oh!
There was an error while loading. Please reload this page.