summaryrefslogtreecommitdiff
path: root/bfd/coffcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-03-02 10:17:18 +1030
committerAlan Modra <amodra@gmail.com>2020-03-02 11:36:19 +1030
commita4dd6c97bd5c7e2cc58f4d2a0b83145646f67cc7 (patch)
treeb314e12987da768cf9289d0cf9272521cc8536d6 /bfd/coffcode.h
parentbf57746745ac0c0d2922de5af5f0d8527d7a585a (diff)
downloadbinutils-gdb-a4dd6c97bd5c7e2cc58f4d2a0b83145646f67cc7.tar.gz
miscellaneous SEC_SMALL_DATA
This patch arranges for symbols defined in .sdata and .sbss to be reported by nm with 'g' and 's' flags, for coff targets that support .sdata and .sbss. The assembler changes regarding SEC_SMALL_DATA are really just documentation. As far as I'm aware, this won't change any assembler output. bfd/ * coff-alpha.c (alpha_ecoff_le_vec): Add SEC_SMALL_DATA to applicable section flags. * coff-mips.c (mips_ecoff_le_vec, mips_ecoff_be_vec): Likewise. (mips_ecoff_bele_vec): Likewise. * coffcode.h (sec_to_styp_flags): Set SEC_SMALL_DATA for .sdata and .sbss sections. * ecoff.c (_bfd_ecoff_new_section_hook): Likewise. (_bfd_ecoff_styp_to_sec_flags): Likewise. gas/ * config/tc-m32r.c (md_begin): Set SEC_SMALL_DATA on .scommon section. * config/tc-mips.c (s_change_sec): Set SEC_SMALL_DATA for .sdata and .sbss sections. * config/tc-score.c: Delete !BFD_ASSEMBLER code throughout. (s3_s_change_sec): Set SEC_SMALL_DATA for .sbss section. (s3_s_score_lcomm): Likewise. * config/tc-score7.c: Similarly. * read.c (bss_alloc): Set SEC_SMALL_DATA for .sbss section.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r--bfd/coffcode.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index cd495dbe618..27158a061cc 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -717,7 +717,7 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
#ifndef COFF_WITH_PE
static bfd_boolean
-styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
+styp_to_sec_flags (bfd *abfd,
void * hdr,
const char *name,
asection *section ATTRIBUTE_UNUSED,
@@ -850,6 +850,11 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
sec_flags = (SEC_LOAD | SEC_ALLOC);
#endif /* STYP_SDATA */
+ if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0
+ && (CONST_STRNEQ (name, ".sbss")
+ || CONST_STRNEQ (name, ".sdata")))
+ sec_flags |= SEC_SMALL_DATA;
+
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
/* As a GNU extension, if the name begins with .gnu.linkonce, we
only link a single copy of the section. This is used to support
@@ -1312,6 +1317,11 @@ styp_to_sec_flags (bfd *abfd,
}
}
+ if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0
+ && (CONST_STRNEQ (name, ".sbss")
+ || CONST_STRNEQ (name, ".sdata")))
+ sec_flags |= SEC_SMALL_DATA;
+
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
/* As a GNU extension, if the name begins with .gnu.linkonce, we
only link a single copy of the section. This is used to support