When support for non-contiguous memory was added, some corner cases when
sections were removed from the output object, did not emit fatal error and
reached code paths that correctly assumed every input section had a valid
output section, and this led to crashes due to segfault.
This patch adds BFD_ASSERTs in the previously segfaulting code, to
explicitly state code assumptions.
stub_entry->target_section);
stub_sec = stub_entry->stub_sec;
+ BFD_ASSERT (stub_sec->output_section != NULL);
/* The layout must not change when a stub may be the target of another. */
if (htab->has_double_stub)
sym = local_syms + r_symndx;
sym_type = ELFNN_ST_TYPE (sym->st_info);
sec = local_sections[r_symndx];
+ BFD_ASSERT (sec->output_section != NULL);
/* An object file might have a reference to a local
undefined symbol. This is a daft object file, but we