* symfile.c (add_psymbol_to_bcache): Return a const pointer. Use
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 38768ccedb66386e8e4f5581191a47a3456e73a1..68cec1b725af71895e556163417042b38eb3282d 100644 (file)
@@ -49,6 +49,7 @@
 #include "source.h"
 #include "addrmap.h"
 #include "arch-utils.h"
+#include "exec.h"
 
 /* Prototypes for local functions */
 
@@ -67,10 +68,6 @@ struct objfile *rt_common_objfile;   /* For runtime common symbols */
    objfile_p_char is a char * to get it through
    bfd_map_over_sections; we cast it back to its proper type.  */
 
-#ifndef TARGET_KEEP_SECTION
-#define TARGET_KEEP_SECTION(ASECT)     0
-#endif
-
 /* Called via bfd_map_over_sections to build up the section table that
    the objfile references.  The objfile contains pointers to the start
    of the table (objfile->sections) and to the first location after
@@ -86,7 +83,7 @@ add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect,
 
   aflag = bfd_get_section_flags (abfd, asect);
 
-  if (!(aflag & SEC_ALLOC) && !(TARGET_KEEP_SECTION (asect)))
+  if (!(aflag & SEC_ALLOC))
     return;
 
   if (0 == bfd_section_size (abfd, asect))
@@ -532,6 +529,7 @@ free_all_objfiles (void)
 void
 objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
 {
+  struct obj_section *s;
   struct section_offsets *delta =
     ((struct section_offsets *) 
      alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)));
@@ -595,8 +593,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
                 But I'm leaving out that test, on the theory that
                 they can't possibly pass the tests below.  */
              if ((SYMBOL_CLASS (sym) == LOC_LABEL
-                  || SYMBOL_CLASS (sym) == LOC_STATIC
-                  || SYMBOL_CLASS (sym) == LOC_INDIRECT)
+                  || SYMBOL_CLASS (sym) == LOC_STATIC)
                  && SYMBOL_SECTION (sym) >= 0)
                {
                  SYMBOL_VALUE_ADDRESS (sym) +=
@@ -683,6 +680,15 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
       }
   }
 
+  /* Update the table in exec_ops, used to read memory.  */
+  ALL_OBJFILE_OSECTIONS (objfile, s)
+    {
+      int idx = s->the_bfd_section->index;
+
+      exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
+                               s->addr);
+    }
+
   /* Relocate breakpoints as necessary, after things are relocated. */
   breakpoint_re_set ();
 }
This page took 0.031856 seconds and 4 git commands to generate.