]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/objfiles.c
* objfiles.h (struct objfile): New GDBARCH member.
[thirdparty/binutils-gdb.git] / gdb / objfiles.c
index 35b67258bd4eeaca5d40b1d6b590f43d4a1666b6..b7d578f956de611a828d604939ebc99f30267842 100644 (file)
@@ -48,6 +48,7 @@
 #include "dictionary.h"
 #include "source.h"
 #include "addrmap.h"
+#include "arch-utils.h"
 
 /* Prototypes for local functions */
 
@@ -187,6 +188,9 @@ allocate_objfile (bfd *abfd, int flags)
     }
   if (abfd != NULL)
     {
+      /* Look up the gdbarch associated with the BFD.  */
+      objfile->gdbarch = gdbarch_from_bfd (abfd);
+
       objfile->name = xstrdup (bfd_get_filename (abfd));
       objfile->mtime = bfd_get_mtime (abfd);
 
@@ -234,6 +238,13 @@ allocate_objfile (bfd *abfd, int flags)
   return (objfile);
 }
 
+/* Retrieve the gdbarch associated with OBJFILE.  */
+struct gdbarch *
+get_objfile_arch (struct objfile *objfile)
+{
+  return objfile->gdbarch;
+}
+
 /* Initialize entry point information for this objfile. */
 
 void