Skip to content

Change the ABI of powerpc64-unknown-linux-gnu to ELFv2 #977

@Gelbpunkt

Description

@Gelbpunkt

Proposal

I propose changing the ABI of the powerpc64-unknown-linux-gnu target from ELFv1 to ELFv2. This target is currently in tier 2 with host tools, but has no dedicated maintainers, which I believe is largely due to the legacy ABI it uses. I would like to maintain the target, but only if it were to use the ELFv2 ABI.

I have previously proposed a powerpc64-unknown-linux-gnuelfv2 target in rust-lang/rust#144220, but LLVM maintainers were concerned about Rust inventing triples that LLVM does not know about. In the process of that, I did the preliminary work for enabling ELFv2 on a Glibc target in Rust in llvm/llvm-project#149725.

The rationale for the ELFv2 is rather simple: it is the more modern ABI and has less overhead. For those reasons, it is also more widely used and supported. For example, LLD only supports the ELFv2 ABI, LLDB AFAICT only supports ELFv2, Zig has dropped support for ELFv1 and assumes all ppc64 targets to use ELFv2, Go is switching to ELFv2 for ppc64 in 1.27.

Distribution support for ELFv2 is also generally better than ELFv1. Most of the best-supported distributions on ppc64 are musl-based, which is ELFv2 only, but some Glibc-based distributions exist, for example ArchPOWER or Void Linux, which means users of these distributions (which are very actively maintained) cannot make use of the current definition of the powerpc64-unknown-linux-gnu target. Out of other Glibc-based distributions, I'm aware of Gentoo, which currently uses ELFv1 for Glibc but appears to be aware that ELFv2 is a future option for them. NixOS on ppc64 supports both ELFv1 and ELFv2 with Glibc.

I'm interested in maintaining the target, but it only has value to me and much of the ppc64 userbase with the ELFv2 ABI. Since the necessary LLVM changes are present since 22.1.0, we can now finally make the switch. If anyone's interested in keeping ELFv1 on Glibc alive, they can create a separate target, but I believe ELFv2 is the more reasonable default nowadays.

Mentors or Reviewers

none

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member who is knowledgeable in the area can second by writing @rustbot second or kickoff a team FCP with @rfcbot fcp $RESOLUTION.
  • Once an MCP is seconded, the Final Comment Period begins.
    • Final Comment Period lasts for 10 days after all outstanding concerns are solved.
    • Outstanding concerns will block the Final Comment Period from finishing. Once all concerns are resolved, the 10 day countdown is restarted.
    • If no concerns are raised after 10 days since the resolution of the last outstanding concern, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustc

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions