about summary refs log tree commit diff
path: root/tests/ui/abi
AgeCommit message (Collapse)AuthorLines
2023-12-14Auto merge of #118491 - cuviper:aarch64-stack-probes, r=wesleywiserbors-2/+6
Enable stack probes on aarch64 for LLVM 18 I tested this on `aarch64-unknown-linux-gnu` with LLVM main (~18). cc #77071, to be closed once we upgrade our LLVM submodule.
2023-12-11Auto merge of #118032 - RalfJung:char-u32, r=Mark-Simulacrumbors-0/+7
guarantee that char and u32 are ABI-compatible In https://github.com/rust-lang/rust/pull/116894 we added a guarantee that `char` has the same alignment as `u32`, but there is still one axis where these types could differ: function call ABI. So let's nail that down as well: in a function signature, `char` and `u32` are completely equivalent. This is a new stable guarantee, so it will need t-lang approval.
2023-12-08update target feature following LLVM API changeKrasimir Georgiev-2/+2
LLVM commit https://github.com/llvm/llvm-project/commit/e81796671890b59c110f8e41adc7ca26f8484d20 renamed the `unaligned-scalar-mem` target feature to `fast-unaligned-access`.
2023-12-07Enable stack probes on aarch64 for LLVM 18Josh Stone-2/+6
2023-11-25Auto merge of #118127 - RalfJung:unadjusted-abi, r=compiler-errorsbors-0/+54
the unadjusted ABI needs to pass aggregates by-value Fixes https://github.com/rust-lang/rust/issues/118124, a regression introduced in https://github.com/rust-lang/rust/pull/117500
2023-11-24Show number in error message even for one errorNilstrieb-1/+1
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-22add a testRalf Jung-0/+54
2023-11-19Auto merge of #117500 - RalfJung:aggregate-abi, r=davidtwcobors-11/+57
Ensure sanity of all computed ABIs This moves the ABI sanity assertions from the codegen backend to the ABI computation logic. Sadly, due to past mistakes, we [have to](https://github.com/rust-lang/rust/pull/117351#issuecomment-1788495503) be able to compute a sane ABI for nonsensical function types like `extern "C" fn(str) -> str`. So to make the sanity check pass we first need to make all ABI adjustment deal with unsized types... and we have no shared infrastructure for those adjustments, so that's a bunch of copy-paste. At least we have assertions failing loudly when one accidentally sets a different mode for an unsized argument. To achieve this, this re-lands the parts of https://github.com/rust-lang/rust/pull/80594 that got reverted in https://github.com/rust-lang/rust/pull/81388. To avoid breaking wasm ABI again, that ABI now explicitly opts-in to the (wrong, broken) ABI that we currently keep for backwards compatibility. That's still better than having *every* ABI use the wrong broken default! Cc `@bjorn3` Fixes https://github.com/rust-lang/rust/issues/115845
2023-11-19disable csky test on CIRalf Jung-3/+5
2023-11-18guarantee that char and u32 are ABI-compatibleRalf Jung-0/+7
2023-11-17Rollup merge of #117338 - workingjubilee:asmjs-meets-thanatos, r=b-naberMatthias Krüger-5/+0
Remove asmjs Fulfills [MCP 668](https://github.com/rust-lang/compiler-team/issues/668). `asmjs-unknown-emscripten` does not work as-specified, and lacks essential upstream support for generating asm.js, so it should not exist at all.
2023-11-07test and fix some more targetsRalf Jung-0/+9
2023-11-07add regression testRalf Jung-8/+30
2023-11-04document ABI compatibilityRalf Jung-4/+4
2023-11-03default Aggregate ABI to Indirect, and make sure it's never used for unsizedRalf Jung-0/+11
2023-11-03move ABI sanity check from LLVM codegen backend to ABI computation logicRalf Jung-3/+5
2023-10-28Remove asmjs from testsJubilee Young-5/+0
2023-10-24tests/ui/abi/compatibility: Set min-llvm-version to 17 for LoongArch64WANG Rui-0/+1
2023-09-29Rollup merge of #116263 - ferrocene:pa-more-bare-metal-fixes, r=oli-obkMatthias Krüger-2/+1
More fixes for running the test suite on a bare metal target This PR adds more fixes needed to run the test suite on bare metal targets (in this case, without unwinding and with static relocations). There is no CI job exercising tests without unwinds, but I can confirm this worked in Ferrocene's CI.
2023-09-29add needs-relocation-model-pic to compiletestPietro Albini-2/+1
2023-09-22run abi/compatibility test against a whole bunch of targetsRalf Jung-10/+173
2023-09-20tests/ui/abi: Enable repr(transparent) union ABI tests on LoongArch64WANG Rui-2/+0
2023-09-19tests/ui/abi: Enable repr(transparent) union ABI tests on RISC-Vmsizanoen-2/+1
2023-09-17Rollup merge of #115654 - RalfJung:pass-mode-cast, r=compiler-errorsDylan DPC-2/+2
improve PassMode docs
2023-09-15special case `TyAndLayout` debug implBoxy-16/+15
2023-09-15clarify PassMode::Indirect as wellRalf Jung-2/+2
2023-09-12add some DispatchFromDyn ABI compatibility testsRalf Jung-0/+5
2023-09-12add enough cfg to make the test pass on problematic targetsRalf Jung-14/+39
2023-09-12also test ABI-compatibility for some unsized typesRalf Jung-2/+19
2023-09-12make sure the types in the ABI compat test actually type-checkRalf Jung-2/+5
2023-09-11Rollup merge of #115708 - RalfJung:homogeneous, r=davidtwcoMatthias Krüger-8/+2
fix homogeneous_aggregate not ignoring some ZST This is an ABI-breaking change, because it fixes bugs in our ABI code. I'm not sure what that means for this PR, we don't really have a process for such changes, do we? I can only hope nobody relied on the old buggy behavior. Fixes https://github.com/rust-lang/rust/issues/115664
2023-09-11Disentangle `Debug` and `Display` for `Ty`.Nicholas Nethercote-15/+16
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attribute) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.
2023-09-10fix homogeneous_aggregate not ignoring some 1-ZSTRalf Jung-8/+2
2023-09-09better spans for WF errorsRalf Jung-2/+2
2023-09-09use hir_crate_items(()).definitions() instead of hir().items()Ralf Jung-94/+94
2023-09-09rustc_layout, rustc_abi: make sure the types are well-formedRalf Jung-5/+19
2023-09-08need to disable part of this test on armRalf Jung-1/+8
2023-09-08add a testcase for another MIPS64 bugRalf Jung-0/+1
2023-09-08also ensure that size and alignment are the sameRalf Jung-3/+154
2023-09-08merge transparent-abi test into general abi compatibility test, and test ↵Ralf Jung-81/+42
repr(transparent) unions
2023-09-08add tests for RFC 3391Ralf Jung-0/+25
2023-09-08accept some differences for rustc_abi(assert_eq), so that we can test more ↵Ralf Jung-1/+373
things to be compatible
2023-09-07add support for rustc_abi(assert_eq) and use it to test some ↵Ralf Jung-1/+232
repr(transparent) cases
2023-09-06rustc_layout/abi: error when attribute is applied to the wrong thingRalf Jung-6/+27
2023-09-06rustc_abi: also support debugging function pointersRalf Jung-6/+102
2023-08-27add rustc_abi debugging attributeRalf Jung-0/+283
2023-08-25Auto merge of #114201 - Centri3:explicit-repr-rust, r=WaffleLapkinbors-0/+12
Allow explicit `#[repr(Rust)]` This is identical to no `repr()` at all. For `Rust, packed` and `Rust, align(x)`, it should be the same as no `Rust` at all (as, afaik, `#[repr(align(16))]` uses the Rust ABI.) The main use case for this is being able to explicitly say "I want to use the Rust ABI" in very very rare circumstances where the first obvious choice would be the C ABI yet is undesirable, which is already possible with functions as `extern "Rust"`. This would be useful for silencing https://github.com/rust-lang/rust-clippy/pull/11253. It's also more consistent with `extern`. The lack of this also tripped me up a bit when I was new to Rust, as I expected this to be possible.
2023-08-18Add the relocation_model to the cfgLuca Barbato-0/+9
This way is possible to write inline assembly code aware of it.
2023-08-08feat: `riscv-interrupt-{m,s}` calling conventionsSeth Pellegrino-45/+292
Similar to prior support added for the mips430, avr, and x86 targets this change implements the rough equivalent of clang's [`__attribute__((interrupt))`][clang-attr] for riscv targets, enabling e.g. ```rust static mut CNT: usize = 0; pub extern "riscv-interrupt-m" fn isr_m() { unsafe { CNT += 1; } } ``` to produce highly effective assembly like: ```asm pub extern "riscv-interrupt-m" fn isr_m() { 420003a0: 1141 addi sp,sp,-16 unsafe { CNT += 1; 420003a2: c62a sw a0,12(sp) 420003a4: c42e sw a1,8(sp) 420003a6: 3fc80537 lui a0,0x3fc80 420003aa: 63c52583 lw a1,1596(a0) # 3fc8063c <_ZN12esp_riscv_rt3CNT17hcec3e3a214887d53E.0> 420003ae: 0585 addi a1,a1,1 420003b0: 62b52e23 sw a1,1596(a0) } } 420003b4: 4532 lw a0,12(sp) 420003b6: 45a2 lw a1,8(sp) 420003b8: 0141 addi sp,sp,16 420003ba: 30200073 mret ``` (disassembly via `riscv64-unknown-elf-objdump -C -S --disassemble ./esp32c3-hal/target/riscv32imc-unknown-none-elf/release/examples/gpio_interrupt`) This outcome is superior to hand-coded interrupt routines which, lacking visibility into any non-assembly body of the interrupt handler, have to be very conservative and save the [entire CPU state to the stack frame][full-frame-save]. By instead asking LLVM to only save the registers that it uses, we defer the decision to the tool with the best context: it can more accurately account for the cost of spills if it knows that every additional register used is already at the cost of an implicit spill. At the LLVM level, this is apparently [implemented by] marking every register as "[callee-save]," matching the semantics of an interrupt handler nicely (it has to leave the CPU state just as it found it after its `{m|s}ret`). This approach is not suitable for every interrupt handler, as it makes no attempt to e.g. save the state in a user-accessible stack frame. For a full discussion of those challenges and tradeoffs, please refer to [the interrupt calling conventions RFC][rfc]. Inside rustc, this implementation differs from prior art because LLVM does not expose the "all-saved" function flavor as a calling convention directly, instead preferring to use an attribute that allows for differentiating between "machine-mode" and "superivsor-mode" interrupts. Finally, some effort has been made to guide those who may not yet be aware of the differences between machine-mode and supervisor-mode interrupts as to why no `riscv-interrupt` calling convention is exposed through rustc, and similarly for why `riscv-interrupt-u` makes no appearance (as it would complicate future LLVM upgrades). [clang-attr]: https://clang.llvm.org/docs/AttributeReference.html#interrupt-risc-v [full-frame-save]: https://github.com/esp-rs/esp-riscv-rt/blob/9281af2ecffe13e40992917316f36920c26acaf3/src/lib.rs#L440-L469 [implemented by]: https://github.com/llvm/llvm-project/blob/b7fb2a3fec7c187d58a6d338ab512d9173bca987/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp#L61-L67 [callee-save]: https://github.com/llvm/llvm-project/blob/973f1fe7a8591c7af148e573491ab68cc15b6ecf/llvm/lib/Target/RISCV/RISCVCallingConv.td#L30-L37 [rfc]: https://github.com/rust-lang/rfcs/pull/3246
2023-08-07Fix stack-protector.rs on LLVM 17Nikita Popov-0/+2
Prevent fill from being (correctly) optimized away by passing the address of the alloca to black_box.