diff options
author | Tom Tromey <tromey@redhat.com> | 2013-12-31 06:52:33 -0700 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-01-15 11:02:23 -0700 |
commit | 53eddfa6069cc556a22d388fbde0cc83beb91bfb (patch) | |
tree | 86c4d38a4e0d7370216b90cb711471d1ce45ce7b /gdb/symfile.c | |
parent | d56e56aaa79d7d65e9d969a7bf6795f2612d34ca (diff) | |
download | gdb-53eddfa6069cc556a22d388fbde0cc83beb91bfb.zip gdb-53eddfa6069cc556a22d388fbde0cc83beb91bfb.tar.gz gdb-53eddfa6069cc556a22d388fbde0cc83beb91bfb.tar.bz2 |
relocate the entry point address when used
This changes the entry point to be unrelocated in the objfile, and
instead applies the relocation when it is used.
2014-01-15 Tom Tromey <tromey@redhat.com>
* objfiles.c (entry_point_address_query): Relocate entry point
address.
(objfile_relocate1): Do not relocate entry point address.
* objfiles.h (struct entry_info) <entry_point>: Update comment.
<the_bfd_section_index>: New field.
* symfile.c (init_entry_point_info): Find the entry point's
section.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index d863282..bd12552 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -894,7 +894,9 @@ init_entry_point_info (struct objfile *objfile) if (objfile->ei.entry_point_p) { + struct obj_section *osect; CORE_ADDR entry_point = objfile->ei.entry_point; + int found; /* Make certain that the address points at real code, and not a function descriptor. */ @@ -907,6 +909,25 @@ init_entry_point_info (struct objfile *objfile) symbol table. */ objfile->ei.entry_point = gdbarch_addr_bits_remove (get_objfile_arch (objfile), entry_point); + + found = 0; + ALL_OBJFILE_OSECTIONS (objfile, osect) + { + struct bfd_section *sect = osect->the_bfd_section; + + if (entry_point >= bfd_get_section_vma (objfile->obfd, sect) + && entry_point < (bfd_get_section_vma (objfile->obfd, sect) + + bfd_get_section_size (sect))) + { + objfile->ei.the_bfd_section_index + = gdb_bfd_section_index (objfile->obfd, sect); + found = 1; + break; + } + } + + if (!found) + objfile->ei.the_bfd_section_index = SECT_OFF_TEXT (objfile); } } |