Add powerpc64-unknown-linux-gnuelfv2 target#144220
Conversation
|
These commits modify compiler targets. Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb |
This comment has been minimized.
This comment has been minimized.
|
Interesting, seems like a usecase like this one in particular is currently not intended, see here. The explicitly set ABI is processed in EDIT: This is an LLVM bug, it doesn't reset the data layout when the ABI is explicitly set, while it does on ARM |
|
LLVM side of the problem should hopefully get fixed by llvm/llvm-project#149725, |
255b058 to
755a1c9
Compare
This comment has been minimized.
This comment has been minimized.
755a1c9 to
ae5d567
Compare
This comment has been minimized.
This comment has been minimized.
ae5d567 to
d7200f0
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
☔ The latest upstream changes (presumably #144249) made this pull request unmergeable. Please resolve the merge conflicts. |
d7200f0 to
23a159f
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
This is no longer blocked since we now use LLVM 22. |
|
We still support LLVM 21 AFAIK. Is that a problem? |
I believe not, at least if I understand David's comment (#144220 (comment)) correctly. We only test that codegen works for the target if LLVM 22 is in use. I guess it would probably be worth documenting the LLVM 22 requirement on the target page as long as 21 is supported. |
That just means we don't see the problem, but the problem still exists. ;) |
|
Well, code compiled with LLVM 21 will still run fine. The datalayout difference between the two is If I remember correctly, rustc does patch the data layouts for a few targets to match newer LLVM if present. We could put the ELFv1 datalayout here for now and patch it to use the correct one if LLVM 22 is in use. Both will build working binaries. |
Oh yeah if that's the only difference then that sounds entirely harmless (unless something more cursed than I can imagine is going on). |
This is virtually the same target as the existing -gnu target, but using the ELFv2 ABI instead of the ELFv1 ABI and made possible now that we expose target_abi = "elfv1" or "elfv2" on the 64-bit PowerPC targets.
23a159f to
a832c14
Compare
|
Implemented that, so this now also works with LLVM 21 |
|
I'm not sure how to fix the label situation on this PR @rustbot ready |
|
@bors r+ |
…gnuelfv2, r=davidtwco Add powerpc64-unknown-linux-gnuelfv2 target This is virtually the same target as the existing -gnu target, but using the ELFv2 ABI instead of the ELFv1 ABI and made possible now that we expose target_abi = "elfv1" or "elfv2" on the 64-bit PowerPC targets. The ELFv2 ABI is the preferred ABI for powerpc64 when compatibility with ELFv1 is not required and therefore used by e.g. distributions that were bootstrapped after the introduction of ELFv2. Copying the [target tier policy](https://doc.rust-lang.org/rustc/target-tier-policy.html#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.) That would be me. > 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. This is an interesting one, because I'm not aware of any toolchain that has a target triple for ppc64 + glibc + ELFv2, even though it is a totally valid combination and actively in used by some distributions. Clang and GCC both simply use `-target powerpc64-unknown-linux-gnu -mabi=elfv2` to my knowledge (and cross-toolchains should be using `--with-abi=elfv2` when configuring GCC). However, the chosen name should be somewhat in line with the other existing targets with special ABIs. Renaming `powerpc64-unknown-linux-gnu` to `powerpc64-unknown-linux-gnuelfv1` at the same time to avoid ambiguity would've been an interesting idea, but it'd be a breaking change to a tier 2 target. > 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. This target isn't any different than the ELFv1 target in this regard. > 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. Nothing to comment on here on my end. > 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 implements the entire standard library. > 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. Documentation can be found in the markdown document added by 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. Roger that :) > 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. This PR doesn't touch any other targets. > 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.) The LLVM backend works. r? compiler
…uwer Rollup of 23 pull requests Successful merges: - #144220 (Add powerpc64-unknown-linux-gnuelfv2 target) - #153238 (debuginfo: slices are DW_TAG_array_type's) - #157112 (Update aarch64-unknown-freebsd target description) - #157322 (test pre-stabilization items on CI) - #157348 (Don't track cwd for `-Zremap-cwd-prefix` in incremental compilation) - #157490 (Add field-wise CoerceShared reborrow tests) - #157655 (Make Share::share final and improve docs) - #157672 (Region inference: Simplify initialisation of region values) - #157680 (Require `#[pin_v2]` for explicit pin-projection patterns) - #157688 (Create experimental test job `aarch64-apple-macos-26` for evaluating `macos-26` runner images) - #157796 (rustdoc: Some more lazy formatting) - #157818 (miri subtree update) - #157069 (Test that you can't implement Unpin for a compiler-generated future using TAIT) - #157079 (Don't recover `&raw EXPR` as a missing comma) - #157202 (add #[rustc_no_writable] to slice::get_unchecked_mut) - #157622 (Disable retagging for variadic arguments in const-eval) - #157684 (-Zassumptions-on-binders: insert empty assumptions when entering binders in the solver) - #157695 (Extend capabilities of `TypeFoldable_Generic`) - #157766 (interpret: avoid computing layout of sized raw pointee) - #157785 (fuchsia: Support AddressSanitizer on riscv64gc-unknown-fuchsia) - #157795 (revert 157013) - #157798 (Prevent approving PRs that wait for Crater or formal decisions) - #157803 (Rename `errors.rs` file to `diagnostics.rs` (7/N)) Failed merges: - #157752 (Rename `errors.rs` file to `diagnostics.rs` (6/N))
Rollup merge of #144220 - Gelbpunkt:powerpc64-unknown-linux-gnuelfv2, r=davidtwco Add powerpc64-unknown-linux-gnuelfv2 target This is virtually the same target as the existing -gnu target, but using the ELFv2 ABI instead of the ELFv1 ABI and made possible now that we expose target_abi = "elfv1" or "elfv2" on the 64-bit PowerPC targets. The ELFv2 ABI is the preferred ABI for powerpc64 when compatibility with ELFv1 is not required and therefore used by e.g. distributions that were bootstrapped after the introduction of ELFv2. Copying the [target tier policy](https://doc.rust-lang.org/rustc/target-tier-policy.html#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.) That would be me. > 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. This is an interesting one, because I'm not aware of any toolchain that has a target triple for ppc64 + glibc + ELFv2, even though it is a totally valid combination and actively in used by some distributions. Clang and GCC both simply use `-target powerpc64-unknown-linux-gnu -mabi=elfv2` to my knowledge (and cross-toolchains should be using `--with-abi=elfv2` when configuring GCC). However, the chosen name should be somewhat in line with the other existing targets with special ABIs. Renaming `powerpc64-unknown-linux-gnu` to `powerpc64-unknown-linux-gnuelfv1` at the same time to avoid ambiguity would've been an interesting idea, but it'd be a breaking change to a tier 2 target. > 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. This target isn't any different than the ELFv1 target in this regard. > 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. Nothing to comment on here on my end. > 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 implements the entire standard library. > 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. Documentation can be found in the markdown document added by 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. Roger that :) > 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. This PR doesn't touch any other targets. > 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.) The LLVM backend works. r? compiler
…uwer Rollup of 23 pull requests Successful merges: - rust-lang/rust#144220 (Add powerpc64-unknown-linux-gnuelfv2 target) - rust-lang/rust#153238 (debuginfo: slices are DW_TAG_array_type's) - rust-lang/rust#157112 (Update aarch64-unknown-freebsd target description) - rust-lang/rust#157322 (test pre-stabilization items on CI) - rust-lang/rust#157348 (Don't track cwd for `-Zremap-cwd-prefix` in incremental compilation) - rust-lang/rust#157490 (Add field-wise CoerceShared reborrow tests) - rust-lang/rust#157655 (Make Share::share final and improve docs) - rust-lang/rust#157672 (Region inference: Simplify initialisation of region values) - rust-lang/rust#157680 (Require `#[pin_v2]` for explicit pin-projection patterns) - rust-lang/rust#157688 (Create experimental test job `aarch64-apple-macos-26` for evaluating `macos-26` runner images) - rust-lang/rust#157796 (rustdoc: Some more lazy formatting) - rust-lang/rust#157818 (miri subtree update) - rust-lang/rust#157069 (Test that you can't implement Unpin for a compiler-generated future using TAIT) - rust-lang/rust#157079 (Don't recover `&raw EXPR` as a missing comma) - rust-lang/rust#157202 (add #[rustc_no_writable] to slice::get_unchecked_mut) - rust-lang/rust#157622 (Disable retagging for variadic arguments in const-eval) - rust-lang/rust#157684 (-Zassumptions-on-binders: insert empty assumptions when entering binders in the solver) - rust-lang/rust#157695 (Extend capabilities of `TypeFoldable_Generic`) - rust-lang/rust#157766 (interpret: avoid computing layout of sized raw pointee) - rust-lang/rust#157785 (fuchsia: Support AddressSanitizer on riscv64gc-unknown-fuchsia) - rust-lang/rust#157795 (revert 157013) - rust-lang/rust#157798 (Prevent approving PRs that wait for Crater or formal decisions) - rust-lang/rust#157803 (Rename `errors.rs` file to `diagnostics.rs` (7/N)) Failed merges: - rust-lang/rust#157752 (Rename `errors.rs` file to `diagnostics.rs` (6/N))
View all comments
This is virtually the same target as the existing -gnu target, but using the ELFv2 ABI instead of the ELFv1 ABI and made possible now that we expose target_abi = "elfv1" or "elfv2" on the 64-bit PowerPC targets.
The ELFv2 ABI is the preferred ABI for powerpc64 when compatibility with ELFv1 is not required and therefore used by e.g. distributions that were bootstrapped after the introduction of ELFv2.
Copying the target tier policy:
That would be me.
This is an interesting one, because I'm not aware of any toolchain that has a target triple for ppc64 + glibc + ELFv2, even though it is a totally valid combination and actively in used by some distributions. Clang and GCC both simply use
-target powerpc64-unknown-linux-gnu -mabi=elfv2to my knowledge (and cross-toolchains should be using--with-abi=elfv2when configuring GCC). However, the chosen name should be somewhat in line with the other existing targets with special ABIs. Renamingpowerpc64-unknown-linux-gnutopowerpc64-unknown-linux-gnuelfv1at the same time to avoid ambiguity would've been an interesting idea, but it'd be a breaking change to a tier 2 target.This target isn't any different than the ELFv1 target in this regard.
Nothing to comment on here on my end.
This target implements the entire standard library.
Documentation can be found in the markdown document added by this PR.
Roger that :)
This PR doesn't touch any other targets.
The LLVM backend works.
r? compiler