From: Alan Modra Date: Sat, 15 Aug 2020 04:34:43 +0000 (+0930) Subject: Set SEC_SMALL_DATA on small common X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10885e2436ad1b50c26effb1cead20c06c9320c3;p=binutils-gdb.git Set SEC_SMALL_DATA on small common 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 85fb61887a7..4106b52a996 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,22 @@ +2020-08-15 Alan Modra + + * 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 PR 26389 diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 96ed5f6bb06..ad0779b52c5 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -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; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index ea8e3376512..5857c943aec 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -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; } diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 09a1e56becd..10aa022beea 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -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; diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 1f9f9ba964c..233af38c230 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -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; } diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index 84e52285d3f..153bfadc619 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -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; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 93b50bc334a..8d34b9b058a 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -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; diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 4be656102f2..80380573d5e 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -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; } diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index c9746905b23..8b2b4bc54b8 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -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; } diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index a37ae293175..5f5abd591fe 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -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; diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index c1e959e6c2d..8c6af580fc7 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -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; } diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index a6b20982609..cb89dfb03fa 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -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; diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index a97858ebfbe..fd001607a35 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -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; diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 4d6a0279e31..e347332aa25 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -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; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 5b985a493d8..a0439041c0c 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -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;