Commit Graph

2001 Commits

Author SHA1 Message Date
nora
9ccaf080cb Fill out AVR target metadata
This will make `-Zbuild-std` automatically build the right crates, notably not building `std` by default, which will both be useful for users and also fix the build for https://does-it-build.noratrieb.dev.
2025-10-05 12:01:23 +02:00
Matthias Krüger
30442dc496 Rollup merge of #147300 - esp-rs:xtensa-meta, r=saethlin
Add xtensa arch to object file creation

Just something that was missed in the xtensa target PRs.
2025-10-03 21:10:34 +02:00
Scott Mabin
3f9c493da1 Add xtensa arch to object file creation 2025-10-03 16:10:26 +01:00
bors
f437c86ef8 Auto merge of #143613 - Enselic:panic-abort-uwtables, r=petrochenkov
Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default

The linux backtrace unwinder relies on unwind tables to work properly, and generating and printing a backtrace is done by for example the default panic hook.

Begin emitting unwind tables by default again with `-C panic=abort` (see history below) so that backtraces work.

Closes https://github.com/rust-lang/rust/issues/81902 which is **regression-from-stable-to-stable**
Closes https://github.com/rust-lang/rust/issues/94815

### History

Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C panic=abort` (see https://github.com/rust-lang/rust/pull/45031 and https://github.com/rust-lang/rust/issues/81902#issuecomment-3046487084).

In 1.45 a workaround in the form of `-C force-unwind-tables=yes` was added (see https://github.com/rust-lang/rust/pull/69984).

`-C panic=abort` was added in [Rust 1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable) and the motivation was binary size and compile time. But given how confusing that behavior has turned out to be, it is better to make binary size optimization opt-in with `-C force-unwind-tables=no` rather than default since the current default breaks backtraces.

Besides, if binary size is a primary concern, there are many other tricks that can be used that has a higher impact.

# Release Note Entry Draft:

## Compatibility Notes

* [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](https://github.com/rust-lang/rust/pull/143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.

try-job: aarch64-apple
try-job: armhf-gnu
try-job: aarch64-msvc-1
2025-10-03 15:02:37 +00:00
Martin Nordholts
fe66eaa67a Fix backtraces with -C panic=abort on linux; emit unwind tables by default
The linux backtrace unwinder relies on unwind tables to work properly,
and generating and printing a backtrace is done by for example the
default panic hook.

Begin emitting unwind tables by default again with `-C panic=abort` (see
history below) so that backtraces work.

History
=======

Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in
Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C
panic=abort` (see 24cc38e3b0).

In 1.45 (see cda994633e) a workaround in the form
of `-C force-unwind-tables=yes` was added.

`-C panic=abort` was added in [Rust
1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable)
and the motivation was binary size and compile time. But given how
confusing that behavior has turned out to be, it is better to make
binary size optimization opt-in with `-C force-unwind-tables=no` rather
than default since the current default breaks backtraces.

Besides, if binary size is a primary concern, there are many other
tricks that can be used that has a higher impact.
2025-10-02 19:46:41 +02:00
daxpedda
3e8ce2bda9 Adjust WASI and WALI targets 2025-10-01 17:43:53 +02:00
Matthias Krüger
0d78b1e657 Rollup merge of #146518 - madsmtm:ld-reproducible-doc, r=SparrowLii
Improve the documentation around `ZERO_AR_DATE`

In particular, document why we don't use the new `-reproducible` flag.

I went through [the source for Apple's old linker](https://github.com/apple-oss-distributions/ld64), and compared the versions with [the mapping to Xcode versions on Wikipedia](https://en.wikipedia.org/wiki/Xcode) to find the relevant Xcode versions for these features.

r? compiler
2025-09-30 21:53:33 +02:00
Stuart Cook
cd6f32a4eb Rollup merge of #147134 - workingjubilee:remove-explicit-abialign-deref, r=Zalathar
remove explicit deref of AbiAlign for most methods

Much of the compiler calls functions on Align projected from AbiAlign. AbiAlign impls Deref to its inner Align, so we can simplify these away. Also, it will minimize disruption when AbiAlign is removed.

For now, preserve usages that might resolve to PartialOrd or PartialEq, as those have odd inference.
2025-09-29 15:44:55 +10:00
Jubilee Young
0c9d0dfe04 remove explicit deref of AbiAlign for most methods
Much of the compiler calls functions on Align projected from AbiAlign.
AbiAlign impls Deref to its inner Align, so we can simplify these away.
Also, it will minimize disruption when AbiAlign is removed.

For now, preserve usages that might resolve to PartialOrd or PartialEq,
as those have odd inference.
2025-09-28 15:02:14 -07:00
Jubilee Young
b3f3e36c72 compiler: remove AbiAlign inside TargetDataLayout
This maintains AbiAlign usage in public API and most of the compiler,
but direct access of these fields is now in terms of Align only.
2025-09-27 22:13:53 -07:00
Matthias Krüger
ebe90c7ae7 Rollup merge of #146758 - mati865:amd64_mingw_no_rs_objects, r=petrochenkov
Stop linking rs{begin,end} objects on x86_64-*-windows-gnu

Until now, x86_64-pc-windows-gnu linked `rsbegin.o` and `rsend.o` just like i686-pc-windows-gnu, even though they were no-ops for it. This was likely done for the simplicity back when it was introduced.
Today the things are different and these startup/end objects harm other features, like `build-std`. Given the demotion of i686-pc-windows-gnu from tier 1, there is no point in hurting x86_64-pc-windows-gnu, which remains a tier 1.

The files are still shipped in case downstream crates expect them, as in case of the unmaintained `xargo`.

Fixes https://github.com/rust-lang/rust/issues/146739
2025-09-26 18:11:10 +02:00
Matthias Krüger
024fbad4a0 Rollup merge of #146523 - thejpster:demote-armebv7r-targets, r=jackh726
Demote both armebv7r-none-* targets.

OK, slightly more controversial than https://github.com/rust-lang/rust/pull/146520 and https://github.com/rust-lang/rust/pull/146522  - I'd like to drop the bare-metal **big-endian** Armv7-R targets down to Tier 3.

The reason is simple - we cannot test them in https://github.com/rust-embedded/cortex-ar/. This because QEMU support for Big Endian Armv7-R is broken. I tried quite hard, but all the strings I printed with semihosting came out byte swapped (or "etybawa depp") because of how QEMU kludges the access to memory in big-endian mode.

The target also has only a single maintainer. Although, if ````@chrisnc```` wants to put up a case for keeping it at Tier 2 though, I'm happy to hear it!

This PR wil be rebased once https://github.com/rust-lang/rust/pull/146419 completes the queue.
2025-09-26 18:11:09 +02:00
Stuart Cook
0a34928ad8 Rollup merge of #145973 - vexide:vex-std, r=tgross35
Add `std` support for `armv7a-vex-v5`

This PR adds standard library support for the VEX V5 Brain (`armv7a-vex-v5` target). It is more-or-less an updated version of the library-side work done in rust-lang/rust#131530.

This was a joint effort between me, `@lewisfm,` `@max-niederman,` `@Gavin-Niederman` and several other members of the [`vexide` project](https://github.com/vexide/).

## Background

VEXos is a fairly unconventional operating system, with user code running in a restricted enviornment with regards to I/O capabilities and whatnot. As such, several OS-dependent APIs are unsupported or have partial support (such as `std::net`, `std::process`, and most of `std::thread`). A more comprehensive list of what does or doesn't work is outlined in the [updated target documentation](https://github.com/vexide/rust/blob/vex-std/src/doc/rustc/src/platform-support/armv7a-vex-v5.md). Despite these limitations, we believe that `libstd` support on this target still has value to users, especially given the popular use of this hardware for educational purposes. For some previous discussion on this matter, see [this comment](https://github.com/rust-lang/rust/pull/131530#issuecomment-2432856841).

## SDK Linkage

VEXos doesn't really ship with an official `libc` or POSIX-style platform API (and though it does port newlib, these are stubbed on top of the underlying SDK). Instead, VEX provides their own SDK for calling platform APIs. Their official SDK is kept proprietary (with public headers), though open-source implementations exist. Following the precedent of the `armv6k-nintendo-3ds` team's work in rust-lang/rust#95897, we've opted not to directly link `libstd` to any SDK with the expectation that users will provide their own with one of the following options:
-  [`vex-sdk-download`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-download), which downloads an official proprietary SDK from VEX using a build script.
- [`vex-sdk-jumptable`](https://crates.io/crates/vex-sdk-jumptable), which is a compatible, open-source reimplementation of the SDK using firmware jumps.
- [`vex-sdk-pros`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-pros), which uses the [PROS kernel](https://github.com/purduesigbots/pros) as a provider for SDK functions.
- Linking their own implementation or stubbing the functions required by libstd.

 The `vex-sdk` crate used in the VEXos PAL provides `libc`-style FFI bindings for any compatible system library, so any of these options *should* work fine. A functional demo project using `vex-sdk-download` can be found [here](https://github.com/vexide/armv7a-vex-v5-demo/tree/main).

## Future Work

This PR implements virtually everything we are currently able to implement given the current capabilities of the platform. The exception to this is file directory enumeration, though the implementation of that is sufficiently [gross enough](c6c5bad11e/packages/vexide-core/src/fs/mod.rs (L987)) to drive us away from supporting this officially.

Additionally, I have a working branch implementing the `panic_unwind` runtime for this target, which is something that would be nice to see in the future, though given the volume of compiler changes i've deemed it out-of-scope for this PR.
2025-09-25 20:31:53 +10:00
Tropical
b2634e31c4 std: add support for armv7a-vex-v5 target
Co-authored-by: Lewis McClelland <lewis@lewismcclelland.me>
2025-09-24 12:10:15 -05:00
bors
4056082360 Auto merge of #146317 - saethlin:panic=immediate-abort, r=nnethercote
Add panic=immediate-abort

MCP: https://github.com/rust-lang/compiler-team/issues/909

This adds a new panic strategy, `-Cpanic=immediate-abort`. This panic strategy essentially just codifies use of `-Zbuild-std-features=panic_immediate_abort`. This PR is intended to just set up infrastructure, and while it will change how the compiler is invoked for users of the feature, there should be no other impacts.

In many parts of the compiler, `PanicStrategy::ImmediateAbort` behaves just like `PanicStrategy::Abort`, because actually most parts of the compiler just mean to ask "can this unwind?" so I've added a helper function so we can say `sess.panic_strategy().unwinds()`.

The panic and unwind strategies have some level of compatibility, which mostly means that we can pre-compile the sysroot with unwinding panics then the sysroot can be linked with aborting panics later. The immediate-abort strategy is all-or-nothing, enforced by `compiler/rustc_metadata/src/dependency_format.rs` and this is tested for in `tests/ui/panic-runtime/`. We could _technically_ be more compatible with the other panic strategies, but immediately-aborting panics primarily exist for users who want to eliminate all the code size responsible for the panic runtime. I'm open to other use cases if people want to present them, but not right now. This PR is already large.

`-Cpanic=immediate-abort` sets both `cfg(panic = "immediate-abort")` _and_ `cfg(panic = "abort")`. bjorn3 pointed out that people may be checking for the abort cfg to ask if panics will unwind, and also the sysroot feature this is replacing used to require `-Cpanic=abort` so this seems like a good back-compat step. At least for the moment. Unclear if this is a good idea indefinitely. I can imagine this being confusing.

The changes to the standard library attributes are purely mechanical. Apart from that, I removed an `unsafe` we haven't needed for a while since the `abort` intrinsic became safe, and I've added a helpful diagnostic for people trying to use the old feature.

To test that `-Cpanic=immediate-abort` conflicts with other panic strategies, I've beefed up the core-stubs infrastructure a bit. There is now a separate attribute to set flags on it.

I've added a test that this produces the desired codegen, called `tests/run-make-cargo/panic-immediate-abort-codegen/` and also a separate run-make-cargo test that checks that we can build a binary.
2025-09-23 06:37:03 +00:00
Guillaume Gomez
090befc5e0 Rollup merge of #146848 - moturus:motor-os_tier-3, r=davidtwco
Add x86_64-unknown-motor (Motor OS) tier 3 target

Add the initial no-std Motor OS compiler target.

Motor OS has been developed for several years in the open: https://github.com/moturus/motor-os.

It has a more or less full implementation of Rust std library, as well as tokio/mio ports.

> 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.)

Ack. [U. Lasiotus](https://github.com/lasiotus) will maintain the target.

 > 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.

Ack. The new target is named `x86_64-unknown-motor`, as it represents Motor OS on x86_64.

> 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.

Ack. Motor OS is dual-licensed under MIT and/or Apache-2.0.

> 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.

> 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.

Ack.

> 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.

Motor OS has a functional implementation of the standard library: https://github.com/moturus/rust/tree/motor-os_stdlib, which will be the subject of a later PR.

> 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.

Building instructions for Motor OS: https://github.com/moturus/motor-os/blob/main/docs/build.md.

> 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.

Ack.

> 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.

> 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.

Ack.

> 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.)

Motor OS uses the standard x86_64 rustc/llvm toolchain.

> 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.

Ack.
2025-09-22 17:17:44 +02:00
Guillaume Gomez
dc176bd216 Rollup merge of #146795 - alexcrichton:wasm-limit-rdylib-exports, r=bjorn3
Enable `limit_rdylib_exports` on wasm targets

This commit updates the target specification of wasm targets to set the `limit_rdylib_exports` value to `true` like it is on other native platforms. This was originally not implemented long ago as `wasm-ld` didn't have options for symbol exports, but since then it's grown a `--export` flag and such to control this. A custom case is needed in the linker implementation to handle wasm targets as `wasm-ld` doesn't support linker scripts used on other targets, but other than that the implementation is straightforward.

The goal of this commit is enable building dynamic libraries on `wasm32-wasip2` which don't export every single symbol in the Rust standard library. Currently, without otherwise control over symbol visibility, all symbols end up being exported which generates excessively large binaries because `--gc-sections` ends up doing nothing as it's all exported anyway.
2025-09-22 17:17:42 +02:00
Stuart Cook
a5e1ab590b Rollup merge of #146858 - Gelbpunkt:mips64el-musl-dynamic, r=jieyouxu
Make mips64el-unknown-linux-muslabi64 link dynamically

I missed this target when I changed all the other tier 3 targets in https://github.com/rust-lang/rust/pull/144410. Only realized that this one was still statically linked when I looked at the list of targets in the test later (https://github.com/rust-lang/rust/pull/146588).

since those two PRs were reviewed by you:
r? ````@jieyouxu````
2025-09-22 20:25:17 +10:00
U. Lasiotus
0138bbd495 Add x86_64-unknown-motor (Motor OS) tier 3 target
Add the initial no-std Motor OS compiler target.

Motor OS has been developed for several years in the open:
https://github.com/moturus/motor-os.

It has a more or less full implementation of Rust std library,
as well as tokio/mio ports.

Build instructions can be found here:
https://github.com/moturus/motor-os/blob/main/docs/build.md.

Signed-off-by: U. Lasiotus <lasiotus@motor-os.org>
2025-09-21 12:43:13 -07:00
Jens Reidel
b3c2435688 Make mips64el-unknown-linux-muslabi64 link dynamically
I missed this target when I changed all the other tier 3 targets. Only
realized that this one was still statically linked when I looked at the
list of targets in the test later.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-09-21 21:13:15 +02:00
Ben Kimock
888679013d Add panic=immediate-abort 2025-09-21 13:12:18 -04:00
Taiki Endo
f4b876867d Support ctr and lr as clobber-only registers in PowerPC inline assembly 2025-09-21 13:48:22 +09:00
Deadbeef
4841d8c5ff generate list of all variants with target_spec_enum
This helps us avoid the hardcoded lists elsewhere.
2025-09-19 22:14:50 +00:00
Alex Crichton
f354d93abe Enable limit_rdylib_exports on wasm targets
This commit updates the target specification of wasm targets to set the
`limit_rdylib_exports` value to `true` like it is on other native
platforms. This was originally not implemented long ago as `wasm-ld`
didn't have options for symbol exports, but since then it's grown a
`--export` flag and such to control this. A custom case is needed in the
linker implementation to handle wasm targets as `wasm-ld` doesn't
support linker scripts used on other targets, but other than that the
implementation is straightforward.

The goal of this commit is enable building dynamic libraries on
`wasm32-wasip2` which don't export every single symbol in the Rust
standard library. Currently, without otherwise control over symbol
visibility, all symbols end up being exported which generates
excessively large binaries because `--gc-sections` ends up doing nothing
as it's all exported anyway.
2025-09-19 13:16:38 -07:00
Mateusz Mikuła
7eea65f8e0 Stop linking rs{begin,end} on x86_64-*-windows-gnu
Until now, x86_64-pc-windows-gnu linked `rsbegin.o` and `rsend.o` just
like i686-pc-windows-gnu, even though they were no-ops for it.
This was likely done for the simplicity back when it was introduced.

Today the things are different and these startup/end objects harm other
features, like `build-std`. Given the demotion of i686-pc-windows-gnu
from tier 1, there is no point in hurting x86_64-pc-windows-gnu,
which remains a tier 1.

The files are still shipped in case downstream crates expect them, as in
case of the unmaintained `xargo`.
2025-09-19 19:06:15 +02:00
Jonathan 'theJPster' Pallant
430d353266 Drop armebv7r-none-eabi* to Tier 3
These targets are not widely used, and are difficult to test because
qemu-system-arm cannot emulate them.
2025-09-14 09:49:07 +01:00
Mads Marquart
9969622436 Improve the documentation around ZERO_AR_DATE 2025-09-13 20:16:58 +02:00
Noratrieb
f157ce994e Add --print target-spec-json-schema
This schema is helpful for people writing custom target spec JSON. It
can provide autocomplete in the editor, and also serves as documentation
when there are documentation comments on the structs, as `schemars` will
put them in the schema.
2025-09-12 20:53:28 +02:00
Noratrieb
a0bb9cc57d Introduce target_spec_enum macro to avoid duplication
With this macro we only need to enumerate every variant once. This saves
a lot of duplication already between the definition, the `FromStr` impl
and the `ToJson` impl.

It also enables us to do further things with it like JSON schema
generation.
2025-09-12 20:37:09 +02:00
Ralf Jung
3b2178336f s390x: mark soft-float target feature as incompatible 2025-09-10 22:47:29 +02:00
Trevor Gross
3b8d41161e Rollup merge of #145709 - heiher:issue-145692-1, r=jackh726
Fix LoongArch C function ABI when passing/returning structs containing floats

Similar to RISC-V, LoongArch passes structs containing only one or two floats (or a float–integer pair) in registers, as long as each element fits into a single corresponding register. Before this PR, Rust did not check the actual offset of the second float or integer; instead, it assumed the standard offset based on the default alignment. However, since the offset can be affected by `#[repr(align(N))]` and `#[repr(packed)]`, this led to miscompilations (see rust-lang/rust#145692). This PR fixes the issue by explicitly specifying the offset for the remainder of the cast.
2025-09-05 01:53:20 -04:00
Jacob Pratt
4c091fb9ed Rollup merge of #145682 - dpaoliello:arm64tier1, r=jieyouxu
Promote aarch64-pc-windows-msvc to Tier 1

Per <https://github.com/rust-lang/rfcs/pull/3817>

Tracking issue: <https://github.com/rust-lang/rust/issues/145671>
2025-09-04 01:43:20 -04:00
Stuart Cook
a1469aadc2 Rollup merge of #146134 - maurer:nvptx-sync, r=durin42
llvm: nvptx: Layout update to match LLVM

LLVM upstream switched layouts to support 256-bit vector load/store.

``````@rustbot`````` label llvm-main

r? durin42
2025-09-04 10:02:02 +10:00
Stuart Cook
1ec369ee24 Rollup merge of #146032 - heiher:loong64-none-no-lsx, r=lqd
Explicity disable LSX feature for `loongarch64-unknown-none` target

The `loongarch64-unknown-none` target is a bare-metal target with hardware floating-point support and should not enable SIMD extensions by default. However, LLVM's LoongArch64 backend enables LSX implicitly, inadvertently activating SIMD instructions for this target. This patch explicitly disable LSX feature to prevent unintended SIMD usage.
2025-09-03 23:08:09 +10:00
Matthew Maurer
5d9f8fcd3e llvm: nvptx: Layout update to match LLVM
LLVM upstream switched layouts to support 256-bit vector load/store.
2025-09-02 18:47:59 +00:00
Guillaume Gomez
5d855c6b9e Rollup merge of #146034 - taiki-e:target-spec, r=nnethercote
Update target spec metadata of Arm64EC Windows and Trusty targets

Update outdated target spec metadata in the following targets.

- Arm64EC Windows (`arm64ec-pc-windows-msvc`) is "tier 2 without host tools" since https://github.com/rust-lang/rust/pull/126039 and supports `std`  since before that, but metadata currently says that is tier 3 and has unknown `std` support status.
- Trusty targets (`{aarch64,armv7,x86_64}-unknown-trusty`) support `std` since https://github.com/rust-lang/rust/pull/136842 (and I confirmed they can be compiled with `-Zbuild-std=std`), but metadata currently says that has no `std` support.

Mentioning `@dpaoliello` as [arm64ec-pc-windows-msvc target-maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/arm64ec-pc-windows-msvc.html#target-maintainers).
Mentioning `@randomPoison` `@ahomescu` as [Trusty target maintainers](https://doc.rust-lang.org/nightly/rustc/platform-support/trusty.html#target-maintainers).
2025-09-02 17:08:53 +02:00
Nicholas Nethercote
301655eafe Revert introduction of [workspace.dependencies].
This was done in #145740 and #145947. It is causing problems for people
using r-a on anything that uses the rustc-dev rustup package, e.g. Miri,
clippy.

This repository has lots of submodules and subtrees and various
different projects are carved out of pieces of it. It seems like
`[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-02 19:12:54 +10:00
Matthias Krüger
0e28b4201a Rollup merge of #144443 - WaffleLapkin:integer-target-pointer-width, r=Noratrieb
Make target pointer width in target json an integer

r? Noratrieb
cc `@RalfJung` (https://github.com/rust-lang/rust/pull/142352/files#r2230380120)

try-job: x86_64-rust-for-linux
2025-08-31 13:40:34 +02:00
Taiki Endo
ddf1b3e7d4 Update target spec metadata of Arm64EC Windows and Trusty targets 2025-08-30 23:35:39 +09:00
WANG Rui
0b1bc65002 Explicity disable LSX feature for loongarch64-unknown-none target
The `loongarch64-unknown-none` target is a bare-metal target with
hardware floating-point support and should not enable SIMD extensions
by default. However, LLVM's LoongArch64 backend enables LSX implicitly,
inadvertently activating SIMD instructions for this target. This patch
explicitly disable LSX feature to prevent unintended SIMD usage.
2025-08-30 21:36:23 +08:00
bors
846e377215 Auto merge of #123319 - no92:managarm-target, r=davidtwco
Add managarm as a tier 3 target

This PR aims to introduce the `x86_64-unknown-managarm-mlibc` as a tier 3 target to Rust.

[managarm](https://github.com/managarm/managarm) is a microkernel with fully asynchronous I/O that also provides a POSIX server. Despite the differences, managarm provides good compatability with POSIX and Linux APIs. As a rule of thumb, barring OS-specific code, it should be mostly source-compatible with Linux.

We have been shipping a patched rust for over 25 releases now, and we would like to upstream our work. For a smoother process, this PR only adds the target to rustc and some documentation. `std` support will be added in a future PR.

## Addressing the tier 3 target policy

> 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.)

`@no92,` `@64` and `@Dennisbonke` will be target maintainers.

> 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.

`x86_64-unknown-managarm-mlibc` is what we use for LLVM as well.

> 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.

[managarm](https://github.com/managarm/managarm) is licensed as MIT. No dependencies were added.

> 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. None of the listed maintainers are on a Rust team.

> 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.

Support for `std` will be provided in a future PR. Only minor changes are required, however they depend on support in the `libc` crate which will be PRed in soon.

> 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.

The steps needed to take are described in the documentation provided with this PR.

> 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.

We have no indication that anything breaks due to this PR.

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target.

No problems here, as we target `x86_64`.

r? compiler-team
2025-08-30 07:59:16 +00:00
no92
6577a0ffdb compiler: Add {x86_64,aarch64,riscv64gc}-unknown-managarm-mlibc targets
Co-authored-by: Dennis Bonke <dennis@managarm.org>
2025-08-29 00:49:29 +02:00
Nicholas Nethercote
daf6fe2c1b Add serde_json to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
bors
43a216604a Auto merge of #145949 - jhpratt:rollup-smzd7tr, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#145382 (Add assembly test for `-Zreg-struct-return` option)
 - rust-lang/rust#145746 (Fix STD build failing for target_os = "espidf")
 - rust-lang/rust#145826 (Use AcceptContext in AttribueParser::check_target)
 - rust-lang/rust#145894 (Ensure the coordinator thread terminates before its channels drop)
 - rust-lang/rust#145946 (Remove unnecessary `[dependencies.unicode-properties]` entries.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-28 03:06:52 +00:00
bors
d36f964125 Auto merge of #145877 - nikic:capture-address, r=tmiasko
Use captures(address) instead of captures(none) for indirect args

While provenance cannot be captured through these arguments, the address / object identity can.

Fixes https://github.com/rust-lang/rust/issues/137668.

r? `@ghost`
2025-08-28 00:01:22 +00:00
Nicholas Nethercote
b4c8fe2b4b Remove unnecessary [dependencies.unicode-properties] entries.
The Cargo style guide says to put dependencies on a single line if they
fit.
2025-08-28 08:08:40 +10:00
Waffle Lapkin
6a3187af13 fix target-pointer-width in tests 2025-08-27 23:44:49 +02:00
Waffle Lapkin
1f7efabdc6 turn pointer width into an integer in target.json 2025-08-27 23:44:49 +02:00
Waffle Lapkin
c7e1885075 allow using target_val! with a rename 2025-08-27 23:44:46 +02:00
Nicholas Nethercote
c50d2cc807 Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00