aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-mmix.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-12-17 07:44:48 +1030
committerAlan Modra <amodra@gmail.com>2020-12-18 10:34:16 +1030
commit7f3a18cfb58deb36e05469d94e7b9e48b19d90af (patch)
treefdcaf3f90aab305c07bb75189d9db56db67c4dbe /bfd/elf64-mmix.c
parent3ece0b95273fafe20fface5be0b70667eaf7a127 (diff)
downloadgdb-7f3a18cfb58deb36e05469d94e7b9e48b19d90af.zip
gdb-7f3a18cfb58deb36e05469d94e7b9e48b19d90af.tar.gz
gdb-7f3a18cfb58deb36e05469d94e7b9e48b19d90af.tar.bz2
Statically initialise target common sections
This tidies initialisation of target common sections, doing so using a static initialiser rather than via code and deleting unnecessary symbol_ptr_ptr variables (the one in asection is used instead). The patch also initialises ecoff.c:bfd_debug_section using BFD_FAKE_SECTION. That does change bfd_debug_section slightly, output_section was NULL now bfd_debug_section, and symbol_ptr_ptr was NULL now &bfd_debug_section.symbol, but I believe those changes are safe. bfd/ * ecoff.c (bfd_debug_section): Init using BFD_FAKE_SECTION. (ecoff_scom_section, ecoff_scom_symbol): Statically init using BFD_FAKE_SECTION and GLOBAL_SYM_INIT. Delete initialisation code. (ecoff_scom_symbol_ptr): Delete. * elf32-m32r.c (m32r_elf_scom_section, m32r_elf_scom_symbol), (m32r_elf_scom_symbol_ptr), * elf32-score.c (score_elf_scom_section, score_elf_scom_symbol), (score_elf_scom_symbol_ptr), * elf32-score7.c (score_elf_scom_section, score_elf_scom_symbol), (score_elf_scom_symbol_ptr), * elf32-tic6x.c (tic6x_elf_scom_section, tic6x_elf_scom_symbol), (tic6x_elf_scom_symbol_ptr), * elf32-v850.c (v850_elf_scom_section, v850_elf_scom_symbol), (v850_elf_scom_symbol_ptr), (v850_elf_tcom_section, v850_elf_tcom_symbol), (v850_elf_tcom_symbol_ptr), (v850_elf_zcom_section, v850_elf_zcom_symbol), (v850_elf_zcom_symbol_ptr), * elf64-mmix.c (mmix_elf_reg_section, mmix_elf_reg_section_symbol), (mmix_elf_reg_section_symbol_ptr), * elfxx-mips.c (mips_elf_scom_section, mips_elf_scom_symbol), (mips_elf_scom_symbol_ptr): Likewise. gas/ * ecoff.c (ecoff_frob_symbol): Rename scom_section to ecoff_scom_section and statically initialise.
Diffstat (limited to 'bfd/elf64-mmix.c')
-rw-r--r--bfd/elf64-mmix.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 2fc491c..fad1a0a 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -2076,8 +2076,11 @@ mmix_elf_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
formats (e.g. mmo) than for example a STT_REGISTER attribute.
This section faking is based on a construct in elf32-mips.c. */
static asection mmix_elf_reg_section;
-static asymbol mmix_elf_reg_section_symbol;
-static asymbol *mmix_elf_reg_section_symbol_ptr;
+static const asymbol mmix_elf_reg_section_symbol =
+ GLOBAL_SYM_INIT (MMIX_REG_SECTION_NAME, &mmix_elf_reg_section);
+static asection mmix_elf_reg_section =
+ BFD_FAKE_SECTION (mmix_elf_reg_section, &mmix_elf_reg_section_symbol,
+ MMIX_REG_SECTION_NAME, 0, SEC_NO_FLAGS);
/* Handle the special section numbers that a symbol may use. */
@@ -2090,19 +2093,6 @@ mmix_elf_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, asymbol *asym)
switch (elfsym->internal_elf_sym.st_shndx)
{
case SHN_REGISTER:
- if (mmix_elf_reg_section.name == NULL)
- {
- /* Initialize the register section. */
- mmix_elf_reg_section.name = MMIX_REG_SECTION_NAME;
- mmix_elf_reg_section.flags = SEC_NO_FLAGS;
- mmix_elf_reg_section.output_section = &mmix_elf_reg_section;
- mmix_elf_reg_section.symbol = &mmix_elf_reg_section_symbol;
- mmix_elf_reg_section.symbol_ptr_ptr = &mmix_elf_reg_section_symbol_ptr;
- mmix_elf_reg_section_symbol.name = MMIX_REG_SECTION_NAME;
- mmix_elf_reg_section_symbol.flags = BSF_SECTION_SYM;
- mmix_elf_reg_section_symbol.section = &mmix_elf_reg_section;
- mmix_elf_reg_section_symbol_ptr = &mmix_elf_reg_section_symbol;
- }
asym->section = &mmix_elf_reg_section;
break;