if (r < 0)
goto ERROR;
- // Copy sources
- r = pakfire_stripper_copy_sources(stripper, file, fd);
- if (r < 0)
- goto ERROR;
+ // Only strip if there is actually some debug information
+ if (!pakfire_elf_is_stripped(elf)) {
+ // Copy sources
+ r = pakfire_stripper_copy_sources(stripper, file, fd);
+ if (r < 0)
+ goto ERROR;
- // Strip debug information
- r = pakfire_stripper_strip_debug_sections(stripper, file, elf);
- if (r < 0)
- goto ERROR;
+ // Strip debug information
+ r = pakfire_stripper_strip_debug_sections(stripper, file, elf);
+ if (r < 0)
+ goto ERROR;
+ }
ERROR:
if (elf)