aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@codesourcery.com>2014-09-09 23:41:28 +0100
committerMaciej W. Rozycki <macro@codesourcery.com>2014-09-10 00:02:02 +0100
commit6e46637421cc7318c3a1333e32725eaca5f7af4c (patch)
tree408913f7716a22a7e78ab72685596e07f00c25d9
parenta1ada89ac66ca4a3815e586396a09eb311cf9b77 (diff)
downloadgdb-6e46637421cc7318c3a1333e32725eaca5f7af4c.zip
gdb-6e46637421cc7318c3a1333e32725eaca5f7af4c.tar.gz
gdb-6e46637421cc7318c3a1333e32725eaca5f7af4c.tar.bz2
MIPS: Don't infer IRIX OS ABI from generic section names
There are `.MIPS.abiflags', `.MIPS.options' and `.MIPS.stubs' sections also present in Linux executables, so we can't infer IRIX OS ABI solely from the existence of these sections. This is not going to be a problem as there are bound to be other sections whose names start with `.MIPS.' in IRIX executables and this selection only matters for a non-default OS ABI in a multiple-target GDB executable. As a last resort the automatic selection can be overridden with `set osabi'. * mips-irix-tdep.c (mips_irix_elf_osabi_sniff_abi_tag_sections): Exclude `.MIPS.abiflags', `.MIPS.options' and `.MIPS.stubs' from the list of sections determining GDB_OSABI_IRIX.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/mips-irix-tdep.c16
2 files changed, 16 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5ce1ec1..afb1f92 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2014-09-09 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * mips-irix-tdep.c (mips_irix_elf_osabi_sniff_abi_tag_sections):
+ Exclude `.MIPS.abiflags', `.MIPS.options' and `.MIPS.stubs' from
+ the list of sections determining GDB_OSABI_IRIX.
+
2014-09-09 James Hogan <james.hogan@imgtec.com>
* MAINTAINERS (Write After Approval): Add "James Hogan".
diff --git a/gdb/mips-irix-tdep.c b/gdb/mips-irix-tdep.c
index a017e3b..1232be8 100644
--- a/gdb/mips-irix-tdep.c
+++ b/gdb/mips-irix-tdep.c
@@ -38,12 +38,16 @@ mips_irix_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
name = bfd_get_section_name (abfd, sect);
sectsize = bfd_section_size (abfd, sect);
- if (strncmp (name, ".MIPS.", 6) == 0 && sectsize > 0)
- {
- /* The presence of a section named with a ".MIPS." prefix is
- indicative of an IRIX binary. */
- *os_ident_ptr = GDB_OSABI_IRIX;
- }
+ /* The presence of a section named with a ".MIPS." prefix is usually
+ indicative of an IRIX binary, however there are exceptions that
+ are present universally, so check for those names and avoid
+ switching away from the default OS ABI in the case of a match. */
+ if (strncmp (name, ".MIPS.", 6) == 0
+ && strcmp (name, ".MIPS.abiflags") != 0
+ && strcmp (name, ".MIPS.options") != 0
+ && strcmp (name, ".MIPS.stubs") != 0
+ && sectsize > 0)
+ *os_ident_ptr = GDB_OSABI_IRIX;
}
static enum gdb_osabi