Skip to content

options(att_syntax) doesn't do anything for global_asm! and naked_asm! #143542

Closed
@SabrinaJewson

Description

@SabrinaJewson

Edit(trevor): this doesn't need compiler_builtins to repro #143542 (comment)

I tried this code:

cargo new x
cd x
RUSTFLAGS="--emit=asm -Cllvm-args=-x86-asm-syntax=intel" cargo +nightly build -Zbuild-std

I expected to see this happen: A successful build, with Intel-syntax assembly emitted. (as per #48011)

Instead, this happened:

A lot of inline assembly syntax errors
   Compiling compiler_builtins v0.1.160 (~/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins)
   Compiling rustc-std-workspace-core v1.99.0 (~/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (~/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling panic_abort v0.0.0 (~/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
   Compiling libc v0.2.174
   Compiling cfg-if v1.0.1
   Compiling memchr v2.7.5
   Compiling adler2 v2.0.1
   Compiling rustc-demangle v0.1.25
error: unknown token in expression
  |
note: instantiated into assembly here
 --> <inline asm>:8:20
  |
8 |             pushq  %rbp
  |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:11:20
   |
11 |             movq   %rsp, %rbp
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:14:20
   |
14 |             mov    %rax,%r11        // duplicate %rax as we're clobbering %r11
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:30:20
   |
30 |             cmp    $0x1000,%r11
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:33:20
   |
33 |             sub    $0x1000,%rsp
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:34:20
   |
34 |             test   %rsp,8(%rsp)
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:35:20
   |
35 |             sub    $0x1000,%r11
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:36:20
   |
36 |             cmp    $0x1000,%r11
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:42:20
   |
42 |             sub    %r11,%rsp
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:43:20
   |
43 |             test   %rsp,8(%rsp)
   |                    ^

error: unknown token in expression
   |
note: instantiated into assembly here
  --> <inline asm>:48:20
   |
48 |             add    %rax,%rsp
   |                    ^

   Compiling unwind v0.0.0 (~/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
error: could not compile `compiler_builtins` (lib) due to 11 previous errors
warning: build failed, waiting for other jobs to finish...

Meta

rustc --version --verbose:

rustc 1.90.0-nightly (667787527 2025-07-02)
binary: rustc
commit-hash: 6677875279b560442a07a08d5119b4cd6b3c5593
commit-date: 2025-07-02
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-global-asmArea: `global_asm!`C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions