aboutsummaryrefslogtreecommitdiff
path: root/bfd
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
parentbf57746745ac0c0d2922de5af5f0d8527d7a585a (diff)
downloadfsf-binutils-gdb-a4dd6c97bd5c7e2cc58f4d2a0b83145646f67cc7.zip
fsf-binutils-gdb-a4dd6c97bd5c7e2cc58f4d2a0b83145646f67cc7.tar.gz
fsf-binutils-gdb-a4dd6c97bd5c7e2cc58f4d2a0b83145646f67cc7.tar.bz2
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')
-rw-r--r--bfd/ChangeLog11
-rw-r--r--bfd/coff-alpha.c3
-rw-r--r--bfd/coff-mips.c9
-rw-r--r--bfd/coffcode.h12
-rw-r--r--bfd/ecoff.c17
5 files changed, 40 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 304efd0..116b893 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,16 @@
2020-03-02 Alan Modra <amodra@gmail.com>
+ * 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.
+
+2020-03-02 Alan Modra <amodra@gmail.com>
+
* elf32-m32r.c (m32r_elf_section_flags): New function.
(elf_backend_section_flags): Define.
* elf32-nds32.c (nds32_elf_section_flags): New function.
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 9a3ac089..821e559 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2424,7 +2424,8 @@ const bfd_target alpha_ecoff_le_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
+ | SEC_DATA | SEC_SMALL_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 7c0a991..7721753 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1440,7 +1440,8 @@ const bfd_target mips_ecoff_le_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
+ | SEC_DATA | SEC_SMALL_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
@@ -1497,7 +1498,8 @@ const bfd_target mips_ecoff_be_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
+ | SEC_DATA | SEC_SMALL_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
@@ -1554,7 +1556,8 @@ const bfd_target mips_ecoff_bele_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
+ | SEC_DATA | SEC_SMALL_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index cd495db..27158a0 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
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 9e2efac..84eab99 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -156,14 +156,14 @@ _bfd_ecoff_new_section_hook (bfd *abfd, asection *section)
{ _INIT, SEC_ALLOC | SEC_CODE | SEC_LOAD },
{ _FINI, SEC_ALLOC | SEC_CODE | SEC_LOAD },
{ _DATA, SEC_ALLOC | SEC_DATA | SEC_LOAD },
- { _SDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD },
+ { _SDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_SMALL_DATA },
{ _RDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
- { _LIT8, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
- { _LIT4, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
+ { _LIT8, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY | SEC_SMALL_DATA},
+ { _LIT4, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY | SEC_SMALL_DATA},
{ _RCONST, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
{ _PDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY},
{ _BSS, SEC_ALLOC},
- { _SBSS, SEC_ALLOC},
+ { _SBSS, SEC_ALLOC | SEC_SMALL_DATA},
/* An Irix 4 shared libary. */
{ _LIB, SEC_COFF_SHARED_LIBRARY}
};
@@ -412,16 +412,19 @@ _bfd_ecoff_styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
|| styp_flags == STYP_PDATA
|| styp_flags == STYP_RCONST)
sec_flags |= SEC_READONLY;
+ if (styp_flags & STYP_SDATA)
+ sec_flags |= SEC_SMALL_DATA;
}
- else if ((styp_flags & STYP_BSS)
- || (styp_flags & STYP_SBSS))
+ else if (styp_flags & STYP_SBSS)
+ sec_flags |= SEC_ALLOC | SEC_SMALL_DATA;
+ else if (styp_flags & STYP_BSS)
sec_flags |= SEC_ALLOC;
else if ((styp_flags & STYP_INFO) || styp_flags == STYP_COMMENT)
sec_flags |= SEC_NEVER_LOAD;
else if ((styp_flags & STYP_LITA)
|| (styp_flags & STYP_LIT8)
|| (styp_flags & STYP_LIT4))
- sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
+ sec_flags |= SEC_DATA |SEC_SMALL_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
else if (styp_flags & STYP_ECOFF_LIB)
sec_flags |= SEC_COFF_SHARED_LIBRARY;
else