aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-10-04 09:42:45 +0200
committerJan Beulich <jbeulich@suse.com>2024-10-04 09:42:45 +0200
commit85ef4a5ed82fb5f71c78505acfac2104767f908d (patch)
treefb367d30677f54a8ad27700d7de29c920c43bbd5 /gas
parente9285aa0466ce1b4484b7c35858da65e7326839b (diff)
downloadbinutils-85ef4a5ed82fb5f71c78505acfac2104767f908d.zip
binutils-85ef4a5ed82fb5f71c78505acfac2104767f908d.tar.gz
binutils-85ef4a5ed82fb5f71c78505acfac2104767f908d.tar.bz2
gas: hide emulation struct format_ops instances when not needed
Most targets don't even support emulations, so this data (and certain functions) are entirely dead code for them.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/obj-aout.c10
-rw-r--r--gas/config/obj-aout.h5
-rw-r--r--gas/config/obj-coff.c10
-rw-r--r--gas/config/obj-coff.h7
-rw-r--r--gas/config/obj-ecoff.c52
-rw-r--r--gas/config/obj-elf.c158
-rw-r--r--gas/config/obj-elf.h3
7 files changed, 131 insertions, 114 deletions
diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c
index 8916443..5237400 100644
--- a/gas/config/obj-aout.c
+++ b/gas/config/obj-aout.c
@@ -221,14 +221,16 @@ obj_aout_type (int ignore ATTRIBUTE_UNUSED)
s_ignore (0);
}
-/* Support for an AOUT emulation. */
+static const pseudo_typeS aout_pseudo_table[];
-static void
+void
aout_pop_insert (void)
{
pop_insert (aout_pseudo_table);
}
+#ifdef USE_EMULATIONS /* Support for an AOUT emulation. */
+
static int
obj_aout_s_get_other (symbolS *sym)
{
@@ -327,7 +329,9 @@ const struct format_ops aout_format_ops =
0 /* adjust_symtab. */
};
-const pseudo_typeS aout_pseudo_table[] =
+#endif /* USE_EMULATIONS */
+
+static const pseudo_typeS aout_pseudo_table[] =
{
{"line", obj_aout_line, 0}, /* Source code line number. */
{"ln", obj_aout_line, 0}, /* COFF line number that we use anyway. */
diff --git a/gas/config/obj-aout.h b/gas/config/obj-aout.h
index 9f5e7dd..dd25d14 100644
--- a/gas/config/obj-aout.h
+++ b/gas/config/obj-aout.h
@@ -27,10 +27,9 @@
#define OUTPUT_FLAVOR bfd_target_aout_flavour
-extern const pseudo_typeS aout_pseudo_table[];
-
+extern void aout_pop_insert (void);
#ifndef obj_pop_insert
-#define obj_pop_insert() pop_insert (aout_pseudo_table)
+#define obj_pop_insert() aout_pop_insert ()
#endif
/* Symbol table entry data type. */
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index 4f5973a..845fcc8 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -1856,7 +1856,7 @@ symbol_dump (void)
#endif /* DEBUG */
-const pseudo_typeS coff_pseudo_table[] =
+static const pseudo_typeS coff_pseudo_table[] =
{
{"ABORT", s_abort, 0},
/* We accept the .bss directive for backward compatibility with
@@ -1897,14 +1897,14 @@ const pseudo_typeS coff_pseudo_table[] =
};
-/* Support for a COFF emulation. */
-
-static void
+void
coff_pop_insert (void)
{
pop_insert (coff_pseudo_table);
}
+#ifdef USE_EMULATIONS /* Support for a COFF emulation. */
+
static int
coff_separate_stab_sections (void)
{
@@ -1947,3 +1947,5 @@ const struct format_ops coff_format_ops =
coff_obj_symbol_clone_hook,
coff_adjust_symtab
};
+
+#endif /* USE_EMULATIONS */
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h
index 277d025..23f54ff 100644
--- a/gas/config/obj-coff.h
+++ b/gas/config/obj-coff.h
@@ -270,12 +270,9 @@ extern symbolS *coff_last_function;
#endif
#endif
-/* Sanity check. */
-
-extern const pseudo_typeS coff_pseudo_table[];
-
+extern void coff_pop_insert (void);
#ifndef obj_pop_insert
-#define obj_pop_insert() pop_insert (coff_pseudo_table)
+#define obj_pop_insert() coff_pop_insert ()
#endif
/* In COFF, if a symbol is defined using .def/.val SYM/.endef, it's OK
diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c
index 7ef9bb4..c79d57d 100644
--- a/gas/config/obj-ecoff.c
+++ b/gas/config/obj-ecoff.c
@@ -195,30 +195,6 @@ obj_ecoff_set_ext (symbolS *sym, EXTR *ext)
(*debug_swap->swap_ext_out) (stdoutput, ext, esym->native);
}
-static int
-ecoff_sec_sym_ok_for_reloc (asection *sec ATTRIBUTE_UNUSED)
-{
- return 1;
-}
-
-static void
-obj_ecoff_frob_symbol (symbolS *sym, int *puntp ATTRIBUTE_UNUSED)
-{
- ecoff_frob_symbol (sym);
-}
-
-static void
-ecoff_pop_insert (void)
-{
- pop_insert (obj_pseudo_table);
-}
-
-static int
-ecoff_separate_stab_sections (void)
-{
- return 0;
-}
-
/* These are the pseudo-ops we support in this file. Only those
relating to debugging information are supported here.
@@ -282,6 +258,32 @@ const pseudo_typeS obj_pseudo_table[] =
{ NULL, s_ignore, 0 }
};
+#ifdef USE_EMULATIONS
+
+static int
+ecoff_sec_sym_ok_for_reloc (asection *sec ATTRIBUTE_UNUSED)
+{
+ return 1;
+}
+
+static void
+obj_ecoff_frob_symbol (symbolS *sym, int *puntp ATTRIBUTE_UNUSED)
+{
+ ecoff_frob_symbol (sym);
+}
+
+static void
+ecoff_pop_insert (void)
+{
+ pop_insert (obj_pseudo_table);
+}
+
+static int
+ecoff_separate_stab_sections (void)
+{
+ return 0;
+}
+
const struct format_ops ecoff_format_ops =
{
bfd_target_ecoff_flavour,
@@ -321,3 +323,5 @@ const struct format_ops ecoff_format_ops =
ecoff_symbol_clone_hook,
0 /* adjust_symtab. */
};
+
+#endif /* USE_EMULATIONS */
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 1bed3ff..b9aaca9 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -199,48 +199,6 @@ elf_pop_insert (void)
pop_insert (ecoff_debug_pseudo_table);
}
-static bfd_vma
-elf_s_get_size (symbolS *sym)
-{
- return S_GET_SIZE (sym);
-}
-
-static void
-elf_s_set_size (symbolS *sym, bfd_vma sz)
-{
- S_SET_SIZE (sym, sz);
-}
-
-static bfd_vma
-elf_s_get_align (symbolS *sym)
-{
- return S_GET_ALIGN (sym);
-}
-
-static void
-elf_s_set_align (symbolS *sym, bfd_vma align)
-{
- S_SET_ALIGN (sym, align);
-}
-
-int
-elf_s_get_other (symbolS *sym)
-{
- return elf_symbol (symbol_get_bfdsym (sym))->internal_elf_sym.st_other;
-}
-
-static void
-elf_s_set_other (symbolS *sym, int other)
-{
- S_SET_OTHER (sym, other);
-}
-
-static int
-elf_sec_sym_ok_for_reloc (asection *sec)
-{
- return obj_sec_sym_ok_for_reloc (sec);
-}
-
void
elf_file_symbol (const char *s)
{
@@ -3190,38 +3148,6 @@ elf_frob_file_after_relocs (void)
#endif /* NEED_ECOFF_DEBUG */
}
-static void
-elf_process_stab (int what ATTRIBUTE_UNUSED,
- const char *string ATTRIBUTE_UNUSED,
- int type ATTRIBUTE_UNUSED,
- int other ATTRIBUTE_UNUSED,
- int desc ATTRIBUTE_UNUSED)
-{
-#ifdef NEED_ECOFF_DEBUG
- if (ECOFF_DEBUGGING)
- ecoff_stab (what, string, type, other, desc);
-#endif
-}
-
-static int
-elf_separate_stab_sections (void)
-{
-#ifdef NEED_ECOFF_DEBUG
- return (!ECOFF_DEBUGGING);
-#else
- return 1;
-#endif
-}
-
-static void
-elf_init_stab_section (segT stab, segT stabstr)
-{
-#ifdef NEED_ECOFF_DEBUG
- if (!ECOFF_DEBUGGING)
-#endif
- obj_elf_init_stab_section (stab, stabstr);
-}
-
/* This is called when the assembler starts. */
void
@@ -3265,6 +3191,84 @@ elf_end (void)
}
}
+#ifdef USE_EMULATIONS
+
+static bfd_vma
+elf_s_get_size (symbolS *sym)
+{
+ return S_GET_SIZE (sym);
+}
+
+static void
+elf_s_set_size (symbolS *sym, bfd_vma sz)
+{
+ S_SET_SIZE (sym, sz);
+}
+
+static bfd_vma
+elf_s_get_align (symbolS *sym)
+{
+ return S_GET_ALIGN (sym);
+}
+
+static void
+elf_s_set_align (symbolS *sym, bfd_vma align)
+{
+ S_SET_ALIGN (sym, align);
+}
+
+int
+elf_s_get_other (symbolS *sym)
+{
+ return elf_symbol (symbol_get_bfdsym (sym))->internal_elf_sym.st_other;
+}
+
+static void
+elf_s_set_other (symbolS *sym, int other)
+{
+ S_SET_OTHER (sym, other);
+}
+
+static int
+elf_sec_sym_ok_for_reloc (asection *sec)
+{
+ return obj_sec_sym_ok_for_reloc (sec);
+}
+
+#ifdef NEED_ECOFF_DEBUG
+static void
+elf_process_stab (int what ATTRIBUTE_UNUSED,
+ const char *string ATTRIBUTE_UNUSED,
+ int type ATTRIBUTE_UNUSED,
+ int other ATTRIBUTE_UNUSED,
+ int desc ATTRIBUTE_UNUSED)
+{
+ if (ECOFF_DEBUGGING)
+ ecoff_stab (what, string, type, other, desc);
+}
+#else
+# define elf_process_stab NULL
+#endif
+
+static int
+elf_separate_stab_sections (void)
+{
+#ifdef NEED_ECOFF_DEBUG
+ return (!ECOFF_DEBUGGING);
+#else
+ return 1;
+#endif
+}
+
+#ifdef NEED_ECOFF_DEBUG
+static void
+elf_init_stab_section (segT stab, segT stabstr)
+{
+ if (!ECOFF_DEBUGGING)
+ obj_elf_init_stab_section (stab, stabstr);
+}
+#endif
+
const struct format_ops elf_format_ops =
{
bfd_target_elf_flavour,
@@ -3290,7 +3294,11 @@ const struct format_ops elf_format_ops =
elf_copy_symbol_attributes,
elf_process_stab,
elf_separate_stab_sections,
+#ifdef NEED_ECOFF_DEBUG
elf_init_stab_section,
+#else
+ obj_elf_init_stab_section,
+#endif
elf_sec_sym_ok_for_reloc,
elf_pop_insert,
#ifdef NEED_ECOFF_DEBUG
@@ -3303,3 +3311,5 @@ const struct format_ops elf_format_ops =
elf_obj_symbol_clone_hook,
elf_adjust_symtab
};
+
+#endif /* USE_EMULATIONS */
diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h
index 7b5d2fe..179711e 100644
--- a/gas/config/obj-elf.h
+++ b/gas/config/obj-elf.h
@@ -150,7 +150,8 @@ extern void elf_end (void);
int elf_s_get_other (symbolS *);
#ifndef S_GET_OTHER
-#define S_GET_OTHER(S) (elf_s_get_other (S))
+#define S_GET_OTHER(S) \
+ (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other)
#endif
#ifndef S_SET_OTHER
#define S_SET_OTHER(S,V) \