Skip to content

rustc_target: Add msync target feature and enable it on powerpcspe targets #137860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Mar 1, 2025

Some older PowerPC processors do not have the sync (sync 0) and lwsync (sync 1) instructions, but instead have the msync instruction. (IIRC msync and sync will be assembled into the same bit-pattern, but lwsync will be SIGILL. See also https://gcc.gnu.org/legacy-ml/gcc-patches/2006-11/msg01238.html.)

LLVM recognizes this as the msync feature and enables for some cpus such as e500.

powerpcspe is a target for CPUs such as e500 (Debian Wiki). However, the msync feature is currently not enabled except for vxworks, and at least since 2022-04, powerpc-unknown-linux-gnuspe was known to not work on real hardware without -C target-cpu (e.g., #96394, #117361).

features: "+secure-plt,+msync".into(),

Fixes #117361

cc @BKPepe (powerpc-unknown-linux-muslspe target maintainer)
cc @glaubitz (who added powerpc-unknown-linux-gnuspe in #48484)
cc @th0ma7 (who opened #117361)

r? workingjubilee

@rustbot label +O-PowerPC +A-target-feature

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. O-PowerPC Target: PowerPC processors labels Mar 1, 2025
@glaubitz
Copy link
Contributor

glaubitz commented Mar 1, 2025

Looks good to me! I can't test it at the moment thought as my Debian PowerPCSPE systems are currently put into storage.

@taiki-e taiki-e force-pushed the powerpcspe-msync branch from 3bd251f to 6f7fd11 Compare March 1, 2025 18:03
@workingjubilee
Copy link
Member

@taiki-e Can you add a brief discussion of the CPU architectures relevant to this target to its platform support page?

@taiki-e
Copy link
Member Author

taiki-e commented Mar 1, 2025

Can you add a brief discussion of the CPU architectures relevant to this target to its platform support page?

I wasn't sure what exactly you wanted documented and where, but I opened a PR to add the documentation that I thought was missing: #137868

@workingjubilee
Copy link
Member

Thanks, that looks good.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Mar 1, 2025

📌 Commit 6f7fd11 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 1, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 3, 2025
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#137375 (Minor internal comments fix for `BufRead::read_line`)
 - rust-lang#137641 (More precisely document `Global::deallocate()`'s safety.)
 - rust-lang#137755 (doc: update Wasmtime flags)
 - rust-lang#137851 (improve `simd_select` error message when used with invalid mask type)
 - rust-lang#137860 (rustc_target: Add msync target feature and enable it on powerpcspe targets)
 - rust-lang#137871 (fix `RangeBounds::is_empty` documentation)
 - rust-lang#137873 (Disable `f16` on Aarch64 without `neon`)
 - rust-lang#137876 (Adjust triagebot.toml entries for `rustc_mir_build/src/builder/`)
 - rust-lang#137883 (edit mailmap)
 - rust-lang#137886 (`name()` and `trimmed_name()` for `stable_mir::crate_def::DefId`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1762f01 into rust-lang:master Mar 3, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 3, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 3, 2025
Rollup merge of rust-lang#137860 - taiki-e:powerpcspe-msync, r=workingjubilee

rustc_target: Add msync target feature and enable it on powerpcspe targets

Some older PowerPC processors do not have the `sync` (`sync 0`) and `lwsync` (`sync 1`) instructions, but instead have the `msync` instruction. (IIRC `msync` and `sync` will be assembled into the same bit-pattern, but `lwsync` will be SIGILL. See also https://gcc.gnu.org/legacy-ml/gcc-patches/2006-11/msg01238.html.)

LLVM recognizes this as the [`msync` feature](https://github.com./llvm/llvm-project/blob/cc5d8a4b2fc765c3c432f1ad0b185dae518d41bd/llvm/lib/Target/PowerPC/PPC.td#L140) and enables for some cpus such as [e500](https://github.com./llvm/llvm-project/blob/cc5d8a4b2fc765c3c432f1ad0b185dae518d41bd/llvm/lib/Target/PowerPC/PPC.td#L644).

powerpcspe is a target for CPUs such as e500 ([Debian Wiki](https://wiki.debian.org/PowerPCSPEPort)). However, the `msync` feature is currently not enabled except for vxworks, and at least since 2022-04, powerpc-unknown-linux-gnuspe was known to not work on real hardware without `-C target-cpu` (e.g., rust-lang#96394, rust-lang#117361).

https://github.com./rust-lang/rust/blob/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs#L28

Fixes rust-lang#117361

cc `@BKPepe` ([powerpc-unknown-linux-muslspe target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-linux-muslspe.html#target-maintainers))
cc `@glaubitz` (who added powerpc-unknown-linux-gnuspe in rust-lang#48484)
cc `@th0ma7` (who opened rust-lang#117361)

r? workingjubilee

`@rustbot` label +O-PowerPC +A-target-feature
@taiki-e taiki-e deleted the powerpcspe-msync branch March 4, 2025 16:44
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Mar 6, 2025
…ubilee

Add minimal platform support documentation for powerpc-unknown-linux-gnuspe

Per rust-lang#137860 (comment), add minimal platform support documentation, including a brief summary and links to more detailed information about this target.

The added documentation is minimal. This is somewhat similar to [powerpc-unknown-openbsd, which also has no target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-openbsd.html). The rest of the template is left to target maintainers.

I also updated powerpc-unknown-linux-muslspe platform support documentation and added link to powerpc-unknown-linux-gnuspe platform support documentation.

cc `@glaubitz`
cc `@BKPepe`
r? workingjubilee

`@rustbot` label +O-PowerPC
Noratrieb added a commit to Noratrieb/rust that referenced this pull request Mar 6, 2025
…ubilee

Add minimal platform support documentation for powerpc-unknown-linux-gnuspe

Per rust-lang#137860 (comment), add minimal platform support documentation, including a brief summary and links to more detailed information about this target.

The added documentation is minimal. This is somewhat similar to [powerpc-unknown-openbsd, which also has no target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-openbsd.html). The rest of the template is left to target maintainers.

I also updated powerpc-unknown-linux-muslspe platform support documentation and added link to powerpc-unknown-linux-gnuspe platform support documentation.

cc ``@glaubitz``
cc ``@BKPepe``
r? workingjubilee

``@rustbot`` label +O-PowerPC
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Mar 6, 2025
…ubilee

Add minimal platform support documentation for powerpc-unknown-linux-gnuspe

Per rust-lang#137860 (comment), add minimal platform support documentation, including a brief summary and links to more detailed information about this target.

The added documentation is minimal. This is somewhat similar to [powerpc-unknown-openbsd, which also has no target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-openbsd.html). The rest of the template is left to target maintainers.

I also updated powerpc-unknown-linux-muslspe platform support documentation and added link to powerpc-unknown-linux-gnuspe platform support documentation.

cc ```@glaubitz```
cc ```@BKPepe```
r? workingjubilee

```@rustbot``` label +O-PowerPC
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
Rollup merge of rust-lang#137868 - taiki-e:powerpcspe-doc, r=workingjubilee

Add minimal platform support documentation for powerpc-unknown-linux-gnuspe

Per rust-lang#137860 (comment), add minimal platform support documentation, including a brief summary and links to more detailed information about this target.

The added documentation is minimal. This is somewhat similar to [powerpc-unknown-openbsd, which also has no target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-openbsd.html). The rest of the template is left to target maintainers.

I also updated powerpc-unknown-linux-muslspe platform support documentation and added link to powerpc-unknown-linux-gnuspe platform support documentation.

cc ```@glaubitz```
cc ```@BKPepe```
r? workingjubilee

```@rustbot``` label +O-PowerPC
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Mar 7, 2025
Add minimal platform support documentation for powerpc-unknown-linux-gnuspe

Per rust-lang/rust#137860 (comment), add minimal platform support documentation, including a brief summary and links to more detailed information about this target.

The added documentation is minimal. This is somewhat similar to [powerpc-unknown-openbsd, which also has no target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-openbsd.html). The rest of the template is left to target maintainers.

I also updated powerpc-unknown-linux-muslspe platform support documentation and added link to powerpc-unknown-linux-gnuspe platform support documentation.

cc ```@glaubitz```
cc ```@BKPepe```
r? workingjubilee

```@rustbot``` label +O-PowerPC
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Mar 10, 2025
Add minimal platform support documentation for powerpc-unknown-linux-gnuspe

Per rust-lang/rust#137860 (comment), add minimal platform support documentation, including a brief summary and links to more detailed information about this target.

The added documentation is minimal. This is somewhat similar to [powerpc-unknown-openbsd, which also has no target maintainer](https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc-unknown-openbsd.html). The rest of the template is left to target maintainers.

I also updated powerpc-unknown-linux-muslspe platform support documentation and added link to powerpc-unknown-linux-gnuspe platform support documentation.

cc ```@glaubitz```
cc ```@BKPepe```
r? workingjubilee

```@rustbot``` label +O-PowerPC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. O-PowerPC Target: PowerPC processors S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

howto cross-compile to get to work for powerpc e500v2
6 participants