[AArch64] Tidy up in aarch64_mem_op_p().
[deliverable/binutils-gdb.git] / bfd / elf.c
index 13d4272c93620442d15d24fd612af16179a32510..c4defda728dadbaa13086a13324a71efdfd03e35 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1069,16 +1069,22 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
                 abfd, name);
              return FALSE;
            }
-         if (name[1] != 'z')
+         /* PR binutils/18087: Compression does not always make a section
+            smaller.  So only rename the section when compression has
+            actually taken place.  */
+         if (newsect->compress_status == COMPRESS_SECTION_DONE)
            {
-             unsigned int len = strlen (name);
-
-             new_name = bfd_alloc (abfd, len + 2);
-             if (new_name == NULL)
-               return FALSE;
-             new_name[0] = '.';
-             new_name[1] = 'z';
-             memcpy (new_name + 2, name + 1, len);
+             if (name[1] != 'z')
+               {
+                 unsigned int len = strlen (name);
+
+                 new_name = bfd_alloc (abfd, len + 2);
+                 if (new_name == NULL)
+                   return FALSE;
+                 new_name[0] = '.';
+                 new_name[1] = 'z';
+                 memcpy (new_name + 2, name + 1, len);
+               }
            }
          break;
        case decompress:
This page took 0.025844 seconds and 4 git commands to generate.