Rollup merge of #132421 - beetrees:riscv-abi-no-empty-string, r=workingjubilee

Remove `""` case from RISC-V `llvm_abiname` match statement

For RISC-V, `""` isn't the always the same ABI as `"ilp32"`/`"lp64"` (`""` means LLVM will infer the ABI based on the enabled target features), but `create_object_file` currently assumes that it is. Since all RISC-V targets explicitly specify their ABI since #131807, this PR removes `""` from the match arm's pattern (meaning an empty string will now fall through to the `_ => bug!` arm).

r? `@workingjubilee`
This commit is contained in:
Jubilee 2024-10-31 17:50:44 -07:00 committed by GitHub
commit a25ab33770
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -322,7 +322,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
// Set the appropriate flag based on ABI // Set the appropriate flag based on ABI
// This needs to match LLVM `RISCVELFStreamer.cpp` // This needs to match LLVM `RISCVELFStreamer.cpp`
match &*sess.target.llvm_abiname { match &*sess.target.llvm_abiname {
"" | "ilp32" | "lp64" => (), "ilp32" | "lp64" => (),
"ilp32f" | "lp64f" => e_flags |= elf::EF_RISCV_FLOAT_ABI_SINGLE, "ilp32f" | "lp64f" => e_flags |= elf::EF_RISCV_FLOAT_ABI_SINGLE,
"ilp32d" | "lp64d" => e_flags |= elf::EF_RISCV_FLOAT_ABI_DOUBLE, "ilp32d" | "lp64d" => e_flags |= elf::EF_RISCV_FLOAT_ABI_DOUBLE,
// Note that the `lp64e` is still unstable as it's not (yet) part of the ELF psABI. // Note that the `lp64e` is still unstable as it's not (yet) part of the ELF psABI.