Repository: rust-lang/rust
File: compiler/rustc_target/src/spec/mod.rs (Rust)

Code before:
            Arch::RiscV64 => {
                // Note that the `lp64e` is still unstable as it's not (yet) part of the ELF psABI.
                check_matches!(
                    &*self.llvm_abiname,
                    "lp64" | "lp64f" | "lp64d" | "lp64e",
                    "invalid RISC-V ABI name: {}",
                    self.llvm_abiname,
                );
            }
            Arch::Arm => {
                check!(
                    self.llvm_floatabi.is_some(),
                    "ARM targets must set `llvm-floatabi` to `hard` or `soft`",
                )
            }
            // PowerPC64 targets that are not AIX must set their ABI to either ELFv1 or ELFv2
            Arch::PowerPC64 if self.os != Os::Aix => {
                check_matches!(
                    &*self.llvm_abiname,
                    "elfv1" | "elfv2",
                    "invalid PowerPC64 ABI name: {}",
                    self.llvm_abiname,
                );
            }
            // Little-endian PowerPC64 only supports the ELFv2 ABI
            Arch::PowerPC64LE => {
                check!(
                    self.llvm_abiname == "elfv2",
                    "PowerPC64LE targets only support the `elfv2` ABI",
                );
            }
            _ => {}
        }

        // Check consistency of Rust ABI declaration.
        if let Some(rust_abi) = self.rustc_abi {
            match rust_abi {
                RustcAbi::X86Sse2 => check_matches!(
                    self.arch,
                    Arch::X86,
                    "`x86-sse2` ABI is only valid for x86-32 targets"
                ),
                RustcAbi::X86Softfloat => check_matches!(
                    self.arch,
                    Arch::X86 | Arch::X86_64,
                    "`x86-softfloat` ABI is only valid for x86 targets"
                ),
            }
        }

        // Check that the given target-features string makes some basic sense.

Review comment (suggestion):
`Arch::PowerPC64LE` is unused and `Arch` for Little-endian PowerPC64 is `Arch::PowerPC64`. (See https://github.com/rust-lang/rust/pull/150966)

You have to use `Arch::PowerPC64` and check the endian.



Code after:
                    "invalid RISC-V ABI name: {}",
                    self.llvm_abiname,
                );
            }
            Arch::RiscV64 => {
                // Note that the `lp64e` is still unstable as it's not (yet) part of the ELF psABI.
                check_matches!(
                    &*self.llvm_abiname,
                    "lp64" | "lp64f" | "lp64d" | "lp64e",
                    "invalid RISC-V ABI name: {}",
                    self.llvm_abiname,
                );
            }
            Arch::Arm => {
                check!(
                    self.llvm_floatabi.is_some(),
                    "ARM targets must set `llvm-floatabi` to `hard` or `soft`",
                )
            }
            // PowerPC64 targets that are not AIX must set their ABI to either ELFv1 or ELFv2
            Arch::PowerPC64 => {
                if self.os == Os::Aix {
                    check!(
                        self.llvm_abiname.is_empty(),
                        "AIX targets always use the AIX ABI and `llvm_abiname` should be left empty",
                    );
                } else if self.endian == Endian::Big {
                    check_matches!(
                        &*self.llvm_abiname,
                        "elfv1" | "elfv2",
                        "invalid PowerPC64 ABI name: {}",
                        self.llvm_abiname,
                    );
                } else {
                    check!(
                        self.llvm_abiname == "elfv2",
                        "little-endian PowerPC64 targets only support the `elfv2` ABI",
                    );
                }
            }
            _ => {}
        }

        // Check consistency of Rust ABI declaration.
        if let Some(rust_abi) = self.rustc_abi {
            match rust_abi {
                RustcAbi::X86Sse2 => check_matches!(
                    self.arch,
                    Arch::X86,
                    "`x86-sse2` ABI is only valid for x86-32 targets"
                ),