Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix m68k OS ABI sniffer
@ 2024-08-14 16:51 Andreas Schwab
  2024-08-18 17:17 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2024-08-14 16:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Do not override the generic OS ABI sniffer.

Fixes: 3eba3a011a8 ("Various m68k fixes for gdb")
---
 gdb/m68k-tdep.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 439ebd241e8..0d268aa947b 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -1353,11 +1353,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 ();
-- 
2.46.0


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-18 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-14 16:51 [PATCH] Fix m68k OS ABI sniffer Andreas Schwab
2024-08-18 17:17 ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox