From c410035d37d8237c641155c4e51e7ccf53decb29 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 16 Dec 2020 00:42:21 +1030 Subject: constify elfNN_bed elfNN_bed was made writable as an expedient means of communicating ld -z max-page-size and ld -z common-page-size values to BFD linker code, and even for objcopy to communicate segment alignment between copy_private_bfd_data, rewrite_elf_program_header and assign_file_positions_for_load_sections. Some time later elfNN_bed elf_osabi was written by gas. It turns out none of these modifications to elfNN_bed was necessary, so make it const again. include/ * bfdlink.h (struct bfd_link_info): Add maxpagesize and commonpagesize. bfd/ * elfxx-target.h (elfNN_bed): Constify. * bfd.c (bfd_elf_set_pagesize): Delete. (bfd_emul_set_maxpagesize, bfd_emul_set_commonpagesize): Delete. * elf.c (get_program_header_size): Get commonpagesize from link info. (_bfd_elf_map_sections_to_segments): Get maxpagesize from link info. (assign_file_positions_for_load_sections): Likewise. (assign_file_positions_for_non_load_sections): Likewise. (rewrite_elf_program_header): Add maxpagesize param. Set map_p_align. (copy_private_bfd_data): Don't call bfd_elf_set_maxpagesize. Instead pass maxpagesize to rewrite_elf_program_header. * elf32-nds32.c (relax_range_measurement): Add link_info param. Get maxpagesize from link_info. Adjust caller. * bfd-in2.h: Regenerate. gas/ * config/obj-elf.c (obj_elf_section): Don't set elf_osabi here. (obj_elf_type): Likewise. ld/ * ld.h (ld_config_type): Delete maxpagesize and commonpagesize. * emultempl/elf.em: Use link_info rather than config for maxpagesize and commonpagesize. * emultempl/ppc32elf.em: Likewise. * ldexp.c (fold_binary, fold_name): Likewise. * ldemul.c (after_parse_default): Likewise. (set_output_arch_default): Don't call bfd_emul_set_maxpagesize or bfd_emul_set_commonpagesize. --- ld/ChangeLog | 11 +++++++++++ ld/emultempl/elf.em | 9 +++++---- ld/emultempl/ppc32elf.em | 2 +- ld/ld.h | 6 ------ ld/ldemul.c | 13 +++++-------- ld/ldexp.c | 8 ++++---- 6 files changed, 26 insertions(+), 23 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 9a0ff59..46acbd9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2020-12-16 Alan Modra + + * ld.h (ld_config_type): Delete maxpagesize and commonpagesize. + * emultempl/elf.em: Use link_info rather than config + for maxpagesize and commonpagesize. + * emultempl/ppc32elf.em: Likewise. + * ldexp.c (fold_binary, fold_name): Likewise. + * ldemul.c (after_parse_default): Likewise. + (set_output_arch_default): Don't call bfd_emul_set_maxpagesize + or bfd_emul_set_commonpagesize. + 2020-12-15 Vivek Das Mohapatra * emultempl/elf.em (gld${EMULATION_NAME}_handle_option): diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em index aa40c78..b915ad5 100644 --- a/ld/emultempl/elf.em +++ b/ld/emultempl/elf.em @@ -716,17 +716,18 @@ fragment <used && config.magic_demand_paged - && config.maxpagesize != 0 - && (seg->value % config.maxpagesize) != 0) + && link_info.maxpagesize != 0 + && (seg->value % link_info.maxpagesize) != 0) einfo (_("%P: warning: address of `%s' " "isn't multiple of maximum page size\n"), segment_name); @@ -898,9 +898,9 @@ fold_name (etree_type *tree) case CONSTANT: if (strcmp (tree->name.name, "MAXPAGESIZE") == 0) - new_number (config.maxpagesize); + new_number (link_info.maxpagesize); else if (strcmp (tree->name.name, "COMMONPAGESIZE") == 0) - new_number (config.commonpagesize); + new_number (link_info.commonpagesize); else einfo (_("%F%P:%pS: unknown constant `%s' referenced in expression\n"), tree, tree->name.name); -- cgit v1.1