[COMMITTED] unstrip: update unstripped_shnum when adding a new section

Mark Wielaard mark@klomp.org
Tue Jun 3 12:08:26 GMT 2025


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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/unstrip.c b/src/unstrip.c
index 81c5496f43a0..6c2a98ef96f2 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -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);
-- 
2.49.0



More information about the Elfutils-devel mailing list