* symfile.c (reread_symbols): Include bfd_errmsg string in error
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 530e19b054b58a85a49e81eb25425fbac813221d..5cd01e5210e2223897d95c71882f0a079c5be7ac 100644 (file)
@@ -123,6 +123,7 @@ allocate_objfile (abfd, mapped)
      int mapped;
 {
   struct objfile *objfile = NULL;
+  struct objfile *last_one = NULL;
 
   mapped |= mapped_symbol_files;
 
@@ -257,11 +258,18 @@ allocate_objfile (abfd, mapped)
             objfile -> name, bfd_errmsg (bfd_get_error ()));
     }
 
-  /* Push this file onto the head of the linked list of other such files. */
-
-  objfile -> next = object_files;
-  object_files = objfile;
+  /* Add this file onto the tail of the linked list of other such files. */
 
+  objfile -> next = NULL;
+  if (object_files == NULL)
+    object_files = objfile;
+  else
+    {
+      for (last_one = object_files;
+          last_one -> next;
+          last_one = last_one -> next);
+      last_one -> next = objfile;
+    }
   return (objfile);
 }
 
@@ -333,7 +341,9 @@ free_objfile (objfile)
   if (objfile -> obfd != NULL)
     {
       char *name = bfd_get_filename (objfile->obfd);
-      bfd_close (objfile -> obfd);
+      if (!bfd_close (objfile -> obfd))
+       warning ("cannot close \"%s\": %s",
+                name, bfd_errmsg (bfd_get_error ()));
       free (name);
     }
 
@@ -578,6 +588,27 @@ objfile_relocate (objfile, new_offsets)
          }
       }
   }
+
+  if (objfile->ei.entry_point != ~0)
+    objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT);
+
+  if (objfile->ei.entry_func_lowpc != INVALID_ENTRY_LOWPC)
+    {
+      objfile->ei.entry_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT);
+      objfile->ei.entry_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT);
+    }
+
+  if (objfile->ei.entry_file_lowpc != INVALID_ENTRY_LOWPC)
+    {
+      objfile->ei.entry_file_lowpc += ANOFFSET (delta, SECT_OFF_TEXT);
+      objfile->ei.entry_file_highpc += ANOFFSET (delta, SECT_OFF_TEXT);
+    }
+
+  if (objfile->ei.main_func_lowpc != INVALID_ENTRY_LOWPC)
+    {
+      objfile->ei.main_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT);
+      objfile->ei.main_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT);
+    }
 }
 \f
 /* Many places in gdb want to test just to see if we have any partial
This page took 0.025411 seconds and 4 git commands to generate.