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

Emit an error if trying to use Intel syntax asm! with an old LLVM #83889

Closed
wants to merge 1 commit into from

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented Apr 5, 2021

asm! with Intel syntax requires LLVM 10.0.1.

cc #76738

r? @nagisa

asm! with Intel syntax requires LLVM 10.0.1.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 5, 2021
@nagisa
Copy link
Member

nagisa commented Apr 5, 2021 via email

@Amanieu
Copy link
Member Author

Amanieu commented Apr 5, 2021

Unfortunately many LTS distros use LLVM 10.0.0 instead of 10.0.1: https://packages.ubuntu.com/search?suite=all&arch=any&searchon=names&keywords=llvm-10-dev

@nagisa
Copy link
Member

nagisa commented Apr 5, 2021

In that case a number of assembly changes in #83387 might need to be undone. But I don't think distros will bump Rust anyway (cf. this discussion)

@Amanieu
Copy link
Member Author

Amanieu commented Apr 5, 2021

I marked the asm tests with min-llvm-version already in #83485. The PR CI uses system llvm which is 10.0.0, so the asm tests are only run on bors.

@nagisa
Copy link
Member

nagisa commented Apr 5, 2021

I meant these changes.

@Amanieu
Copy link
Member Author

Amanieu commented Apr 5, 2021

I double-checked, apparently it's just https://reviews.llvm.org/D78977 that's missing from LLVM 10.0.0, which breaks the use of SSE registers as asm operands. This breaks some of our tests, but likely won't affect anyone using asm! in the wild.

@Amanieu
Copy link
Member Author

Amanieu commented Apr 5, 2021

So it turns out this PR is wrong: the issue is completely unrelated to intel vs att syntax. I think it's fine to just leave it without an error for now considering how rarely SSE parameters are used.

@Amanieu Amanieu closed this Apr 5, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-10 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.................................................................................................... 9400/11731
.................................................................................................... 9500/11731
........................................................................i......i.................... 9600/11731
.................................................................................................... 9700/11731
..................iiiiiii..iiiiii.i................................................................. 9800/11731
.................................................................................................... 10000/11731
.................................................................................................... 10100/11731
.................................................................................................... 10200/11731
.................................................................................................... 10300/11731
---
Suite("src/test/codegen") not skipped for "bootstrap::test::Codegen" -- not in ["src/tools/tidy"]
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 268 tests
ii....i.F.iF.....F.Fiii.F......ii.....i.iii.........i.ii.........i.i..............i............i.i.. 100/268
.iii........ii.iiii.i.........i.....i...iiii.....F..i.i.i...iii..iiii............................... 200/268
......i.ii...i..ii..i....................iiiii.ii...................
Some tests failed in compiletest suite=codegen mode=codegen host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu

---- [codegen] codegen/asm-multiple-options.rs stdout ----

error: compilation failed!
error: compilation failed!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/codegen/asm-multiple-options.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-multiple-options" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-O" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-multiple-options/auxiliary" "--emit=llvm-ir"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
warning: variable `y` is assigned to, but never used
   |
   |
12 |     let y: i32;
   |
   = note: `#[warn(unused_variables)]` on by default
   = note: `#[warn(unused_variables)]` on by default
   = note: consider using `_y` instead

warning: value assigned to `y` is never read
   |
   |
13 |     asm!("", out("ax") y, in("bx") x, options(pure), options(nomem));
   |
   = note: `#[warn(unused_assignments)]` on by default
   = note: `#[warn(unused_assignments)]` on by default
   = help: maybe it is overwritten before being read?

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
13 |     asm!("", out("ax") y, in("bx") x, options(pure), options(nomem));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
25 |     asm!("", out("ax") DUMMY_OUTPUT, options(pure), options(readonly));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
37 |     asm!("", out("ax") DUMMY_OUTPUT, options(pure), options(nomem));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
50 |     asm!("", out("ax") DUMMY_OUTPUT, options(pure), options(readonly));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option
error: aborting due to 4 previous errors; 2 warnings emitted


------------------------------------------
------------------------------------------


---- [codegen] codegen/asm-options.rs stdout ----

error: compilation failed!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/codegen/asm-options.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-options" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-O" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-options/auxiliary" "--emit=llvm-ir"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
warning: variable `y` is assigned to, but never used
   |
   |
12 |     let y: i32;
   |
   = note: `#[warn(unused_variables)]` on by default
   = note: `#[warn(unused_variables)]` on by default
   = note: consider using `_y` instead

warning: value assigned to `y` is never read
   |
   |
13 |     asm!("", out("ax") y, in("bx") x, options(pure, nomem));
   |
   = note: `#[warn(unused_assignments)]` on by default
   = note: `#[warn(unused_assignments)]` on by default
   = help: maybe it is overwritten before being read?

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
13 |     asm!("", out("ax") y, in("bx") x, options(pure, nomem));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
21 |     asm!("", options(noreturn));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
33 |     asm!("", out("ax") DUMMY_OUTPUT, options(pure, readonly));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
43 |     asm!("", out("ax") DUMMY_OUTPUT, options());
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
55 |     asm!("", out("ax") DUMMY_OUTPUT, options(pure, nomem));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
68 |     asm!("", out("ax") DUMMY_OUTPUT, options(nomem));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
81 |     asm!("", out("ax") DUMMY_OUTPUT, options(pure, readonly));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
93 |     asm!("", options());
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
94 |     asm!("", options(nomem));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
95 |     asm!("", options(readonly));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option
error: aborting due to 10 previous errors; 2 warnings emitted


------------------------------------------
------------------------------------------


---- [codegen] codegen/asm-sanitize-llvm.rs stdout ----

error: compilation failed!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/codegen/asm-sanitize-llvm.rs" "-Zthreads=1" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-sanitize-llvm" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target" "x86_64-unknown-linux-gnu" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-sanitize-llvm/auxiliary" "--emit=llvm-ir"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
22 | /     asm!(
22 | /     asm!(
23 | |         r"banana$:",
   | |_____^
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
29 | /     asm!(
29 | /     asm!(
30 | |         r"banana\36:",
   | |_____^
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option
error: aborting due to 2 previous errors


------------------------------------------
------------------------------------------


---- [codegen] codegen/asm-target-clobbers.rs#avx512 stdout ----

error in revision `avx512`: compilation failed!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/codegen/asm-target-clobbers.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "avx512" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-target-clobbers.avx512" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-C" "target-feature=+avx512f" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-target-clobbers.avx512/auxiliary" "--emit=llvm-ir"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
13 |     asm!("", out("zmm31") _, options(nostack, nomem, preserves_flags));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
20 |     asm!("", out("eax") _, options(nostack, nomem, preserves_flags));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option
error: aborting due to 2 previous errors


------------------------------------------
------------------------------------------


---- [codegen] codegen/asm-target-clobbers.rs#base stdout ----

error in revision `base`: compilation failed!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/codegen/asm-target-clobbers.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "base" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-target-clobbers.base" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/asm-target-clobbers.base/auxiliary" "--emit=llvm-ir"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
13 |     asm!("", out("zmm31") _, options(nostack, nomem, preserves_flags));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option

error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
20 |     asm!("", out("eax") _, options(nostack, nomem, preserves_flags));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option
error: aborting due to 2 previous errors


------------------------------------------
------------------------------------------


---- [codegen] codegen/naked-noinline.rs stdout ----

error: compilation failed!
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/codegen/naked-noinline.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/naked-noinline" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-O" "-Zmir-opt-level=3" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/naked-noinline/auxiliary" "--emit=llvm-ir"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: Intel syntax inline assembly requires LLVM 10.0.1 or later
   |
   |
17 |     asm!("", options(noreturn));
   |
   |
   = help: Consider using AT&T syntax instead with the att_syntax option
error: aborting due to previous error


------------------------------------------
---
test result: FAILED. 201 passed; 6 failed; 61 ignored; 0 measured; 0 filtered out; finished in 2.91s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/codegen" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "codegen" "--mode" "codegen" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-10/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "10.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcerror orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:12:32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants