From: Ulrich Weigand <ulrich.weigand@de.ibm.com>
build_objfile_section_table () creates four synthetic sections per
objfile, which are collected by update_section_map () and passed to
std::sort (). When there are a lot of objfiles, for example, when
debugging JITs, the presence of these sections slows down the sorting
significantly.
The output of update_section_map () is used by find_pc_section (),
which can never return any of these sections: their size is 0, so they
cannot be accepted by bsearch_cmp ().
Filter them (and all the other empty sections) out in
insert_section_p (), which is used only by update_section_map ().
}
/* Return 1 if SECTION should be inserted into the section map.
- We want to insert only non-overlay and non-TLS section. */
+ We want to insert only non-overlay non-TLS non-empty sections. */
static int
insert_section_p (const struct bfd *abfd,
if ((bfd_section_flags (section) & SEC_THREAD_LOCAL) != 0)
/* This is a TLS section. */
return 0;
+ if (bfd_section_size (section) == 0)
+ {
+ /* This is an empty section. It has no PCs for find_pc_section (), so
+ there is no reason to insert it into the section map. */
+ return 0;
+ }
return 1;
}