diff options
author | Alan Modra <amodra@gmail.com> | 2020-12-16 00:42:21 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-12-16 15:17:53 +1030 |
commit | c410035d37d8237c641155c4e51e7ccf53decb29 (patch) | |
tree | f61182fd4ba33baefa14ea1cbe197dfb05d9204b /bfd/bfd.c | |
parent | 3f75e1d67fe871db85d46618b95d0dc92291577d (diff) | |
download | gdb-c410035d37d8237c641155c4e51e7ccf53decb29.zip gdb-c410035d37d8237c641155c4e51e7ccf53decb29.tar.gz gdb-c410035d37d8237c641155c4e51e7ccf53decb29.tar.bz2 |
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.
Diffstat (limited to 'bfd/bfd.c')
-rw-r--r-- | bfd/bfd.c | 68 |
1 files changed, 0 insertions, 68 deletions
@@ -2335,49 +2335,6 @@ bfd_emul_get_maxpagesize (const char *emul) return 0; } -static void -bfd_elf_set_pagesize (const bfd_target *target, bfd_vma size, - int offset, const bfd_target *orig_target) -{ - if (target->flavour == bfd_target_elf_flavour) - { - const struct elf_backend_data *bed; - - bed = xvec_get_elf_backend_data (target); - *((bfd_vma *) ((char *) bed + offset)) = size; - } - - if (target->alternative_target - && target->alternative_target != orig_target) - bfd_elf_set_pagesize (target->alternative_target, size, offset, - orig_target); -} - -/* -FUNCTION - bfd_emul_set_maxpagesize - -SYNOPSIS - void bfd_emul_set_maxpagesize (const char *, bfd_vma); - -DESCRIPTION - For ELF, set the maximum page size for the emulation. It is - a no-op for other formats. - -*/ - -void -bfd_emul_set_maxpagesize (const char *emul, bfd_vma size) -{ - const bfd_target *target; - - target = bfd_find_target (emul, NULL); - if (target) - bfd_elf_set_pagesize (target, size, - offsetof (struct elf_backend_data, - maxpagesize), target); -} - /* FUNCTION bfd_emul_get_commonpagesize @@ -2415,31 +2372,6 @@ bfd_emul_get_commonpagesize (const char *emul, bfd_boolean relro) /* FUNCTION - bfd_emul_set_commonpagesize - -SYNOPSIS - void bfd_emul_set_commonpagesize (const char *, bfd_vma); - -DESCRIPTION - For ELF, set the common page size for the emulation. It is - a no-op for other formats. - -*/ - -void -bfd_emul_set_commonpagesize (const char *emul, bfd_vma size) -{ - const bfd_target *target; - - target = bfd_find_target (emul, NULL); - if (target) - bfd_elf_set_pagesize (target, size, - offsetof (struct elf_backend_data, - commonpagesize), target); -} - -/* -FUNCTION bfd_demangle SYNOPSIS |