@@ -20,7 +20,7 @@ use rustc_metadata::fs::METADATA_FILENAME;
2020use rustc_middle:: bug;
2121use rustc_session:: Session ;
2222use rustc_span:: sym;
23- use rustc_target:: spec:: { CfgAbi , Os , RelocModel , Target , ef_avr_arch} ;
23+ use rustc_target:: spec:: { CfgAbi , LlvmAbi , Os , RelocModel , Target , ef_avr_arch} ;
2424use tracing:: debug;
2525
2626use super :: apple;
@@ -295,10 +295,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
295295 } ;
296296
297297 // Use the explicitly given ABI.
298- match sess. target . options . llvm_abiname . as_ref ( ) {
299- "o32" if is_32bit => e_flags |= elf:: EF_MIPS_ABI_O32 ,
300- "n32" if !is_32bit => e_flags |= elf:: EF_MIPS_ABI2 ,
301- "n64" if !is_32bit => { }
298+ match & sess. target . options . llvm_abiname {
299+ LlvmAbi :: O32 if is_32bit => e_flags |= elf:: EF_MIPS_ABI_O32 ,
300+ LlvmAbi :: N32 if !is_32bit => e_flags |= elf:: EF_MIPS_ABI2 ,
301+ LlvmAbi :: N64 if !is_32bit => { }
302302 // The rest is invalid (which is already ensured by the target spec check).
303303 s => bug ! ( "invalid LLVM ABI `{}` for MIPS target" , s) ,
304304 } ;
@@ -336,12 +336,12 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
336336
337337 // Set the appropriate flag based on ABI
338338 // This needs to match LLVM `RISCVELFStreamer.cpp`
339- match & * sess. target . llvm_abiname {
340- "ilp32" | "lp64" => ( ) ,
341- "ilp32f" | "lp64f" => e_flags |= elf:: EF_RISCV_FLOAT_ABI_SINGLE ,
342- "ilp32d" | "lp64d" => e_flags |= elf:: EF_RISCV_FLOAT_ABI_DOUBLE ,
339+ match & sess. target . llvm_abiname {
340+ LlvmAbi :: Ilp32 | LlvmAbi :: Lp64 => ( ) ,
341+ LlvmAbi :: Ilp32f | LlvmAbi :: Lp64f => e_flags |= elf:: EF_RISCV_FLOAT_ABI_SINGLE ,
342+ LlvmAbi :: Ilp32d | LlvmAbi :: Lp64d => e_flags |= elf:: EF_RISCV_FLOAT_ABI_DOUBLE ,
343343 // Note that the `lp64e` is still unstable as it's not (yet) part of the ELF psABI.
344- "ilp32e" | "lp64e" => e_flags |= elf:: EF_RISCV_RVE ,
344+ LlvmAbi :: Ilp32e | LlvmAbi :: Lp64e => e_flags |= elf:: EF_RISCV_RVE ,
345345 _ => bug ! ( "unknown RISC-V ABI name" ) ,
346346 }
347347
@@ -353,10 +353,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
353353
354354 // Set the appropriate flag based on ABI
355355 // This needs to match LLVM `LoongArchELFStreamer.cpp`
356- match & * sess. target . llvm_abiname {
357- "ilp32s" | "lp64s" => e_flags |= elf:: EF_LARCH_ABI_SOFT_FLOAT ,
358- "ilp32f" | "lp64f" => e_flags |= elf:: EF_LARCH_ABI_SINGLE_FLOAT ,
359- "ilp32d" | "lp64d" => e_flags |= elf:: EF_LARCH_ABI_DOUBLE_FLOAT ,
356+ match & sess. target . llvm_abiname {
357+ LlvmAbi :: Ilp32s | LlvmAbi :: Lp64s => e_flags |= elf:: EF_LARCH_ABI_SOFT_FLOAT ,
358+ LlvmAbi :: Ilp32f | LlvmAbi :: Lp64f => e_flags |= elf:: EF_LARCH_ABI_SINGLE_FLOAT ,
359+ LlvmAbi :: Ilp32d | LlvmAbi :: Lp64d => e_flags |= elf:: EF_LARCH_ABI_DOUBLE_FLOAT ,
360360 _ => bug ! ( "unknown LoongArch ABI name" ) ,
361361 }
362362
@@ -383,14 +383,14 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
383383 const EF_PPC64_ABI_ELF_V1 : u32 = 1 ;
384384 const EF_PPC64_ABI_ELF_V2 : u32 = 2 ;
385385
386- match sess. target . options . llvm_abiname . as_ref ( ) {
386+ match sess. target . options . llvm_abiname {
387387 // If the flags do not correctly indicate the ABI,
388388 // linkers such as ld.lld assume that the ppc64 object files are always ELFv2
389389 // which leads to broken binaries if ELFv1 is used for the object files.
390- "elfv1" => EF_PPC64_ABI_ELF_V1 ,
391- "elfv2" => EF_PPC64_ABI_ELF_V2 ,
392- "" if sess. target . options . binary_format . to_object ( ) == BinaryFormat :: Elf => {
393- bug ! ( "No ABI specified for this PPC64 ELF target" ) ;
390+ LlvmAbi :: ElfV1 => EF_PPC64_ABI_ELF_V1 ,
391+ LlvmAbi :: ElfV2 => EF_PPC64_ABI_ELF_V2 ,
392+ _ if sess. target . options . binary_format . to_object ( ) == BinaryFormat :: Elf => {
393+ bug ! ( "invalid ABI specified for this PPC64 ELF target" ) ;
394394 }
395395 // Fall back
396396 _ => EF_PPC64_ABI_UNKNOWN ,
0 commit comments