Skip to content

powerpc64-unknown-freebsd version in ports has patches to ELF version support and target description #117181

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
estebank opened this issue Oct 25, 2023 · 2 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-freebsd Operating system: FreeBSD O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

estebank commented Oct 25, 2023

The packaged version of rust in FreeBSD patches their release with

--- compiler/rustc_target/src/abi/call/powerpc64.rs.orig	2020-03-09 22:11:17 UTC
+++ compiler/rustc_target/src/abi/call/powerpc64.rs
@@ -123,7 +123,7 @@ where
         ELFv2
     } else {
         match cx.data_layout().endian {
-            Endian::Big => ELFv1,
+            Endian::Big => ELFv2,
             Endian::Little => ELFv2,
         }
     };

https://cgit.freebsd.org/ports/tree/lang/rust/files/patch-compiler_rustc__target_src_abi_call_powerpc64.rs

Immediately before that we have the following:

    let abi = if cx.target_spec().env == "musl" {
        ELFv2
    } else {

We can add yet another check for them there so that powerpc64-unknown-freebsd always uses ELFv2. The platform list page shows this one as "PPC64 FreeBSD (ELFv1 and ELFv2)" on Tier 3.

I do not know if doing this change would cause other issues, maybe with lowest FreeBSD version support?

They've been carrying this patch since 2019.


https://github.com/freebsd/freebsd-ports/blob/9c64647054c81b8876c7f4f987189427b5858ad6/lang/rust/files/patch-compiler_rustc__target_src_spec_powerpc64__unknown__freebsd.rs#L1-L14

Since 2020.

@estebank estebank added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-freebsd Operating system: FreeBSD C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Oct 25, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 25, 2023
@estebank estebank changed the title powerpc64-unknown-freebsd is ELF version dependent, but the version in ports only uses ELFv2 powerpc64-unknown-freebsd version in ports has patches to ELF version support and target description Oct 25, 2023
@estebank estebank added the O-PowerPC Target: PowerPC processors label Oct 25, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 25, 2023
@awilfox
Copy link
Contributor

awilfox commented Aug 4, 2024

I noticed this while I was working on #128579. Technically, at least per LLVM, this should only be the case in FreeBSD >=13.

  /// Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
  bool isPPC64ELFv2ABI() const {
    return (getArch() == Triple::ppc64 &&
            ((getOS() == Triple::FreeBSD &&
              (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
             getOS() == Triple::OpenBSD || isMusl()));
  }

It also appears to be the ABI of choice for OpenBSD on both endians, though I'm not sure how well OpenBSD supports big endian 64-bit Power.

@taiki-e
Copy link
Member

taiki-e commented Mar 1, 2025

As for rustc side, this has been fixed in #132150.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-freebsd Operating system: FreeBSD O-PowerPC Target: PowerPC processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants