]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
strip.c: Apply --permissive when writing the debug file
authorAaron Merey <amerey@redhat.com>
Tue, 23 Jul 2024 19:26:26 +0000 (15:26 -0400)
committerAaron Merey <amerey@redhat.com>
Tue, 23 Jul 2024 19:36:03 +0000 (15:36 -0400)
The --permissive command line option is applied when writing the binary
being stripped but is not applied when writing its separate debug file.

Change this so that --permissive applies to writing the debug file as well.

Signed-off-by: Aaron Merey <amerey@redhat.com>
src/strip.c

index 6436443dcceedcdc31d6b21ba51d310f7dea8322..403e0f6fbe723dd1f9e23ea6167819e08a56d8bf 100644 (file)
@@ -2464,6 +2464,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
   if (debug_fname != NULL && removing_sections)
     {
       /* Finally write the file.  */
+      if (permissive)
+       elf_flagelf (debugelf, ELF_C_SET, ELF_F_PERMISSIVE);
       if (unlikely (elf_update (debugelf, ELF_C_WRITE) == -1))
        {
          error (0, 0, _("while writing '%s': %s"),