-static void
-add_to_section_table (struct bfd *abfd, struct bfd_section *asect,
- void *closure)
-{
- struct section_closure *pp = closure;
- flagword aflag;
-
- /* NOTE: cagney/2003-10-22: Is this pruning useful? */
- aflag = bfd_get_section_flags (abfd, asect);
- if (!(aflag & SEC_ALLOC))
- return;
- if (bfd_section_size (abfd, asect) == 0)
- return;
- pp->end->bfd = abfd;
- pp->end->the_bfd_section = asect;
- pp->end->addr = bfd_section_vma (abfd, asect);
- pp->end->endaddr = pp->end->addr + bfd_section_size (abfd, asect);
- pp->end++;
-}
-
-void
-build_target_sections_from_bfd (struct target_ops *targ, struct bfd *abfd)
-{
- unsigned count;
- struct section_table *start;
- struct section_closure cl;
-
- count = bfd_count_sections (abfd);
- target_resize_to_sections (targ, count);
- start = targ->to_sections;
- cl.end = targ->to_sections;
- bfd_map_over_sections (abfd, add_to_section_table, &cl);
- gdb_assert (cl.end - start <= count);
-}
+ /* The section table build from the ALLOC sections in BFD. Note
+ that we can't rely on extracting the BFD from a random section in
+ the table, since the table can be legitimately empty. */
+ struct target_section_table table;
+};