int mapped;
{
struct objfile *objfile = NULL;
+ struct objfile *last_one = NULL;
mapped |= mapped_symbol_files;
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);
}
+/* Put OBJFILE at the front of the list. */
+
+void
+objfile_to_front (objfile)
+ struct objfile *objfile;
+{
+ struct objfile **objp;
+ for (objp = &object_files; *objp != NULL; objp = &((*objp)->next))
+ {
+ if (*objp == objfile)
+ {
+ /* Unhook it from where it is. */
+ *objp = objfile->next;
+ /* Put it in the front. */
+ objfile->next = object_files;
+ object_files = objfile;
+ break;
+ }
+ }
+}
+
/* Unlink OBJFILE from the list of known objfiles, if it is found in the
list.
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);
}
if (SYMBOL_SECTION (msym) >= 0)
SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym));
}
+ /* Relocating different sections by different amounts may cause the symbols
+ to be out of order. */
+ msymbols_sort (objfile);
{
int i;
struct obj_section *s;
bfd *abfd;
- abfd = symfile_objfile->obfd;
+ abfd = objfile->obfd;
- for (s = symfile_objfile->sections;
- s < symfile_objfile->sections_end; ++s)
+ for (s = objfile->sections;
+ s < objfile->sections_end; ++s)
{
flagword flags;
}
}
}
+
+ 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