-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Add powerpc64-unknown-linux-gnuelfv2 target #144220
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
Open
Gelbpunkt
wants to merge
2
commits into
rust-lang:master
Choose a base branch
from
Gelbpunkt:powerpc64-unknown-linux-gnuelfv2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+89
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnuelfv2.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use rustc_abi::Endian; | ||
|
||
use crate::spec::{ | ||
Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base, | ||
}; | ||
|
||
pub(crate) fn target() -> Target { | ||
let mut base = base::linux_gnu::opts(); | ||
base.cpu = "ppc64".into(); | ||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); | ||
base.max_atomic_width = Some(64); | ||
base.stack_probes = StackProbeType::Inline; | ||
base.abi = "elfv2".into(); | ||
base.llvm_abiname = "elfv2".into(); | ||
|
||
Target { | ||
llvm_target: "powerpc64-unknown-linux-gnu".into(), | ||
metadata: TargetMetadata { | ||
description: Some("PPC64 Linux (ELFv2 ABI, kernel 3.2, glibc 2.17)".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: Some(true), | ||
}, | ||
pointer_width: 64, | ||
data_layout: "E-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(), | ||
arch: "powerpc64".into(), | ||
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base }, | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/doc/rustc/src/platform-support/powerpc64-unknown-linux-gnuelfv2.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# powerpc64-unknown-linux-gnuelfv2 | ||
|
||
**Tier: 3** | ||
|
||
Target for 64-bit big endian PowerPC Linux programs using the ELFv2 ABI and | ||
the GNU C library. | ||
|
||
## Target maintainers | ||
|
||
[@Gelbpunkt](https://github.com/Gelbpunkt) | ||
|
||
## Requirements | ||
|
||
Building the target itself requires a 64-bit big endian PowerPC compiler that | ||
uses the ELFv2 ABI and is supported by `cc-rs`. | ||
|
||
## Building the target | ||
|
||
The target can be built by enabling it for a `rustc` build. | ||
|
||
```toml | ||
[build] | ||
target = ["powerpc64-unknown-linux-gnuelfv2"] | ||
``` | ||
|
||
Make sure your C compiler is included in `$PATH`, then add it to the | ||
`bootstrap.toml`: | ||
|
||
```toml | ||
[target.powerpc64-unknown-linux-gnuelfv2] | ||
cc = "powerpc64-linux-gnu-gcc" | ||
cxx = "powerpc64-linux-gnu-g++" | ||
ar = "powerpc64-linux-gnu-ar" | ||
linker = "powerpc64-linux-gnu-gcc" | ||
``` | ||
|
||
## Building Rust programs | ||
|
||
Rust does not yet ship pre-compiled artifacts for this target. To compile for | ||
this target, you will first need to build Rust with the target enabled (see | ||
"Building the target" above). | ||
|
||
## Cross-compilation | ||
|
||
This target can be cross-compiled from any host. | ||
|
||
## Testing | ||
|
||
This target can be tested as normal with `x.py` on a 64-bit big endian PowerPC | ||
host or via QEMU emulation. |
Submodule llvm-project
updated
2 files
+28 −17 | clang/lib/Basic/Targets/PPC.h | |
+6 −3 | llvm/lib/Target/PowerPC/PPCTargetMachine.cpp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: this is fine for experimenting, but we can't land it in
master
with a fork. (I assume this is blocked on the upstream LLVM fix?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's blocked on the fix, but I'm not sure what to do afterwards. I guess it could be included in the Rust LLVM fork, but it still won't be included in some of the builders that use the old system LLVM. Those will fail CI like the
aarch64-gnu-llvm-19-1
job above