Set SEC_SMALL_DATA on small common
authorAlan Modra <amodra@gmail.com>
Sat, 15 Aug 2020 04:34:43 +0000 (14:04 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 15 Aug 2020 05:44:42 +0000 (15:14 +0930)
Unlike the previous patch setting SEC_SMALL_DATA during
elf_backend_symbol_processing, this patch is mostly cosmetic.

* elf32-frv.c (elf32_frv_add_symbol_hook): Set SEC_SMALL_DATA on
small common section.
* elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
* elf32-microblaze.c (microblaze_elf_add_symbol_hook): Likewise.
* elf32-nds32.c (nds32_elf_add_symbol_hook): Likewise.
* elf32-nios2.c (nios2_elf_add_symbol_hook): Likewise.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf32-score.c (s3_bfd_score_elf_add_symbol_hook): Likewise.
* elf32-score7.c (s7_bfd_score_elf_add_symbol_hook): Likewise.
* elf32-tic6x.c (elf32_tic6x_add_symbol_hook): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
(v850_elf_add_symbol_hook): Likewise.
* elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
* elf64-ia64-vms.c (elf64_ia64_add_symbol_hook): Likewise.
* elfnn-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
* elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Likewise.

15 files changed:
bfd/ChangeLog
bfd/elf32-frv.c
bfd/elf32-m32r.c
bfd/elf32-microblaze.c
bfd/elf32-nds32.c
bfd/elf32-nios2.c
bfd/elf32-ppc.c
bfd/elf32-score.c
bfd/elf32-score7.c
bfd/elf32-tic6x.c
bfd/elf32-v850.c
bfd/elf64-alpha.c
bfd/elf64-ia64-vms.c
bfd/elfnn-ia64.c
bfd/elfxx-mips.c

index 85fb61887a7cbc647106349bf2924e604a267b72..4106b52a996e9b4dfae43d7aded1f667498dcb74 100644 (file)
@@ -1,3 +1,22 @@
+2020-08-15  Alan Modra  <amodra@gmail.com>
+
+       * elf32-frv.c (elf32_frv_add_symbol_hook): Set SEC_SMALL_DATA on
+       small common section.
+       * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
+       * elf32-microblaze.c (microblaze_elf_add_symbol_hook): Likewise.
+       * elf32-nds32.c (nds32_elf_add_symbol_hook): Likewise.
+       * elf32-nios2.c (nios2_elf_add_symbol_hook): Likewise.
+       * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
+       * elf32-score.c (s3_bfd_score_elf_add_symbol_hook): Likewise.
+       * elf32-score7.c (s7_bfd_score_elf_add_symbol_hook): Likewise.
+       * elf32-tic6x.c (elf32_tic6x_add_symbol_hook): Likewise.
+       * elf32-v850.c (v850_elf_check_relocs): Likewise.
+       (v850_elf_add_symbol_hook): Likewise.
+       * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
+       * elf64-ia64-vms.c (elf64_ia64_add_symbol_hook): Likewise.
+       * elfnn-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
+       * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Likewise.
+
 2020-08-15  Alan Modra  <amodra@gmail.com>
 
        PR 26389
index 96ed5f6bb065c9317c75449b5afb670a2c406812..ad0779b52c578ca4507b3cea06901e1f26544665 100644 (file)
@@ -4122,6 +4122,7 @@ elf32_frv_add_symbol_hook (bfd *abfd,
          scomm = bfd_make_section_with_flags (abfd, ".scommon",
                                               (SEC_ALLOC
                                                | SEC_IS_COMMON
+                                               | SEC_SMALL_DATA
                                                | SEC_LINKER_CREATED));
          if (scomm == NULL)
            return FALSE;
index ea8e3376512c81ce52bd8abf2697e5a89d7fb6d2..5857c943aec9adb4ca9f4c4a9b5433c4c942fc78 100644 (file)
@@ -1434,7 +1434,7 @@ m32r_elf_add_symbol_hook (bfd *abfd,
     {
     case SHN_M32R_SCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".scommon");
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       break;
     }
index 09a1e56becd9cd79ac32fc620df702926db2d69f..10aa022beeaeffbeedfd339a430d7f7d1a696f8a 100644 (file)
@@ -3399,7 +3399,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
         put into .sbss.  */
       *secp = bfd_make_section_old_way (abfd, ".sbss");
       if (*secp == NULL
-         || !bfd_set_section_flags (*secp, SEC_IS_COMMON))
+         || !bfd_set_section_flags (*secp, SEC_IS_COMMON | SEC_SMALL_DATA))
        return FALSE;
 
       *valp = sym->st_size;
index 1f9f9ba964c0e14c98e88dc52fe0e802a7ad3471..233af38c2307e1c66dc02d8d5d2cb966e2293420 100644 (file)
@@ -3368,7 +3368,7 @@ nds32_elf_add_symbol_hook (bfd *abfd,
          || ELF_ST_TYPE (sym->st_info) == STT_TLS)
        break;
 
-      /* st_value is the alignemnt constraint.
+      /* st_value is the alignment constraint.
         That might be its actual size if it is an array or structure.  */
       switch (sym->st_value)
        {
@@ -3388,7 +3388,7 @@ nds32_elf_add_symbol_hook (bfd *abfd,
          return TRUE;
        }
 
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       break;
     }
index 84e52285d3fb574f645c3b807d7bae2c9f612da8..153bfadc619ac14ce95d5d24d98034ce30ac321a 100644 (file)
@@ -5972,7 +5972,7 @@ nios2_elf_add_symbol_hook (bfd *abfd,
       htab = elf32_nios2_hash_table (info);
       if (htab->sbss == NULL)
        {
-         flagword flags = SEC_IS_COMMON | SEC_LINKER_CREATED;
+         flagword flags = SEC_IS_COMMON | SEC_SMALL_DATA | SEC_LINKER_CREATED;
 
          if (htab->root.dynobj == NULL)
            htab->root.dynobj = abfd;
index 93b50bc334abac66d1b94544c8f863ab5aaf21af..8d34b9b058a69c26c810a3bbe0b04ec52da91756 100644 (file)
@@ -2629,7 +2629,7 @@ ppc_elf_add_symbol_hook (bfd *abfd,
       htab = ppc_elf_hash_table (info);
       if (htab->sbss == NULL)
        {
-         flagword flags = SEC_IS_COMMON | SEC_LINKER_CREATED;
+         flagword flags = SEC_IS_COMMON | SEC_SMALL_DATA | SEC_LINKER_CREATED;
 
          if (!htab->elf.dynobj)
            htab->elf.dynobj = abfd;
index 4be656102f25fc640fb203dcc1a553d50021c572..80380573d5ef560dc5f4d885cf56ab1c25830a5e 100644 (file)
@@ -3010,7 +3010,7 @@ s3_bfd_score_elf_add_symbol_hook (bfd *abfd,
       /* Fall through.  */
     case SHN_SCORE_SCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".scommon");
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       break;
     }
index c9746905b230f12c2c45ba35e7c23f8a91df0cd4..8b2b4bc54b8cb61bfc3867827f284a8b215ab8c1 100644 (file)
@@ -2815,7 +2815,7 @@ s7_bfd_score_elf_add_symbol_hook (bfd *abfd,
       /* Fall through.  */
     case SHN_SCORE_SCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".scommon");
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       break;
     }
index a37ae293175c8532cc014ff12ee40217852c2ba2..5f5abd591fe6bd03b6d21930edad4b3f0b68c20e 100644 (file)
@@ -2952,7 +2952,7 @@ elf32_tic6x_add_symbol_hook (bfd *abfd,
     {
     case SHN_TIC6X_SCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".scommon");
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       bfd_set_section_alignment (*secp, bfd_log2 (sym->st_value));
       break;
index c1e959e6c2d2b58a0ddd304f7d64a41131789f69..8c6af580fc7e885ecf7a775cf90d890b578479ae 100644 (file)
@@ -183,7 +183,7 @@ v850_elf_check_relocs (bfd *abfd,
              asection * section;
 
              section = h->root.u.c.p->section = bfd_make_section_old_way (abfd, common);
-             section->flags |= SEC_IS_COMMON;
+             section->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
            }
 
 #ifdef DEBUG
@@ -3096,19 +3096,19 @@ v850_elf_add_symbol_hook (bfd *abfd,
     {
     case SHN_V850_SCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".scommon");
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       break;
 
     case SHN_V850_TCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".tcommon");
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       break;
 
     case SHN_V850_ZCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".zcommon");
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       break;
     }
index a6b20982609b3d2ca3ed8a052d011dfe0cae88f3..cb89dfb03fa29ea2b2bf1bd5cbcb29fc5c908a46 100644 (file)
@@ -1240,6 +1240,7 @@ elf64_alpha_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
          scomm = bfd_make_section_with_flags (abfd, ".scommon",
                                               (SEC_ALLOC
                                                | SEC_IS_COMMON
+                                               | SEC_SMALL_DATA
                                                | SEC_LINKER_CREATED));
          if (scomm == NULL)
            return FALSE;
index a97858ebfbe8af1ac31f0f822b2ce3c14d2143f4..fd001607a359bf04d15799b97a8a4ec37e0c77af 100644 (file)
@@ -881,6 +881,7 @@ elf64_ia64_add_symbol_hook (bfd *abfd,
          scomm = bfd_make_section_with_flags (abfd, ".scommon",
                                               (SEC_ALLOC
                                                | SEC_IS_COMMON
+                                               | SEC_SMALL_DATA
                                                | SEC_LINKER_CREATED));
          if (scomm == NULL)
            return FALSE;
index 4d6a0279e319cbca553257508509dad7c47d5e78..e347332aa259f25d02ac5db02dd870b9f8d30d6c 100644 (file)
@@ -1064,6 +1064,7 @@ elfNN_ia64_add_symbol_hook (bfd *abfd,
          scomm = bfd_make_section_with_flags (abfd, ".scommon",
                                               (SEC_ALLOC
                                                | SEC_IS_COMMON
+                                               | SEC_SMALL_DATA
                                                | SEC_LINKER_CREATED));
          if (scomm == NULL)
            return FALSE;
index 5b985a493d84239b7d69ca582f5db450cb1ca728..a0439041c0c418d5cce5f0e7a57ba22675a77e4c 100644 (file)
@@ -7800,7 +7800,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
       /* Fall through.  */
     case SHN_MIPS_SCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".scommon");
-      (*secp)->flags |= SEC_IS_COMMON;
+      (*secp)->flags |= SEC_IS_COMMON | SEC_SMALL_DATA;
       *valp = sym->st_size;
       break;