aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-sh.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-01-06 18:59:20 +1030
committerAlan Modra <amodra@gmail.com>2023-01-06 21:06:15 +1030
commit22a95e1a37aff28238e9d40bbe4441aa554a14c6 (patch)
tree1f23719284f052d698cc11a3ed971d0d2ae8ec29 /bfd/coff-sh.c
parentbb391cb24d8f92ecad10bb6a60abdf0b880de0dd (diff)
downloadbinutils-22a95e1a37aff28238e9d40bbe4441aa554a14c6.zip
binutils-22a95e1a37aff28238e9d40bbe4441aa554a14c6.tar.gz
binutils-22a95e1a37aff28238e9d40bbe4441aa554a14c6.tar.bz2
Make coff backend data read-only
The bfd_coff_backend_data struct should be read-only, the only thing preventing this is that objcopy writes to one of the fields, _bfd_coff_long_section_names. This patch creates a copy of the field in bfd coff_obj_tdata, which makes more sense anyway. When enabling long section names the intent is to do so for a particular bfd, not for all bfds that might happen to be using the target xvec. bfd/ * coffcode.h: Update coff long section name comment. (bfd_coff_set_long_section_names_allowed): Use macro accessor to set flag. (bfd_coff_set_long_section_names_disallowed): Tidy. (coff_backend_info): Return a const pointer. (bfd_coff_std_swap_table, ticoff0_swap_table, ticoff1_swap_table), (bigobj_swap_table): Make const. (bfd_coff_long_section_names): Use tdata copy. (coff_mkobject): Set long_section_names from coff_backend_info. * coff-go32.c (_bfd_go32_mkobject): Likewise. * peicode.h (pe_mkobject): Likewise. * coff-sh.c (bfd_coff_small_swap_table): Make const. * libcoff-in.h (struct coff_tdata): Add long_section_names, reorder fields. * libcoff.h: Regenerate. binutils/ * objcopy.c (set_long_section_mode): Move earlier in file. (copy_object): Call set_long_section_mode here, after setting output format. (copy_file): Don't call set_long_section_mode.
Diffstat (limited to 'bfd/coff-sh.c')
-rw-r--r--bfd/coff-sh.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index f043dc2..cc6faac 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -3079,7 +3079,7 @@ coff_small_new_section_hook (bfd *abfd, asection *section)
/* This is copied from bfd_coff_std_swap_table so that we can change
the default section alignment power. */
-static bfd_coff_backend_data bfd_coff_small_swap_table =
+static const bfd_coff_backend_data bfd_coff_small_swap_table =
{
coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in,
coff_swap_aux_out, coff_swap_sym_out,