[2/2] x86: use IS_ELF

Message ID 9b115243-9fb0-df6d-cea1-5af6bdf1e660@suse.com
State Accepted
Headers
Series x86: object format checking |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Jan Beulich Nov. 6, 2023, 2:04 p.m. UTC
  ... instead of (inefficiently) open-coding it.
  

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3056,8 +3056,7 @@  i386_arch (void)
 {
   if (cpu_arch_isa == PROCESSOR_IAMCU)
     {
-      if (OUTPUT_FLAVOR != bfd_target_elf_flavour
-	  || flag_code == CODE_64BIT)
+      if (!IS_ELF || flag_code == CODE_64BIT)
 	as_fatal (_("Intel MCU is 32bit ELF only"));
       return bfd_arch_iamcu;
     }
@@ -3080,7 +3079,7 @@  i386_mach (void)
     {
       if (cpu_arch_isa == PROCESSOR_IAMCU)
 	{
-	  if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
+	  if (!IS_ELF)
 	    as_fatal (_("Intel MCU is 32bit ELF only"));
 	  return bfd_mach_i386_iamcu;
 	}
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -154,11 +154,9 @@  extern int tc_i386_fix_adjustable (struc
 /* ELF wants external syms kept, as does PE COFF.  */
 #if defined (TE_PE) && defined (STRICT_PE_FORMAT)
 #define EXTERN_FORCE_RELOC				\
-  (OUTPUT_FLAVOR == bfd_target_elf_flavour		\
-   || OUTPUT_FLAVOR == bfd_target_coff_flavour)
+  (IS_ELF || OUTPUT_FLAVOR == bfd_target_coff_flavour)
 #else
-#define EXTERN_FORCE_RELOC				\
-  (OUTPUT_FLAVOR == bfd_target_elf_flavour)
+#define EXTERN_FORCE_RELOC	IS_ELF
 #endif
 
 /* This expression evaluates to true if the relocation is for a local