Commit Graph

1630 Commits

Author SHA1 Message Date
Matthias Krüger
12a7f06e3c
Rollup merge of #136194 - taiki-e:bpf-clobber-abi, r=amanieu
Support clobber_abi in BPF inline assembly

This supports [`clobber_abi`](https://doc.rust-lang.org/nightly/reference/inline-assembly.html#abi-clobbers) which is one of the requirements of stabilization mentioned in the tracking Issue for `asm_experimental_arch` (#93335).

Refs: [Section 1.1 "Registers and calling convention" in BPF ABI Recommended Conventions and Guidelines v1.0](https://github.com/torvalds/linux/blob/v6.13/Documentation/bpf/standardization/abi.rst#11registers-and-calling-convention)
> R0 - R5 are scratch registers and BPF programs needs to spill/fill them if necessary across calls.

cc `@alessandrod` `@dave-tucker` `@tamird` `@vadorovsky` (target maintainers mentioned in platform support document which will be added by https://github.com/rust-lang/rust/pull/135107)

r? `@Amanieu`

`@rustbot` label +O-eBPF +A-inline-assembly
2025-01-31 12:28:17 +01:00
bors
a730edcd67 Auto merge of #135030 - Flakebi:require-cpu, r=workingjubilee
Target option to require explicit cpu

Some targets have many different CPUs and no generic CPU that can be used as a default. For these targets, the user needs to explicitly specify a CPU through `-C target-cpu=`.

Add an option for targets and an error message if no CPU is set.

This affects the proposed amdgpu and avr targets.

amdgpu tracking issue: #135024
AVR MCP: https://github.com/rust-lang/compiler-team/issues/800
2025-01-30 20:21:50 +00:00
bors
a1d7676d6a Auto merge of #136227 - fmease:rollup-ewpvznh, r=fmease
Rollup of 9 pull requests

Successful merges:

 - #136121 (Deduplicate operand creation between scalars, non-scalars and string patterns)
 - #136134 (Fix SIMD codegen tests on LLVM 20)
 - #136153 (Locate asan-odr-win with other sanitizer tests)
 - #136161 (rustdoc: add nobuild typescript checking to our JS)
 - #136166 (interpret: is_alloc_live: check global allocs last)
 - #136168 (GCI: Don't try to eval / collect mono items inside overly generic free const items)
 - #136170 (Reject unsound toggling of Arm atomics-32 target feature)
 - #136176 (Render pattern types nicely in mir dumps)
 - #136186 (uefi: process: Fix args)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-29 11:27:18 +00:00
León Orell Valerian Liehr
0b1d717758
Rollup merge of #136170 - taiki-e:atomics-32, r=workingjubilee
Reject unsound toggling of Arm atomics-32 target feature

This target feature has the same semantics as RISC-V `forced-atomics` target feature that already marked as Forbidden  (f5ed0cb217) and toggling it can cause ABI incompatibility.

2f348cb7ce/compiler/rustc_target/src/target_features.rs (L479-L483)

[Comment on feature definition in LLVM](7109f52197/llvm/lib/Target/ARM/ARMFeatures.td (L572-L574)) also says:

> Code built with this feature is not ABI-compatible with code built without this feature, if atomic variables are exposed across the ABI boundary.

r? `@workingjubilee` or `@RalfJung`

`@rustbot` label +O-Arm
2025-01-29 06:03:24 +01:00
León Orell Valerian Liehr
7e123e4940
Rollup merge of #136147 - RalfJung:required-target-features-check-not-add, r=workingjubilee
ABI-required target features: warn when they are missing in base CPU

Part of https://github.com/rust-lang/rust/pull/135408:
instead of adding ABI-required features to the target we build for LLVM, check that they are already there. Crucially we check this after applying `-Ctarget-cpu` and `-Ctarget-feature`, by reading `sess.unstable_target_features`. This means we can tweak the ABI target feature check without changing the behavior for any existing user; they will get warnings but the target features behave as before.

The test changes here show that we are un-doing the "add all required target features" part. Without the full #135408, there is no way to take a way an ABI-required target feature with `-Ctarget-cpu`, so we cannot yet test that part.

Cc ``@workingjubilee``
2025-01-29 03:12:21 +01:00
Taiki Endo
e586382feb Support clobber_abi in BPF inline assembly 2025-01-29 02:14:25 +09:00
bors
66d6064f9e Auto merge of #134290 - tgross35:windows-i128-callconv, r=bjorn3,wesleywiser
Windows x86: Change i128 to return via the vector ABI

Clang and GCC both return `i128` in xmm0 on windows-msvc and windows-gnu. Currently, Rust returns the type on the stack. Add a calling convention adjustment so we also return scalar `i128`s using the vector ABI, which makes our `i128` compatible with C.

In the future, Clang may change to return `i128` on the stack for its `-msvc` targets (more at [1]). If this happens, the change here will need to be adjusted to only affect MinGW.

Link: https://github.com/rust-lang/rust/issues/134288 (does not fix) [1]

try-job: x86_64-msvc
try-job: x86_64-msvc-ext1
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
2025-01-28 06:11:13 +00:00
Taiki Endo
7f83f8ae72 Reject unsound toggling of Arm atomics-32 target feature 2025-01-28 14:11:33 +09:00
Ralf Jung
3f6ffa1462 update comments 2025-01-28 04:40:42 +01:00
Trevor Gross
a44a20ee4a Windows x86: Change i128 to return via the vector ABI
Clang and GCC both return `i128` in xmm0 on windows-msvc and
windows-gnu. Currently, Rust returns the type on the stack. Add a
calling convention adjustment so we also return scalar `i128`s using the
vector ABI, which makes our `i128` compatible with C.

In the future, Clang may change to return `i128` on the stack for its
`-msvc` targets (more at [1]). If this happens, the change here will
need to be adjusted to only affect MinGW.

Link: https://github.com/rust-lang/rust/issues/134288
2025-01-27 12:12:59 +00:00
Huang Qi
ebf53630db Mark all NuttX targets as tier 3 target and support the standard library
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-27 09:23:14 +08:00
bors
15c6f7e1a3 Auto merge of #136087 - jhpratt:rollup-tam1mzn, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - #133631 (Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only))
 - #134358 (compiler: Set `target_abi = "ilp32e"` on all riscv32e targets)
 - #135812 (Fix GDB `OsString` provider on Windows )
 - #135842 (TRPL: more backward-compatible Edition changes)
 - #135946 (Remove extra whitespace from rustdoc breadcrumbs for copypasting)
 - #135953 (ci.py: check the return code in `run-local`)
 - #136019 (Add an `unchecked_div` alias to the `Div<NonZero<_>>` impls)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-26 12:10:05 +00:00
Jacob Pratt
cecdb32d0f
Rollup merge of #134358 - workingjubilee:configure-my-riscv-abi, r=fmease
compiler: Set `target_abi = "ilp32e"` on all riscv32e targets

This allows compile-time configuration based on this. In the near future we should do this across all RISCV targets, probably, but this cfg is essential for building software usable on these targets, and they are tier 3 so it seems less of a concern to tweak their definition thusly.
2025-01-26 01:51:15 -05:00
Jacob Pratt
61e572b3f6
Rollup merge of #135785 - folkertdev:s390x-vector-passmode-direct, r=bjorn3
use `PassMode::Direct` for vector types on `s390x`

closes https://github.com/rust-lang/rust/issues/135744
tracking issue: https://github.com/rust-lang/rust/issues/130869

Previously, all vector types were type erased to `Ni8`, now we pass non-wrapped vector types directly. That skips emitting a bunch of casting logic in rustc, that LLVM then has to clean up. The initial LLVM IR is also a bit more readable.

This calling convention is tested extensively in `tests/assembly/s390x-vector-abi.rs`, showing that this change has no impact on the ABI in practice.

r? ````@taiki-e````
2025-01-25 23:26:59 -05:00
AkhilTThomas
3f045c9d2e add nto80 x86-64 and aarch64 target
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24 12:41:49 +00:00
Florian Bartels
62661f2592 Move common code to mod nto_qnx
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24 12:41:32 +00:00
Florian Bartels
efe53ddd58 Add support for QNX 7.1 with io-sock on x64
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24 12:32:20 +00:00
Florian Bartels
84c80151cf Add new target for supporting Neutrino QNX 6.1 with io-socket network stack on aarch64
Signed-off-by: Florian Bartels <Florian.Bartels@elektrobit.com>
2025-01-24 12:32:07 +00:00
bors
061ee95ce1 Auto merge of #135978 - matthiaskrgr:rollup-ni16gqr, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #133605 (Add extensive set of drop order tests)
 - #135489 (remove pointless allowed_through_unstable_modules on TryFromSliceError)
 - #135757 (Add NuttX support for AArch64 and ARMv7-A targets)
 - #135799 (rustdoc-json: Rename `Path::name` to `path`, and give it the path again.)
 - #135865 (For E0223, suggest associated functions that are similar to the path, even if the base type has multiple inherent impl blocks.)
 - #135890 (Implement `VecDeque::pop_front_if` & `VecDeque::pop_back_if`)
 - #135914 (Remove usages of `QueryNormalizer` in the compiler)
 - #135936 (fix reify-intrinsic test)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-24 08:28:35 +00:00
Matthias Krüger
042da354e9
Rollup merge of #135757 - no1wudi:master, r=compiler-errors
Add NuttX support for AArch64 and ARMv7-A targets

This patch adds tier 3 support for AArch64 and ARMv7-A targets in NuttX, including:
- AArch64 target: aarch64-unknown-nuttx
- ARMv7-A target: armv7a-nuttx-eabi, armv7a-nuttx-eabihf
- Thumbv7-A target: thumbv7a-nuttx-eabi, thumbv7a-nuttx-eabihf
2025-01-24 08:08:07 +01:00
Matthias Krüger
b3fcd5697c
Rollup merge of #135905 - workingjubilee:softly-sanitize-aarch64-floats, r=rcvalle
Enable kernel sanitizers for aarch64-unknown-none-softfloat

We want kernels to be able to use this bare metal target, so let's enable the sanitizers that kernels want to use.

cc ```@rcvalle``` ```@ojeda``` ```@maurer```
2025-01-24 00:15:57 +01:00
Matthias Krüger
27155e5ced
Rollup merge of #135790 - wesleywiser:update_windows_gnu_debuginfokind, r=lqd
Update windows-gnu targets to set `DebuginfoKind::DWARF`

These targets have always used DWARF debuginfo and not CodeView/PDB debuginfo like the MSVC Windows targets. However, their target definitions claim to use `DebuginfoKind::PDB` probably to ensure that we do not try to allow the use of split-DWARF debuginfo.

This does not appear to be necessary since the targets set their supported split debug info to `Off`. I've looked at all of the uses of these properties and this patch does not appear to cause any functional changes in compiler behavior. I also added UI tests to attempt to validate there is no change in the behavior of these options on stable compilers.

cc ````@mati865```` since you mentioned this in #135739
cc ````@davidtwco```` for split-dwarf
2025-01-23 09:49:22 +01:00
Jubilee Young
6b06aa6192 Enable kernel sanitizers for aarch64-unknown-none-softfloat
We want kernels to be able to use this bare metal target, so
let's enable the sanitizers that kernels want to use.
2025-01-22 14:09:18 -08:00
Matthias Krüger
df01040860
Rollup merge of #134396 - mustartt:byval-pointer-natural-alignment, r=wesleywiser
AIX: use align 8 for byval parameter

On AIX, byval pointer arguments are aligned to 8 bytes based on the 64bit register size. For example, the C callee https://godbolt.org/z/5f4vnG6bh will expect the following argument.

```
ptr nocapture noundef readonly byval(%struct.TwoU64s) align 8 %0
```

This case is captured by `run-make/extern-fn-explicit-align`
2025-01-22 19:29:38 +01:00
Wesley Wiser
0b24fc9936 Set DebuginfoKind::Dwarf for *-windows-gnu and *-windows-gnullvm
These targets have always generated DWARF debuginfo and not CodeView/PDB debuginfo
like the MSVC Windows targets. Correct their target definitions to reflect this.

The newly added tests for the various combinations of `*-windows-gnu*` targets and
`-Csplit-debuginfo` show that this does not change any stable behavior.
2025-01-20 15:38:09 -06:00
Folkert de Vries
893d81f1e2
on s390x, use PassMode::Direct for vector types 2025-01-20 21:02:21 +01:00
Huang Qi
0fe555a84d Add NuttX support for AArch64 and ARMv7-A targets
This patch adds tier 3 support for AArch64 and ARMv7-A targets in NuttX,
including:
- AArch64 target: aarch64-unknown-nuttx
- ARMv7-A target: armv7a-nuttx-eabi, armv7a-nuttx-eabihf
- Thumbv7-A target: thumbv7a-nuttx-eabi, thumbv7a-nuttx-eabihf

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-20 16:33:04 +08:00
bors
bcd0683e5d Auto merge of #135534 - folkertdev:fix-wasm-i128-f128, r=tgross35
use indirect return for `i128` and `f128` on wasm32

fixes #135532

Based on https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md we now use an indirect return for  `i128`, `u128` and `f128`. That is what LLVM ended up doing anyway.

r? `@bjorn3`
2025-01-17 15:07:28 +00:00
bors
0c2c096e1a Auto merge of #135047 - Flakebi:amdgpu-kernel-cc, r=workingjubilee
Add gpu-kernel calling convention

The amdgpu-kernel calling convention was reverted in commit f6b21e90d1 (#120495 and https://github.com/rust-lang/rust-analyzer/pull/16463) due to inactivity in the amdgpu target.

Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for.

Tracking issue: #135467
amdgpu target tracking issue: #135024
2025-01-17 04:36:09 +00:00
Folkert de Vries
702134a930
use indirect return for i128 and f128 on wasm32 2025-01-16 13:25:40 +01:00
Flakebi
53238c3db6
Target option to require explicit cpu
Some targets have many different CPUs and no generic CPU that can be
used as a default. For these targets, the user needs to explicitly
specify a CPU through `-C target-cpu=`.

Add an option for targets and an error message if no CPU is set.

This affects the proposed amdgpu and avr targets.
2025-01-16 01:22:50 +01:00
Flakebi
e7e5202978
Add gpu-kernel calling convention
The amdgpu-kernel calling convention was reverted in commit
f6b21e90d1 due to inactivity in the amdgpu
target.

Introduce a `gpu-kernel` calling convention that translates to
`ptx_kernel` or `amdgpu_kernel`, depending on the target that rust
compiles for.
2025-01-16 00:26:55 +01:00
Ralf Jung
675a1036ca on Windows, consistently pass ZST by-ref 2025-01-12 13:32:36 +01:00
Ralf Jung
d760bb6603 fix ZST handling for Windows ABIs on MSVC target 2025-01-10 12:16:49 +01:00
Matthias Krüger
dd0f586b0a
Rollup merge of #134609 - tbu-:pr_win7_gnu, r=davidtwco
Add new `{x86_64,i686}-win7-windows-gnu` targets

These are in symmetry with `{x86_64,i686}-win7-windows-msvc`.

> ## Tier 3 target policy
>
> At this tier, the Rust project provides no official support for a target, so we
> place minimal requirements on the introduction of targets.
>
> A proposed new tier 3 target must be reviewed and approved by a member of the
> compiler team based on these requirements. The reviewer may choose to gauge
> broader compiler team consensus via a [Major Change Proposal (MCP)][https://forge.rust-lang.org/compiler/mcp.html].
>
> A proposed target or target-specific patch that substantially changes code
> shared with other targets (not just target-specific code) must be reviewed and
> approved by the appropriate team for that shared code before acceptance.
>
> - A tier 3 target must have a designated developer or developers (the "target
>   maintainers") on record to be CCed when issues arise regarding the target.
>   (The mechanism to track and CC such developers may evolve over time.)

This is me, `@tbu-` on github.

> - Targets must use naming consistent with any existing targets; for instance, a
>   target for the same CPU or OS as an existing Rust target should use the same
>   name for that CPU or OS. Targets should normally use the same names and
>   naming conventions as used elsewhere in the broader ecosystem beyond Rust
>   (such as in other toolchains), unless they have a very good reason to
>   diverge. Changing the name of a target can be highly disruptive, especially
>   once the target reaches a higher tier, so getting the name right is important
>   even for a tier 3 target.
>   - Target names should not introduce undue confusion or ambiguity unless
>     absolutely necessary to maintain ecosystem compatibility. For example, if
>     the name of the target makes people extremely likely to form incorrect
>     beliefs about what it targets, the name should be changed or augmented to
>     disambiguate it.
>   - If possible, use only letters, numbers, dashes and underscores for the name.
>     Periods (`.`) are known to cause issues in Cargo.

Consistent with `{x86_64,i686}-win7-windows-msvc`, see also #118150.

> - Tier 3 targets may have unusual requirements to build or use, but must not
>   create legal issues or impose onerous legal terms for the Rust project or for
>   Rust developers or users.
>   - The target must not introduce license incompatibilities.
>   - Anything added to the Rust repository must be under the standard Rust
>     license (`MIT OR Apache-2.0`).
>   - The target must not cause the Rust tools or libraries built for any other
>     host (even when supporting cross-compilation to the target) to depend
>     on any new dependency less permissive than the Rust licensing policy. This
>     applies whether the dependency is a Rust crate that would require adding
>     new license exceptions (as specified by the `tidy` tool in the
>     rust-lang/rust repository), or whether the dependency is a native library
>     or binary. In other words, the introduction of the target must not cause a
>     user installing or running a version of Rust or the Rust tools to be
>     subject to any new license requirements.
>   - Compiling, linking, and emitting functional binaries, libraries, or other
>     code for the target (whether hosted on the target itself or cross-compiling
>     from another target) must not depend on proprietary (non-FOSS) libraries.
>     Host tools built for the target itself may depend on the ordinary runtime
>     libraries supplied by the platform and commonly used by other applications
>     built for the target, but those libraries must not be required for code
>     generation for the target; cross-compilation to the target must not require
>     such libraries at all. For instance, `rustc` built for the target may
>     depend on a common proprietary C runtime library or console output library,
>     but must not depend on a proprietary code generation library or code
>     optimization library. Rust's license permits such combinations, but the
>     Rust project has no interest in maintaining such combinations within the
>     scope of Rust itself, even at tier 3.
>   - "onerous" here is an intentionally subjective term. At a minimum, "onerous"
>     legal/licensing terms include but are *not* limited to: non-disclosure
>     requirements, non-compete requirements, contributor license agreements
>     (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms,
>     requirements conditional on the employer or employment of any particular
>     Rust developers, revocable terms, any requirements that create liability
>     for the Rust project or its developers or users, or any requirements that
>     adversely affect the livelihood or prospects of the Rust project or its
>     developers or users.

AFAICT, it's the same legal situation as the tier 1 `{x86_64,i686}-pc-windows-gnu`.

> - Neither this policy nor any decisions made regarding targets shall create any
>   binding agreement or estoppel by any party. If any member of an approving
>   Rust team serves as one of the maintainers of a target, or has any legal or
>   employment requirement (explicit or implicit) that might affect their
>   decisions regarding a target, they must recuse themselves from any approval
>   decisions regarding the target's tier status, though they may otherwise
>   participate in discussions.
>   - This requirement does not prevent part or all of this policy from being
>     cited in an explicit contract or work agreement (e.g. to implement or
>     maintain support for a target). This requirement exists to ensure that a
>     developer or team responsible for reviewing and approving a target does not
>     face any legal threats or obligations that would prevent them from freely
>     exercising their judgment in such approval, even if such judgment involves
>     subjective matters or goes beyond the letter of these requirements.

Understood.

> - Tier 3 targets should attempt to implement as much of the standard libraries
>   as possible and appropriate (`core` for most targets, `alloc` for targets
>   that can support dynamic memory allocation, `std` for targets with an
>   operating system or equivalent layer of system-provided functionality), but
>   may leave some code unimplemented (either unavailable or stubbed out as
>   appropriate), whether because the target makes it impossible to implement or
>   challenging to implement. The authors of pull requests are not obligated to
>   avoid calling any portions of the standard library on the basis of a tier 3
>   target not implementing those portions.

This target supports the whole libstd surface, since it's essentially reusing all of the x86_64-pc-windows-gnu target. Understood.

> - The target must provide documentation for the Rust community explaining how
>   to build for the target, using cross-compilation if possible. If the target
>   supports running binaries, or running tests (even if they do not pass), the
>   documentation must explain how to run such binaries or tests for the target,
>   using emulation if possible or dedicated hardware if necessary.

I tried to write some documentation on that.

> - Tier 3 targets must not impose burden on the authors of pull requests, or
>   other developers in the community, to maintain the target. In particular,
>   do not post comments (automated or manual) on a PR that derail or suggest a
>   block on the PR based on a tier 3 target. Do not send automated messages or
>   notifications (via any medium, including via ``@`)` to a PR author or others
>   involved with a PR regarding a tier 3 target, unless they have opted into
>   such messages.
>   - Backlinks such as those generated by the issue/PR tracker when linking to
>     an issue or PR are not considered a violation of this policy, within
>     reason. However, such messages (even on a separate repository) must not
>     generate notifications to anyone involved with a PR who has not requested
>     such notifications.

Understood.

> - Patches adding or updating tier 3 targets must not break any existing tier 2
>   or tier 1 target, and must not knowingly break another tier 3 target without
>   approval of either the compiler team or the maintainers of the other tier 3
>   target.
>   - In particular, this may come up when working on closely related targets,
>     such as variations of the same architecture with different features. Avoid
>     introducing unconditional uses of features that another variation of the
>     target may not have; use conditional compilation or runtime detection, as
>     appropriate, to let each target run code supported by that target.
> - Tier 3 targets must be able to produce assembly using at least one of
>   rustc's supported backends from any host target. (Having support in a fork
>   of the backend is not sufficient, it must be upstream.)

Understood.

> If a tier 3 target stops meeting these requirements, or the target maintainers
> no longer have interest or time, or the target shows no signs of activity and
> has not built for some time, or removing the target would improve the quality
> of the Rust codebase, we may post a PR to remove it; any such PR will be CCed
> to the target maintainers (and potentially other people who have previously
> worked on the target), to check potential interest in improving the situation.
>

Understood.

r? compiler-team
2025-01-09 06:02:40 +01:00
Jacob Pratt
57eb95ca6f
Rollup merge of #135203 - RalfJung:arm-soft-float, r=workingjubilee
arm: add unstable soft-float target feature

This has an actual usecase as mentioned [here](https://github.com/rust-lang/rust/issues/116344#issuecomment-2575324988), and with my recent ARM float ABI changes there shouldn't be any soundness concerns any more. We will reject enabling this feature on `hf` targets, but disabling it on non-`hf` targets is entirely fine -- the target feature refers to whether softfloat emulation is used for float instructions, and is independent of the ABI which we set separately via `llvm_floatabi`.

Cc ``@workingjubilee``
2025-01-08 00:52:49 -05:00
Ralf Jung
427abb69bf arm: add unstable soft-float target feature 2025-01-07 16:13:43 +01:00
B I Mohammed Abbas
af15e048b2 Reserve x18 register for aarch64 wrs vxworks target 2025-01-07 09:18:31 +05:30
Tobias Bucher
8630234ebc Add new {x86_64,i686}-win7-windows-gnu targets
These are in symmetry with `{x86_64,i686}-win7-windows-msvc`.
2025-01-06 15:32:17 +01:00
bors
fd98df8f14 Auto merge of #135085 - knickish:m68k_unknown_none, r=workingjubilee
add m68k-unknown-none-elf target

r? `@workingjubilee`

The existing `m68k-unknown-linux-gnu` target builds `std` by default, requires atomics, and has a base cpu with an fpu. A smaller/more embedded target is desirable both to have a baseline target for the ISA, as well to make debugging easier for working on the llvm backend. Currently this target is using the `M68010` as the minimum CPU due, but as missing features are merged into the `M68k` llvm backend I am hoping to lower this further.

I have been able to build very small crates using a toolchain built against this target (together with a later version of `object`) using the configuration described in the target platform-support documentation, although getting anything of substantial complexity to build quickly hits errors in the llvm backend
2025-01-06 05:23:55 +00:00
bors
feb32c6546 Auto merge of #134794 - RalfJung:abi-required-target-features, r=workingjubilee
Add a notion of "some ABIs require certain target features"

I think I finally found the right shape for the data and checks that I recently added in https://github.com/rust-lang/rust/pull/133099, https://github.com/rust-lang/rust/pull/133417, https://github.com/rust-lang/rust/pull/134337: we have a notion of "this ABI requires the following list of target features, and it is incompatible with the following list of target features". Both `-Ctarget-feature` and `#[target_feature]` are updated to ensure we follow the rules of the ABI.  This removes all the "toggleability" stuff introduced before, though we do keep the notion of a fully "forbidden" target feature -- this is needed to deal with target features that are actual ABI switches, and hence are needed to even compute the list of required target features.

We always explicitly (un)set all required and in-conflict features, just to avoid potential trouble caused by the default features of whatever the base CPU is. We do this *before* applying `-Ctarget-feature` to maintain backward compatibility; this poses a slight risk of missing some implicit feature dependencies in LLVM but has the advantage of not breaking users that deliberately toggle ABI-relevant target features. They get a warning but the feature does get toggled the way they requested.

For now, our logic supports x86, ARM, and RISC-V (just like the previous logic did). Unsurprisingly, RISC-V is the nicest. ;)

As a side-effect this also (unstably) allows *enabling* `x87` when that is harmless. I used the opportunity to mark SSE2 as required on x86-64, to better match the actual logic in LLVM and because all x86-64 chips do have SSE2. This infrastructure also prepares us for requiring SSE on x86-32 when we want to use that for our ABI (and for float semantics sanity), see https://github.com/rust-lang/rust/issues/133611, but no such change is happening in this PR.

r? `@workingjubilee`
2025-01-05 23:21:06 +00:00
Ralf Jung
2e64b5352b add dedicated type for ABI target feature constraints 2025-01-05 10:46:30 +01:00
bors
7270e73b62 Auto merge of #135074 - wzssyqa:mips-mti, r=oli-obk
Target: Add mips mti baremetal support

Do the same thing as gcc, which use the vendor `mti` to mark the toolchain as MIPS32r2 default.

We support both big endian and little endian flavor:
  mips-mti-none-elf
  mipsel-mti-none-elf
2025-01-05 07:01:38 +00:00
kirk
ff7f818fc7 change to static relocation model 2025-01-05 05:04:34 +00:00
knickish
139ca10f65
Apply suggestions from workingjubilee's code review
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-01-04 12:52:19 -06:00
Matthias Krüger
4cd289550f
Rollup merge of #133420 - thesummer:rtems-unwind, r=workingjubilee
Switch rtems target to panic unwind

Switch the RTEMS target to `panic_unwind`.

Relates to https://github.com/rust-lang/backtrace-rs/pull/682
2025-01-03 22:12:41 +01:00
kirk
2287491480 add m68k-unknown-none-elf target 2025-01-03 21:09:11 +00:00
YunQiang Su
5a0ce36232 Target: Add mips mti baremetal support
Do the same thing as gcc, which use the vendor `mti` to mark
the toolchain as MIPS32r2 default.

We support both big endian and little endian flavor:
  mips-mti-none-elf
  mipsel-mti-none-elf
2025-01-03 22:23:49 +08:00
Ralf Jung
43ede97ebf arm: use target.llvm_floatabi over soft-float target feature 2024-12-31 12:41:20 +01:00
Ralf Jung
912b7291d0 add ABI target features *before* -Ctarget-features 2024-12-31 12:41:20 +01:00