Skip to content

Commit

Permalink
Rollup merge of rust-lang#132150 - taiki-e:ppc64-freebsd-abi, r=pnkfelix
Browse files Browse the repository at this point in the history
Fix powerpc64 big-endian FreeBSD ABI

Note that FreeBSD version bump may be reverted due to rust-lang#120869 (comment). We may want to wait to merge this until that discussion is complete.

Fixes rust-lang#120869 (comment)

> > PPC64 FreeBSD (ELFv1 and ELFv2, version 13.2)
>
> It seems odd that ELFv1 and 13.N coexist.
>
> https://www.freebsd.org/releases/13.0R/relnotes/
>
> > powerpc64 switched to ELFv2 ABI at the same time it switched to LLVM. This brings us to a parity with modern Linux distributions. This also makes the binaries from previous FreeBSD versions incompatible with 13.0-RELEASE. Kernel still supports ELFv1, so jails and chroots using older FreeBSD versions are still compatible. [e4399d169acc](https://cgit.freebsd.org/src/commit/?id=e4399d169acc)
>
> Well, it is also odd that this target claims ELFv2 support since our ABI code does not use ELFv2 on this target.
>
> https://github.com/rust-lang/rust/blob/be01dabfefd2daa4574b974f571c7852085d60cb/compiler/rustc_target/src/callconv/powerpc64.rs#L102-L111

```@rustbot``` label +O-PowerPC +O-freebsd
  • Loading branch information
matthiaskrgr authored Dec 13, 2024
2 parents 551c716 + 3a90c47 commit 6cb640a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/callconv/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
{
let abi = if cx.target_spec().env == "musl" {
let abi = if cx.target_spec().env == "musl" || cx.target_spec().os == "freebsd" {
ELFv2
} else if cx.target_spec().os == "aix" {
AIX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
Target {
llvm_target: "powerpc64-unknown-freebsd".into(),
metadata: crate::spec::TargetMetadata {
description: Some("PPC64 FreeBSD (ELFv1 and ELFv2)".into()),
description: Some("PPC64 FreeBSD (ELFv2)".into()),
tier: Some(3),
host_tools: Some(true),
std: Some(true),
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ target | std | host | notes
[`powerpc-unknown-openbsd`](platform-support/powerpc-unknown-openbsd.md) | * | |
[`powerpc-wrs-vxworks-spe`](platform-support/vxworks.md) | ✓ | |
[`powerpc-wrs-vxworks`](platform-support/vxworks.md) | ✓ | |
`powerpc64-unknown-freebsd` | ✓ | ✓ | PPC64 FreeBSD (ELFv1 and ELFv2)
`powerpc64-unknown-freebsd` | ✓ | ✓ | PPC64 FreeBSD (ELFv2)
`powerpc64le-unknown-freebsd` | ✓ | ✓ | PPC64LE FreeBSD
`powerpc-unknown-freebsd` | ? | | PowerPC FreeBSD
`powerpc64-unknown-linux-musl` | ? | | 64-bit PowerPC Linux with musl 1.2.3
Expand Down

0 comments on commit 6cb640a

Please sign in to comment.