Fia x comment typo.
[deliverable/binutils-gdb.git] / gdb / osabi.c
index e7774b7c3bf2bb47365f83fcfe45999af8cff029..8681170fb9e86cfc5f2bf1d59f1c5fd1d8902df8 100644 (file)
@@ -295,9 +295,9 @@ can_run_code_for (const struct bfd_arch_info *a, const struct bfd_arch_info *b)
      written for B, but B can't run code written for A, then it'll
      return A.
 
-     struct bfd_arch_info objects are atoms: that is, there's supposed
-     to be exactly one instance for a given machine.  So you can tell
-     whether two are equivalent by comparing pointers.  */
+     struct bfd_arch_info objects are singletons: that is, there's
+     supposed to be exactly one instance for a given machine.  So you
+     can tell whether two are equivalent by comparing pointers.  */
   return (a == b || a->compatible (a, b) == a);
 }
 
@@ -305,7 +305,6 @@ can_run_code_for (const struct bfd_arch_info *a, const struct bfd_arch_info *b)
 void
 gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
-  const struct bfd_arch_info *arch_info = gdbarch_bfd_arch_info (gdbarch);
   struct gdb_osabi_handler *handler;
 
   if (info.osabi == GDB_OSABI_UNKNOWN)
@@ -333,20 +332,26 @@ gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
         type that is compatible with the desired machine type.  Right
         now we simply return the first match, which is fine for now.
         However, we might want to do something smarter in the future.  */
-      if (can_run_code_for (arch_info, handler->arch_info))
+      /* NOTE: cagney/2003-10-23: The code for "a can_run_code_for b"
+         is implemented using BFD's compatible method (a->compatible
+         (b) == a -- the lowest common denominator between a and b is
+         a).  That method's definition of compatible may not be as you
+         expect.  For instance the test "amd64 can run code for i386"
+         (or more generally "64-bit ISA can run code for the 32-bit
+         ISA").  BFD doesn't normally consider 32-bit and 64-bit
+         "compatible" so it doesn't succeed.  */
+      if (can_run_code_for (info.bfd_arch_info, handler->arch_info))
        {
          (*handler->init_osabi) (info, gdbarch);
          return;
        }
     }
 
-  fprintf_filtered
-    (gdb_stderr,
-     "A handler for the OS ABI \"%s\" is not built into this "
-     "configuration of GDB.  "
-     "Attempting to continue with the default %s settings",
-     gdbarch_osabi_name (info.osabi),
-     bfd_printable_arch_mach (arch_info->arch, arch_info->mach));
+  warning ("A handler for the OS ABI \"%s\" is not built into this "
+          "configuration of GDB.  "
+          "Attempting to continue with the default %s settings",
+          gdbarch_osabi_name (info.osabi),
+          info.bfd_arch_info->printable_name);
 }
 \f
 
@@ -457,6 +462,13 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
        }
       return;
     }
+
+  /* .note.netbsdcore.procinfo notes, used by NetBSD.  */
+  if (strcmp (name, ".note.netbsdcore.procinfo") == 0 && sectsize > 0)
+    {
+      *os_ident_ptr = GDB_OSABI_NETBSD_ELF;
+      return;
+    }
 }
 
 static enum gdb_osabi
@@ -588,8 +600,6 @@ _initialize_gdb_osabi (void)
                                  bfd_target_elf_flavour,
                                  generic_elf_osabi_sniffer);
 
-  return;
-
   /* Register the "set osabi" command.  */
   c = add_set_enum_cmd ("osabi", class_support, gdb_osabi_available_names,
                        &set_osabi_string, "Set OS ABI of target.", &setlist);
This page took 0.024323 seconds and 4 git commands to generate.