Skip to content

Commit b2e1f69

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.
1 parent 3ae6901 commit b2e1f69

File tree

1 file changed

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

1 file changed

+16
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,6 +3182,22 @@ impl Target {
31823182
"ARM targets must set `llvm-floatabi` to `hard` or `soft`",
31833183
)
31843184
}
3185+
// PowerPC64 targets that are not AIX must set their ABI to either ELFv1 or ELFv2
3186+
Arch::PowerPC64 if self.os != Os::Aix => {
3187+
if self.endian == Endian::Big {
3188+
check_matches!(
3189+
&*self.llvm_abiname,
3190+
"elfv1" | "elfv2",
3191+
"invalid PowerPC64 ABI name: {}",
3192+
self.llvm_abiname,
3193+
);
3194+
} else {
3195+
check!(
3196+
self.llvm_abiname == "elfv2",
3197+
"little-endian PowerPC64 targets only support the `elfv2` ABI",
3198+
);
3199+
}
3200+
}
31853201
_ => {}
31863202
}
31873203

0 commit comments

Comments
 (0)