]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix m68k OS ABI sniffer
authorAndreas Schwab <schwab@linux-m68k.org>
Wed, 14 Aug 2024 16:48:56 +0000 (18:48 +0200)
committerAndreas Schwab <schwab@linux-m68k.org>
Mon, 19 Aug 2024 17:28:49 +0000 (19:28 +0200)
Do not override the generic OS ABI sniffer.

Fixes: 3eba3a011a8 ("Various m68k fixes for gdb")
gdb/m68k-tdep.c

index 1b8cc927e0c9271585180ad32a4b70389a8a302d..375d5e6e54ca562cf909eb40693032c63e63bbbf 100644 (file)
@@ -1350,11 +1350,19 @@ static enum gdb_osabi
 m68k_osabi_sniffer (bfd *abfd)
 {
   unsigned int elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
+  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
   if (elfosabi == ELFOSABI_NONE)
-    return GDB_OSABI_SVR4;
+    {
+      /* Check note sections.  */
+      for (asection *sect : gdb_bfd_sections (abfd))
+       generic_elf_osabi_sniff_abi_tag_sections (abfd, sect, &osabi);
+
+      if (osabi == GDB_OSABI_UNKNOWN)
+       osabi = GDB_OSABI_SVR4;
+    }
 
-  return GDB_OSABI_UNKNOWN;
+  return osabi;
 }
 
 void _initialize_m68k_tdep ();