Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Fix m68k OS ABI sniffer
Date: Wed, 14 Aug 2024 18:51:40 +0200	[thread overview]
Message-ID: <871q2r6o9v.fsf@igel.home> (raw)

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."

             reply	other threads:[~2024-08-14 16:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 16:51 Andreas Schwab [this message]
2024-08-18 17:17 ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871q2r6o9v.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox