aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-15 14:04:43 +0930
committerAlan Modra <amodra@gmail.com>2020-08-15 15:14:42 +0930
commit10885e2436ad1b50c26effb1cead20c06c9320c3 (patch)
treeb30097288c8af1c7947103234c8a32760ef3e114 /bfd
parent4d1823674eedf267c7cafac2b923256db0b10ac8 (diff)
downloadgdb-10885e2436ad1b50c26effb1cead20c06c9320c3.zip
gdb-10885e2436ad1b50c26effb1cead20c06c9320c3.tar.gz
gdb-10885e2436ad1b50c26effb1cead20c06c9320c3.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog19
-rw-r--r--bfd/elf32-frv.c1
-rw-r--r--bfd/elf32-m32r.c2
-rw-r--r--bfd/elf32-microblaze.c2
-rw-r--r--bfd/elf32-nds32.c4
-rw-r--r--bfd/elf32-nios2.c2
-rw-r--r--bfd/elf32-ppc.c2
-rw-r--r--bfd/elf32-score.c2
-rw-r--r--bfd/elf32-score7.c2
-rw-r--r--bfd/elf32-tic6x.c2
-rw-r--r--bfd/elf32-v850.c8
-rw-r--r--bfd/elf64-alpha.c1
-rw-r--r--bfd/elf64-ia64-vms.c1
-rw-r--r--bfd/elfnn-ia64.c1
-rw-r--r--bfd/elfxx-mips.c2
15 files changed, 37 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 85fb618..4106b52 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,24 @@
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
* syms.c (bfd_decode_symclass): Choose 'c' for commons only when
SEC_SMALL_DATA.
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 96ed5f6..ad0779b 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 ea8e337..5857c94 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 09a1e56..10aa022 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 1f9f9ba..233af38 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 84e5228..153bfad 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 93b50bc..8d34b9b 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 4be6561..8038057 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 c974690..8b2b4bc 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 a37ae29..5f5abd5 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 c1e959e..8c6af58 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 a6b2098..cb89dfb 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 a97858e..fd00160 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 4d6a027..e347332 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 5b985a4..a043904 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;