Skip to content

Commit 2106bd3

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 2106bd3

File tree

1 file changed

+17
-0
lines changed
  • compiler/rustc_target/src/spec

1 file changed

+17
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,6 +3178,23 @@ impl Target {
31783178
"ARM targets must set `llvm-floatabi` to `hard` or `soft`",
31793179
)
31803180
}
3181+
// If a PowerPC64 targets sets its ABI, it must be set to either ELFv1 or ELFv2
3182+
Arch::PowerPC64 => {
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_matches!(
3193+
&*self.llvm_abiname,
3194+
"" | "elfv2",
3195+
"PowerPC64LE targets only support the `elfv2` ABI",
3196+
);
3197+
}
31813198
_ => {}
31823199
}
31833200

0 commit comments

Comments
 (0)