Skip to content

Commit 35377f3

Browse files
committed
rustc_target: spec: Ensure that a valid llvm_abiname value is set for 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 it does not need to be accounted for in any way other than allowing an unset value. Signed-off-by: Jens Reidel <adrian@travitia.xyz>
1 parent b1c1354 commit 35377f3

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • compiler/rustc_target/src/spec

compiler/rustc_target/src/spec/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,6 +3178,22 @@ impl Target {
31783178
"ARM targets must set `llvm-floatabi` to `hard` or `soft`",
31793179
)
31803180
}
3181+
// PowerPC64 targets that are not AIX must set their ABI to either ELFv1 or ELFv2
3182+
Arch::PowerPC64 if self.os != Os::Aix => {
3183+
check_matches!(
3184+
&*self.llvm_abiname,
3185+
"elfv1" | "elfv2",
3186+
"invalid PowerPC64 ABI name: {}",
3187+
self.llvm_abiname,
3188+
);
3189+
}
3190+
// Little-endian PowerPC64 only supports the ELFv2 ABI
3191+
Arch::PowerPC64LE => {
3192+
check!(
3193+
self.llvm_abiname == "elfv2",
3194+
"PowerPC64LE targets only support the `elfv2` ABI",
3195+
);
3196+
}
31813197
_ => {}
31823198
}
31833199

0 commit comments

Comments
 (0)