- printf_filtered (_("\tEntry point: %s\n"),
- paddress (gdbarch, bfd_get_start_address (abfd)));
+ {
+ /* gcc-3.4 does not like the initialization in
+ <p == t->sections_end>. */
+ bfd_vma displacement = 0;
+ bfd_vma entry_point;
+
+ for (p = t->sections; p < t->sections_end; p++)
+ {
+ asection *asect = p->the_bfd_section;
+
+ if ((bfd_get_section_flags (abfd, asect) & (SEC_ALLOC | SEC_LOAD))
+ != (SEC_ALLOC | SEC_LOAD))
+ continue;
+
+ if (bfd_get_section_vma (abfd, asect) <= abfd->start_address
+ && abfd->start_address < (bfd_get_section_vma (abfd, asect)
+ + bfd_get_section_size (asect)))
+ {
+ displacement = p->addr - bfd_get_section_vma (abfd, asect);
+ break;
+ }
+ }
+ if (p == t->sections_end)
+ warning (_("Cannot find section for the entry point of %s."),
+ bfd_get_filename (abfd));
+
+ entry_point = gdbarch_addr_bits_remove (gdbarch,
+ bfd_get_start_address (abfd)
+ + displacement);
+ printf_filtered (_("\tEntry point: %s\n"),
+ paddress (gdbarch, entry_point));
+ }