]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
unstrip: update unstripped_shnum when adding a new section
authorMark Wielaard <mark@klomp.org>
Tue, 3 Jun 2025 12:06:36 +0000 (14:06 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 3 Jun 2025 12:06:41 +0000 (14:06 +0200)
If some section doesn't match between the stripped and unstripped file
we invent a new one. Make sure to also update the shnum value.

   * src/unstrip.c (copy_elided_sections): Update unstripped_shnum.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/unstrip.c

index 81c5496f43a0214ff722c4f43231099a169a871d..6c2a98ef96f25dd6a49e90f8f29665261d6f4cf7 100644 (file)
@@ -1666,6 +1666,7 @@ more sections in stripped file than debug file -- arguments reversed?"));
          ELF_CHECK (newdata != NULL && gelf_update_shdr (sec->outscn,
                                                          &sec->shdr),
                     _("cannot add new section: %s"));
+         unstripped_shnum++;
 
          if (strtab == NULL)
            strtab = dwelf_strtab_init (true);