rust/tests/codegen/asm
Guillaume Gomez 23bab15d73
Rollup merge of #133463 - taiki-e:aarch64-asm-x18, r=Amanieu
Fix handling of x18 in AArch64 inline assembly on ohos/trusty or with -Zfixed-x18

Currently AArch64 inline assembly allows using x18 on ohos/trusty or with -Zfixed-x18.

7db7489f9b/compiler/rustc_target/src/asm/aarch64.rs (L74-L76)

However, x18 is reserved in these environments and should not be allowed in the input/output operands of inline assemblies as it is in Android, Windows, etc..

7db7489f9b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs (L19)
7db7489f9b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs (L18)
7db7489f9b/compiler/rustc_codegen_llvm/src/llvm_util.rs (L764-L771)

(As for ohos, +reserve-x18 is [redundant](c417b7a695 (diff-0ddf23e0bf2b28b2d05f842f087d1e6f694e8e06d1765e8d0f10d47fddcdff9c)) since 7a966b9188 that starting using llvm's ohos targets. So removed it from target-spec.)

This fix may potentially break the code for tier 2 target (aarch64-unknown-linux-ohos). (As for others, aarch64-unknown-trusty is tier 3 and -Zfixed-x18 is unstable so breaking them should be fine.)
However, in any case, it seems suspicious that the code that is broken by this was sound.

r? `@Amanieu`

`@rustbot` label O-AArch64 +A-inline-assembly
2024-11-28 12:06:02 +01:00
..
aarch64-clobbers.rs Fix handling of x18 in AArch64 inline assembly on ohos/trusty or with -Zfixed-x18 2024-11-26 03:10:22 +09:00
foo.s
global_asm.rs
global_asm_include.rs
global_asm_x2.rs
goto.rs Make asm_goto_with_outputs a separate feature gate 2024-11-24 15:24:01 +00:00
hexagon-clobbers.rs Support predicate registers (clobber-only) in Hexagon inline assembly 2024-11-25 23:11:17 +09:00
may_unwind.rs
maybe-uninit.rs
msp430-clobbers.rs
multiple-options.rs
options.rs
powerpc-clobbers.rs
riscv-clobbers.rs Fix clobber_abi in RV32E and RV64E inline assembly 2024-11-25 00:36:22 +09:00
s390x-clobbers.rs Stabilize s390x inline assembly 2024-11-08 10:46:00 +09:00
sanitize-llvm.rs
sparc-clobbers.rs Basic inline assembly support for SPARC and SPARC64 2024-11-07 21:19:03 +09:00
x86-clobber_abi.rs
x86-clobbers.rs
x86-target-clobbers.rs