diff options
-rw-r--r-- | src/elfcompress.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/elfcompress.c b/src/elfcompress.c index 18ade66f..f771b92a 100644 --- a/src/elfcompress.c +++ b/src/elfcompress.c @@ -529,30 +529,33 @@ process_file (const char *fname) } } - if (shdr->sh_type != SHT_NOBITS - && (shdr->sh_flags & SHF_ALLOC) == 0) + if (force || type != schtype) { - set_section (sections, ndx); - /* Check if we might want to change this section name. */ - if (! adjust_names - && ((type != ZLIB_GNU - && startswith (sname, ".zdebug")) - || (type == ZLIB_GNU - && startswith (sname, ".debug")))) - adjust_names = true; - - /* We need a buffer this large if we change the names. */ - if (adjust_names) + if (shdr->sh_type != SHT_NOBITS + && (shdr->sh_flags & SHF_ALLOC) == 0) { - size_t slen = strlen (sname); - if (slen > maxnamelen) - maxnamelen = slen; + set_section (sections, ndx); + /* Check if we might want to change this section name. */ + if (! adjust_names + && ((type != ZLIB_GNU + && startswith (sname, ".zdebug")) + || (type == ZLIB_GNU + && startswith (sname, ".debug")))) + adjust_names = true; + + /* We need a buffer this large if we change the names. */ + if (adjust_names) + { + size_t slen = strlen (sname); + if (slen > maxnamelen) + maxnamelen = slen; + } } + else + if (verbose >= 0) + printf ("[%zd] %s ignoring %s section\n", ndx, sname, + (shdr->sh_type == SHT_NOBITS ? "no bits" : "allocated")); } - else - if (verbose >= 0) - printf ("[%zd] %s ignoring %s section\n", ndx, sname, - (shdr->sh_type == SHT_NOBITS ? "no bits" : "allocated")); } if (shdr->sh_type == SHT_SYMTAB) |