diff --git a/dwz.c b/dwz.c index b3b779d..074ac19 100644 --- a/dwz.c +++ b/dwz.c @@ -10141,6 +10141,13 @@ write_dso (DSO *dso, const char *file, struct stat *st) for (j = 1; j < dso->ehdr.e_shnum; ++j) if (dso->shdr[j].sh_offset < min_shoff && !last_shoff) continue; + else if (dso->shdr[j].sh_type == SHT_NOBITS) + { + /* Fixup NOBITS placement which if initially out-of-order + can be nonsensically now. */ + dso->shdr[j].sh_offset = 0; + continue; + } else if ((dso->shdr[j].sh_flags & SHF_ALLOC) != 0) { error (0, 0, "Allocatable section in %s after non-allocatable "