summaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-08-20 15:04:50 +0000
committerTom Tromey <tromey@redhat.com>2013-08-20 15:04:50 +0000
commitc68c091dc292c9df749bfdbc9f9e455c4768dfcf (patch)
tree71f7c10748b5d23a83427463901e4222ac8c5ba6 /gdb/objfiles.c
parentd2d590480e6b5fe0f4eb65b98faf337290a4ba8e (diff)
downloadgdb-c68c091dc292c9df749bfdbc9f9e455c4768dfcf.tar.gz
move gdbarch object from objfile to per-BFD
This moves the "gdbarch" field from the objfile into the BFD. This field's value is derived from the BFD and is immutable over the lifetime of the BFD. This makes it a reasonable candidate for pushing into the per-BFD object. This is part of the long-term objfile splitting project. In the long run I think this patch will make it simpler to moves types from the objfile to the per-BFD object; but the patch makes sense as a minor cleanup by itself. Built and regtested on x86-64 Fedora 18. * cp-namespace.c (cp_lookup_symbol_imports_or_template): Use get_objfile_arch. * elfread.c (elf_rel_plt_read, elf_gnu_ifunc_record_cache) (elf_gnu_ifunc_resolve_by_got): Use get_objfile_arch. * jit.c (jit_object_close_impl): Update. * jv-lang.c (get_dynamics_objfile): Update. * linespec.c (add_minsym): Use get_dynamics_objfile. * objfiles.c (get_objfile_bfd_data): Initialize 'gdbarch' field. (allocate_objfile): Don't initialize 'gdbarch' field. (get_objfile_arch): Update. * objfiles.h (struct objfile_per_bfd_storage) <gdbarch>: New field, moved from... (struct objfile) <gdbarch>: ... here. Remove. * stap-probe.c (stap_can_evaluate_probe_arguments): Use get_objfile_arch. * symfile.c (init_entry_point_info): Use get_objfile_arch.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 759159c35af..2b8cf4e2962 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -143,6 +143,9 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
{
storage = bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage));
set_bfd_data (abfd, objfiles_bfd_data, storage);
+
+ /* Look up the gdbarch associated with the BFD. */
+ storage->gdbarch = gdbarch_from_bfd (abfd);
}
else
storage = OBSTACK_ZALLOC (&objfile->objfile_obstack,
@@ -282,9 +285,6 @@ allocate_objfile (bfd *abfd, int flags)
gdb_bfd_ref (abfd);
if (abfd != NULL)
{
- /* Look up the gdbarch associated with the BFD. */
- objfile->gdbarch = gdbarch_from_bfd (abfd);
-
objfile->name = bfd_get_filename (abfd);
objfile->mtime = bfd_get_mtime (abfd);
@@ -335,7 +335,7 @@ allocate_objfile (bfd *abfd, int flags)
struct gdbarch *
get_objfile_arch (struct objfile *objfile)
{
- return objfile->gdbarch;
+ return objfile->per_bfd->gdbarch;
}
/* If there is a valid and known entry point, function fills *ENTRY_P with it