Skip to content

Comments

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing#150468

Open
Gelbpunkt wants to merge 2 commits intorust-lang:mainfrom
Gelbpunkt:rustc-target-callconv-spec-elf-abi
Open

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing#150468
Gelbpunkt wants to merge 2 commits intorust-lang:mainfrom
Gelbpunkt:rustc-target-callconv-spec-elf-abi

Conversation

@Gelbpunkt
Copy link
Contributor

@Gelbpunkt Gelbpunkt commented Dec 28, 2025

View all comments

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the llvm_abiname set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing llvm_abiname validation

@rustbot
Copy link
Collaborator

rustbot commented Dec 28, 2025

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

@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 Dec 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 28, 2025

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@chenyukang
Copy link
Member

@rustbot reroll

@rustbot rustbot assigned jieyouxu and unassigned chenyukang Jan 13, 2026
@jieyouxu
Copy link
Member

@rustbot reroll

@rustbot rustbot assigned fee1-dead and unassigned jieyouxu Jan 13, 2026
…instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target
options. We can therefore stop hardcoding the ABI to be used based on
the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility
with custom targets.

This makes it so that big endian targets not explicitly accounted for
before (powerpc64-unknown-openbsd) and targets that don't use the
expected default ABI (ELFv2 Glibc targets) use the correct ABI in the
calling convention code.
@Gelbpunkt Gelbpunkt force-pushed the rustc-target-callconv-spec-elf-abi branch from 35377f3 to b2e1f69 Compare January 13, 2026 14:56
@rustbot
Copy link
Collaborator

rustbot commented Jan 13, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Gelbpunkt Gelbpunkt force-pushed the rustc-target-callconv-spec-elf-abi branch from b2e1f69 to d40f0cd Compare January 13, 2026 15:33
… PowerPC64(LE)

PowerPC64 ELF targets (effectively anything that isn't AIX) use either
the ELFv1 or ELFv2 ABI. The ELFv1 ABI is only specified for big endian
targets, while ELFv2 can be used by both little- and big-endian targets.
Make sure that, if an LLVM ABI is set, it is set to one of the two. AIX
does not set an LLVM ABI name, so ensure that AIX targets don't set
anything other than an empty ABI name.
@Gelbpunkt Gelbpunkt force-pushed the rustc-target-callconv-spec-elf-abi branch from d40f0cd to 168f324 Compare January 15, 2026 03:00
@fee1-dead
Copy link
Member

@rustbot reroll

@rustbot rustbot assigned davidtwco and unassigned fee1-dead Jan 18, 2026
@RalfJung
Copy link
Member

r? me

This LGTM from by 10k foot view without knowing anything about the details of these ABIs ;) . However, do we have to worry about this breaking the ABI for anyone already using these targets?

Also, @workingjubilee I wouldn't mind a second opinion. :)

@rustbot rustbot assigned RalfJung and unassigned davidtwco Jan 18, 2026
@Gelbpunkt
Copy link
Contributor Author

However, do we have to worry about this breaking the ABI for anyone already using these targets?

Previously, this hardcoded the list of big-endian targets using ELFv2 to musl and FreeBSD, which was not kept up to date (OpenBSD is missing from here). Since all PowerPC64 targets now specify their ABI, we can stop hardcoding the list. It will not break the ABI for any of them, AFAICT this is strictly a fix for the OpenBSD target and makes it so there's one less part of the code we need to worry about when changing or adding new targets.

rust-bors bot pushed a commit that referenced this pull request Feb 21, 2026
Rollup of 14 pull requests

Successful merges:

 - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing)
 - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts)
 - #151740 (Fix short backtraces from stripped executables)
 - #151871 (don't use env with infer vars)
 - #152591 (Simplify internals of `{Rc,Arc}::default`)
 - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned)
 - #152908 (Enable rust.remap-debuginfo in the dist profile)
 - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7)
 - #152767 (fix typo in `carryless_mul` macro invocation)
 - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`)
 - #152871 (Fix warnings in rs{begin,end}.rs files)
 - #152921 (Add build.rustdoc option to bootstrap config)
 - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint)
 - #152937 (remove unneeded reboxing)
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 22, 2026
…ec-elf-abi, r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
Rollup of 15 pull requests

Successful merges:

 - #149366 (GVN: consider constants of primitive types as deterministic)
 - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing)
 - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts)
 - #151871 (don't use env with infer vars)
 - #152591 (Simplify internals of `{Rc,Arc}::default`)
 - #152657 (std: move `exit` out of PAL)
 - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned)
 - #152908 (Enable rust.remap-debuginfo in the dist profile)
 - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7)
 - #152767 (fix typo in `carryless_mul` macro invocation)
 - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`)
 - #152871 (Fix warnings in rs{begin,end}.rs files)
 - #152921 (Add build.rustdoc option to bootstrap config)
 - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint)
 - #152937 (remove unneeded reboxing)
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 22, 2026
…ec-elf-abi, r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
Rollup of 14 pull requests

Successful merges:

 - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing)
 - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts)
 - #151871 (don't use env with infer vars)
 - #152591 (Simplify internals of `{Rc,Arc}::default`)
 - #152657 (std: move `exit` out of PAL)
 - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned)
 - #152908 (Enable rust.remap-debuginfo in the dist profile)
 - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7)
 - #152767 (fix typo in `carryless_mul` macro invocation)
 - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`)
 - #152871 (Fix warnings in rs{begin,end}.rs files)
 - #152921 (Add build.rustdoc option to bootstrap config)
 - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint)
 - #152937 (remove unneeded reboxing)
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

⌛ Testing commit 168f324 with merge dd20a2b...

Workflow: https://github.com/rust-lang/rust/actions/runs/22272126794

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
… r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 22, 2026
…ec-elf-abi, r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
@jhpratt
Copy link
Member

jhpratt commented Feb 22, 2026

yielding to encompassing rollup

@bors yield

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #152957.

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
Rollup of 13 pull requests

Successful merges:

 - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing)
 - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts)
 - #151871 (don't use env with infer vars)
 - #152591 (Simplify internals of `{Rc,Arc}::default`)
 - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned)
 - #152908 (Enable rust.remap-debuginfo in the dist profile)
 - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7)
 - #152767 (fix typo in `carryless_mul` macro invocation)
 - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`)
 - #152871 (Fix warnings in rs{begin,end}.rs files)
 - #152921 (Add build.rustdoc option to bootstrap config)
 - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint)
 - #152937 (remove unneeded reboxing)
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

⌛ Testing commit 168f324 with merge 7c35f94...

Workflow: https://github.com/rust-lang/rust/actions/runs/22273503822

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
… r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 22, 2026
…ec-elf-abi, r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
@jhpratt
Copy link
Member

jhpratt commented Feb 22, 2026

once again

@bors yield

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #152960.

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
Rollup of 15 pull requests

Successful merges:

 - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing)
 - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts)
 - #151871 (don't use env with infer vars)
 - #152591 (Simplify internals of `{Rc,Arc}::default`)
 - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned)
 - #152908 (Enable rust.remap-debuginfo in the dist profile)
 - #147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls)
 - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7)
 - #152767 (fix typo in `carryless_mul` macro invocation)
 - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`)
 - #152871 (Fix warnings in rs{begin,end}.rs files)
 - #152879 (Remove `impl IntoQueryParam<P> for &'a P`.)
 - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint)
 - #152937 (remove unneeded reboxing)
 - #152953 (Fix typo in armv7a-vex-v5.md)
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

⌛ Testing commit 168f324 with merge e59a71a...

Workflow: https://github.com/rust-lang/rust/actions/runs/22275041573

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
… r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 22, 2026
…ec-elf-abi, r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 22, 2026
…ec-elf-abi, r=RalfJung

rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing

All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case.

The fallback based on endianness is kept for the sake of compatibility with custom targets.

This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (big-endian ELFv2 Glibc targets) use the correct ABI in the calling convention code.

The second commit is a tiny change to validate the `llvm_abiname` set on PowerPC64(LE) targets. See the commit messages for details.

CC @RalfJung who pointed out the missing `llvm_abiname` validation
@JonathanBrouwer
Copy link
Contributor

once again

@bors yield

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #152965.

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing)
 - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts)
 - #151871 (don't use env with infer vars)
 - #152591 (Simplify internals of `{Rc,Arc}::default`)
 - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned)
 - #147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls)
 - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7)
 - #152767 (fix typo in `carryless_mul` macro invocation)
 - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`)
 - #152871 (Fix warnings in rs{begin,end}.rs files)
 - #152879 (Remove `impl IntoQueryParam<P> for &'a P`.)
 - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint)
 - #152937 (remove unneeded reboxing)
 - #152953 (Fix typo in armv7a-vex-v5.md)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.