binutils-gdb/bfd/ChangeLog

3012 lines
109 KiB
Plaintext
Raw Normal View History

2019-12-11 Joel Brobecker <brobecker@adacore.com>
* development.sh (development): Set to false.
2019-12-11 Alan Modra <amodra@gmail.com>
* elf32-rx.c (elf32_rx_relax_section): Avoid signed overflow.
* libaout.h (N_SET_INFO, N_SET_FLAGS): Likewise.
* netbsd.h (write_object_contents): Likewise.
* elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Likewise.
* libhppa.h (HPPA_R_CONSTANT): Don't signed extend with shifts.
(stm32l4xx_create_replacing_stub_vldm): Don't truncate high bits
with shifts.
* elf32-nds32.h (R_NDS32_RELAX_ENTRY_DISABLE_RELAX_FLAG): Define
using 1u shifted left. Ditto for other macros.
* mmo.c (LOP): Make unsigned.
2019-12-11 Alan Modra <amodra@gmail.com>
* libbfd.c (bfd_get_8): Return a bfd_vma.
(bfd_get_signed_8): Return a bfd_signed_vma.
* bfd-in2.h: Regenerate.
2019-12-11 Alan Modra <amodra@gmail.com>
* xtensa-modules.c (Field_* functions): Don't mask using shifts.
(Operand_soffsetx4_decode, Operand_simm4_decode),
(Operand_simm8_decode, Operand_simm8x256_decode),
(Operand_simm12b_decode, Operand_label8_decode),
(Operand_label12_decode, Operand_soffset_decode),
(Operand_xt_wbr15_label_decode, Operand_xt_wbr18_label_decode): Don't
sign extend using shifts.
(Operand_immrx4_decode, Operand_uimm16x4_decode): Avoid UB in
constant.
2019-12-11 Alan Modra <amodra@gmail.com>
* cpu-ia64-opc.c (ext_imms_scaled): Avoid undefined left shift
of negative values by using unsigned vars.
2019-12-07 Alan Modra <amodra@gmail.com>
PR 25236
* elflink.c (_bfd_elf_link_assign_sym_version): Assign versions
for ELF_COMMON_DEF_P symbols.
(elf_link_output_extsym, _bfd_elf_add_default_symbol): Adjust to
suit.
2019-12-05 Sandra Loosemore <sandra@codesourcery.com>
Only give FDE encoding warnings if --eh-frame-hdr was specified.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Make
FDE encoding warning conditional.
2019-12-05 Nick Clifton <nickc@redhat.com>
PR 25029
* peXXigen.c (_bfd_XXi_swap_aouthdr_out): Ignore empty sections
when computing the sizes stored in the headers.
2019-12-03 Alan Modra <amodra@gmail.com>
PR 25230
* dwarf2.c (struct dwarf2_debug_file): Add line_table and
abbrev_offsets.
(struct abbrev_offset_entry): New.
(hash_abbrev, eq_abbrev, del_abbrev): New functions.
(read_abbrevs): Check whether we have already read abbrevs at
given offset, and add new offset/abbrev to hash table.
(decode_line_info): Keep line table at offset zero in file struct.
Return this for a cu reusing the same dir/file list.
(find_abstract_instance): Find cu for DW_FORM_GNU_ref_alt.
(_bfd_dwarf2_slurp_debug_info): Create offset/abbrev hash tables.
(_bfd_dwarf2_cleanup_debug_info): Adjust deletion of lines and
abbrevs.
2019-12-03 Alan Modra <amodra@gmail.com>
PR 25230
* dwarf2.c (struct dwarf2_debug_file): New struct.
(struct dwarf2_debug): Delete fields now in dwarf2_debug_file.
Add f, alt fields.
(struct comp_unit): Add file field.
(read_indirect_string, read_indirect_line_string): Adjust to suit.
(read_alt_indirect_string, read_alt_indirect_ref): Likewise.
(read_debug_ranges, find_abstract_instance, read_rangelist): Likewise.
(_bfd_dwarf2_stash_syms, place_sections): Likewise.
(stash_maybe_update_info_hash_tablse): Likewise.
(stash_verify_info_hash_table): Likewise.
(_bfd_dwarf2_slurp_debug_info): Likewise.
(_bfd_dwarf2_find_symbol_bias): Likewise.
(_bfd_dwarf2_find_nearest_line): Likewise.
(_bfd_dwarf2_cleanup_debug_info): Likewise.
(read_abbrevs): Add file param and adjust. Update calls.
(stash_comp_unit): Likewise.
(decode_line_info): Delete stash param and adjust. Update calls.
(comp_unit_find_nearest_line): Likewise.
(comp_unit_maybe_decode_line_info): Likewise.
(comp_unit_find_line): Likewise.
(parse_comp_unit): Add file and info_ptr param and adjust. Update
calls.
2019-12-03 Alan Modra <amodra@gmail.com>
* dwarf2.c (read_indirect_string): Don't duplicate offset check
done in read_section.
(read_indirect_line_string): Likewise.
(read_alt_indirect_string): Likewise.
(read_alt_indirect_ref): Likewise.
(read_abbrevs): Likewise. Free memory on all failure paths.
Use correct unsigned type for pointer difference comparison.
2019-12-03 Alan Modra <amodra@gmail.com>
* dwarf2.c (struct dwarf2_debug): Update comments. Remove sec
and sec_info_ptr.
(_bfd_dwarf2_slurp_debug_info): Don't set sec or sec_info_ptr.
(stash_comp_unit): Likewise.
(read_alt_indirect_ref): Return NULL not FALSE.
2019-12-03 Alan Modra <amodra@gmail.com>
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Correct function comment.
2019-11-27 Alan Modra <amodra@gmail.com>
PR 23652
* dwarf2.c (_bfd_dwarf2_stash_syms): Break out of loop on finding
matching section.
(_bfd_dwarf2_find_nearest_line): Return an int, with value 2 when
returning info from the symbol table. Do the _bfd_elf_find_function
search also when !found. Call _bfd_dwarf2_stash_syms regardless of
symbols.
* elf64-alpha.c (elf64_alpha_find_nearest_line): Accept dwarf2
result of 1 only.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
* libbfd.h: Regenerate.
PR23652, Use symbols from debug bfd for _bfd_elf_find_function Sometimes DWARF info for a function is incomplete, and the function can be retrieved by examining symbols. However, when separate debug files are used it may be that the original file is completely stripped of symbols. This patch teaches BFD to look at symbols from the debug file in that case. The patch also removes arm_elf_find_function, instead implementing elf_backend_maybe_function_sym. arm_elf_find_function was written before the generic _bfd_elf_find_function called maybe_function_sym. aarch64 copied arm, so that file gets the same treatment. There is some chance this will speed up arm and aarch64 lookup of function/line. PR 23652 * dwarf2.c (_bfd_dwarf2_stash_syms): New function. (_bfd_dwarf2_find_nearest_line): Use it here, passing syms to _bfd_elf_find_function. Call _bfd_elf_find_function in cases where _bfd_elf_find_nearest_line would do so. * elf.c (_bfd_elf_find_nearest_line): Omit _bfd_elf_find_function for dwarf2. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly. Tidy. * elf32-arm.c (elf32_arm_maybe_function_sym): New function. (elf_backend_maybe_function_sym): Define. (arm_elf_find_function, elf32_arm_find_nearest_line): Delete. (bfd_elf32_find_nearest_line): Don't define. * elfnn-aarch64.c (elfNN_aarch64_maybe_function_sym): New function. (elf_backend_maybe_function_sym): Define. (aarch64_elf_find_function, elfNN_aarch64_find_nearest_line): Delete. (bfd_elfNN_find_nearest_line): Don't define.
2019-11-26 13:02:51 +01:00
2019-11-27 Alan Modra <amodra@gmail.com>
PR 23652
* dwarf2.c (_bfd_dwarf2_stash_syms): New function.
(_bfd_dwarf2_find_nearest_line): Use it here, passing syms to
_bfd_elf_find_function. Call _bfd_elf_find_function in cases
where _bfd_elf_find_nearest_line would do so.
* elf.c (_bfd_elf_find_nearest_line): Omit _bfd_elf_find_function
for dwarf2.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly. Tidy.
* elf32-arm.c (elf32_arm_maybe_function_sym): New function.
(elf_backend_maybe_function_sym): Define.
(arm_elf_find_function, elf32_arm_find_nearest_line): Delete.
(bfd_elf32_find_nearest_line): Don't define.
* elfnn-aarch64.c (elfNN_aarch64_maybe_function_sym): New function.
(elf_backend_maybe_function_sym): Define.
(aarch64_elf_find_function, elfNN_aarch64_find_nearest_line): Delete.
(bfd_elfNN_find_nearest_line): Don't define.
2019-11-27 Alan Modra <amodra@gmail.com>
* elf32-sh.c (sh_reloc): Use a bfd_vma insn.
(sh_reloc <R_SH_IND12W>): Divide calculated relocation value
by two before applying to insn. Correct overflow test.
* coff-sh.c (sh_reloc): Likewise.
2019-11-26 Nick Clifton <nickc@redhat.com>
* elf32-sh.c (sh_elf_reloc): Use a signed_vma when checking for a
negative relocated value.
* coff-sh.c (sh_reloc): Likewise.
Pass section when available to bfd_octets_per_byte and other tidies. I think it's better to default to passing the section to bfd_octets_per_byte, even in cases where we know it won't make a difference. A number of the coff reloc functions used bfd_octets_per_byte wrongly, not factoring it into the offset into the data buffer. As it happens, the targets using those files always had bfd_octets_per_byte equal to one, so there wasn't any detectable wrong behaviour. However, it is wrong in the source and might cause trouble for anyone creating a new target. Besides fixing that, the patch also defines OCTETS_PER_BYTE as one in target files where that is appropriate. bfd/ * archures.c (bfd_octets_per_byte): Tail call bfd_arch_mach_octets_per_byte. * coff-arm.c (OCTETS_PER_BYTE): Define. (coff_arm_reloc): Introduce new "octets" temp. Use OCTETS_PER_BYTE with section. Correct "addr". Remove ATTRIBUTE_UNUSED. * coff-i386.c (coff_i386_reloc): Similarly. * coff-mips.c (mips_reflo_reloc): Similarly. * coff-x86_64.c (coff_amd64_reloc): Similarly. * elf32-msp430.c (OCTETS_PER_BYTE): Define. (rl78_sym_diff_handler): Use OCTETS_PER_BYTE, with section. * elf32-nds32.c (nds32_elf_get_relocated_section_contents): Similarly. * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Similarly. * elf32-pru.c (pru_elf32_do_ldi32_relocate): Similarly. * elf32-s12z.c (opru18_reloc): Similarly. * elf32-sh.c (sh_elf_reloc): Similarly. * elf32-spu.c (spu_elf_rel9): Similarly. * elf32-xtensa.c (bfd_elf_xtensa_reloc): Similarly. * elf64-ppc.c (ppc64_elf_ha_reloc, ppc64_elf_brtaken_reloc), (ppc64_elf_toc64_reloc): Similarly. * bfd.c (bfd_get_section_limit): Pass section to bfd_octets_per_byte. * cofflink.c (_bfd_coff_link_input_bfd), (_bfd_coff_reloc_link_order): Likewise. * elf.c (_bfd_elf_section_offset): Likewise. * elflink.c (resolve_section, bfd_elf_perform_complex_relocation), (elf_link_input_bfd, elf_reloc_link_order, elf_fixup_link_order), (bfd_elf_final_link): Likewise. * elf.c (_bfd_elf_make_section_from_shdr): Don't strncmp twice to set SEC_ELF_OCTETS. * reloc.c (bfd_perform_relocation): Tidy SEC_ELF_OCTETS special case. (bfd_install_relocation): Likewise. (_bfd_final_link_relocate): Don't recalculate octets. * syms.c (_bfd_stab_section_find_nearest_line): Introduc new "octets" temp. * bfd-in2.h: Regenerate. ld/ * ldexp.c (fold_name): Pass section to bfd_octets_per_byte. * ldlang.c (init_opb): Don't call bfd_arch_mach_octets_per_byte unnecessarily.
2019-11-25 00:37:40 +01:00
2019-11-25 Alan Modra <amodra@gmail.com>
* archures.c (bfd_octets_per_byte): Tail call
bfd_arch_mach_octets_per_byte.
* coff-arm.c (OCTETS_PER_BYTE): Define.
(coff_arm_reloc): Introduce new "octets" temp. Use OCTETS_PER_BYTE
with section. Correct "addr". Remove ATTRIBUTE_UNUSED.
* coff-i386.c (coff_i386_reloc): Similarly.
* coff-mips.c (mips_reflo_reloc): Similarly.
* coff-x86_64.c (coff_amd64_reloc): Similarly.
* elf32-msp430.c (OCTETS_PER_BYTE): Define.
(rl78_sym_diff_handler): Use OCTETS_PER_BYTE, with section.
* elf32-nds32.c (nds32_elf_get_relocated_section_contents): Similarly.
* elf32-ppc.c (ppc_elf_addr16_ha_reloc): Similarly.
* elf32-pru.c (pru_elf32_do_ldi32_relocate): Similarly.
* elf32-s12z.c (opru18_reloc): Similarly.
* elf32-sh.c (sh_elf_reloc): Similarly.
* elf32-spu.c (spu_elf_rel9): Similarly.
* elf32-xtensa.c (bfd_elf_xtensa_reloc): Similarly.
* elf64-ppc.c (ppc64_elf_ha_reloc, ppc64_elf_brtaken_reloc),
(ppc64_elf_toc64_reloc): Similarly.
* bfd.c (bfd_get_section_limit): Pass section to bfd_octets_per_byte.
* cofflink.c (_bfd_coff_link_input_bfd),
(_bfd_coff_reloc_link_order): Likewise.
* elf.c (_bfd_elf_section_offset): Likewise.
* elflink.c (resolve_section, bfd_elf_perform_complex_relocation),
(elf_link_input_bfd, elf_reloc_link_order, elf_fixup_link_order),
(bfd_elf_final_link): Likewise.
* elf.c (_bfd_elf_make_section_from_shdr): Don't strncmp twice
to set SEC_ELF_OCTETS.
* reloc.c (bfd_perform_relocation): Tidy SEC_ELF_OCTETS special case.
(bfd_install_relocation): Likewise.
(_bfd_final_link_relocate): Don't recalculate octets.
* syms.c (_bfd_stab_section_find_nearest_line): Introduc new
"octets" temp.
* bfd-in2.h: Regenerate.
Introduce new section flag: SEC_ELF_OCTETS All symbols, sizes and relocations in this section are octets instead of bytes. Required for DWARF debug sections as DWARF information is organized in octets, not bytes. bfd/ * section.c (struct bfd_section): New flag SEC_ELF_OCTETS. * archures.c (bfd_octets_per_byte): New parameter sec. If section is not NULL and SEC_ELF_OCTETS is set, one octet es returned [ELF targets only]. * bfd.c (bfd_get_section_limit): Provide section parameter to bfd_octets_per_byte. * bfd-in2.h: regenerate. * binary.c (binary_set_section_contents): Move call to bfd_octets_per_byte into section loop. Provide section parameter to bfd_octets_per_byte. * coff-arm.c (coff_arm_reloc): Provide section parameter to bfd_octets_per_byte. * coff-i386.c (coff_i386_reloc): likewise. * coff-mips.c (mips_reflo_reloc): likewise. * coff-x86_64.c (coff_amd64_reloc): likewise. * cofflink.c (_bfd_coff_link_input_bfd): likewise. (_bfd_coff_reloc_link_order): likewise. * elf.c (_bfd_elf_section_offset): likewise. (_bfd_elf_make_section_from_shdr): likewise. Set SEC_ELF_OCTETS for sections with names .gnu.build.attributes, .debug*, .zdebug* and .note.gnu*. * elf32-msp430.c (rl78_sym_diff_handler): Provide section parameter to bfd_octets_per_byte. * elf32-nds.c (nds32_elf_get_relocated_section_contents): likewise. * elf32-ppc.c (ppc_elf_addr16_ha_reloc): likewise. * elf32-pru.c (pru_elf32_do_ldi32_relocate): likewise. * elf32-s12z.c (opru18_reloc): likewise. * elf32-sh.c (sh_elf_reloc): likewise. * elf32-spu.c (spu_elf_rel9): likewise. * elf32-xtensa.c (bfd_elf_xtensa_reloc): likewise * elf64-ppc.c (ppc64_elf_brtaken_reloc): likewise. (ppc64_elf_addr16_ha_reloc): likewise. (ppc64_elf_toc64_reloc): likewise. * elflink.c (bfd_elf_final_link): likewise. (bfd_elf_perform_complex_relocation): likewise. (elf_fixup_link_order): likewise. (elf_link_input_bfd): likewise. (elf_link_sort_relocs): likewise. (elf_reloc_link_order): likewise. (resolve_section): likewise. * linker.c (_bfd_generic_reloc_link_order): likewise. (bfd_generic_define_common_symbol): likewise. (default_data_link_order): likewise. (default_indirect_link_order): likewise. * srec.c (srec_set_section_contents): likewise. (srec_write_section): likewise. * syms.c (_bfd_stab_section_find_nearest_line): likewise. * reloc.c (_bfd_final_link_relocate): likewise. (bfd_generic_get_relocated_section_contents): likewise. (bfd_install_relocation): likewise. For section which have SEC_ELF_OCTETS set, multiply output_base and output_offset with bfd_octets_per_byte. (bfd_perform_relocation): likewise. include/ * coff/ti.h (GET_SCNHDR_SIZE, PUT_SCNHDR_SIZE, GET_SCN_SCNLEN), (PUT_SCN_SCNLEN): Adjust bfd_octets_per_byte calls. binutils/ * objdump.c (disassemble_data): Provide section parameter to bfd_octets_per_byte. (dump_section): likewise (dump_section_header): likewise. Show SEC_ELF_OCTETS flag if set. gas/ * as.h: Define SEC_OCTETS as SEC_ELF_OCTETS if OBJ_ELF. * dwarf2dbg.c: (dwarf2_finish): Set section flag SEC_OCTETS for .debug_line, .debug_info, .debug_abbrev, .debug_aranges, .debug_str and .debug_ranges sections. * write.c (maybe_generate_build_notes): Set section flag SEC_OCTETS for .gnu.build.attributes section. * frags.c (frag_now_fix): Don't divide by OCTETS_PER_BYTE if SEC_OCTETS is set. * symbols.c (resolve_symbol_value): Likewise. ld/ * ldexp.c (fold_name): Provide section parameter to bfd_octets_per_byte. * ldlang (init_opb): New argument s. Set opb_shift to 0 if SEC_ELF_OCTETS for the current section is set. (print_input_section): Pass current section to init_opb. (print_data_statement,print_reloc_statement, print_padding_statement): Likewise. (lang_check_section_addresses): Call init_opb for each section. (lang_size_sections_1,lang_size_sections_1, lang_do_assignments_1): Likewise. (lang_process): Pass NULL to init_opb.
2019-11-21 22:17:29 +01:00
2019-11-25 Christian Eggers <ceggers@gmx.de>
* section.c (struct bfd_section): New flag SEC_ELF_OCTETS.
* archures.c (bfd_octets_per_byte): New parameter sec.
If section is not NULL and SEC_ELF_OCTETS is set, one octet es
returned [ELF targets only].
* bfd.c (bfd_get_section_limit): Provide section parameter to
bfd_octets_per_byte.
* bfd-in2.h: regenerate.
* binary.c (binary_set_section_contents): Move call to
bfd_octets_per_byte into section loop. Provide section parameter
to bfd_octets_per_byte.
* coff-arm.c (coff_arm_reloc): Provide section parameter
to bfd_octets_per_byte.
* coff-i386.c (coff_i386_reloc): likewise.
* coff-mips.c (mips_reflo_reloc): likewise.
* coff-x86_64.c (coff_amd64_reloc): likewise.
* cofflink.c (_bfd_coff_link_input_bfd): likewise.
(_bfd_coff_reloc_link_order): likewise.
* elf.c (_bfd_elf_section_offset): likewise.
(_bfd_elf_make_section_from_shdr): likewise.
Set SEC_ELF_OCTETS for sections with names .gnu.build.attributes,
.debug*, .zdebug* and .note.gnu*.
* elf32-msp430.c (rl78_sym_diff_handler): Provide section parameter
to bfd_octets_per_byte.
* elf32-nds.c (nds32_elf_get_relocated_section_contents): likewise.
* elf32-ppc.c (ppc_elf_addr16_ha_reloc): likewise.
* elf32-pru.c (pru_elf32_do_ldi32_relocate): likewise.
* elf32-s12z.c (opru18_reloc): likewise.
* elf32-sh.c (sh_elf_reloc): likewise.
* elf32-spu.c (spu_elf_rel9): likewise.
* elf32-xtensa.c (bfd_elf_xtensa_reloc): likewise
* elf64-ppc.c (ppc64_elf_brtaken_reloc): likewise.
(ppc64_elf_addr16_ha_reloc): likewise.
(ppc64_elf_toc64_reloc): likewise.
* elflink.c (bfd_elf_final_link): likewise.
(bfd_elf_perform_complex_relocation): likewise.
(elf_fixup_link_order): likewise.
(elf_link_input_bfd): likewise.
(elf_link_sort_relocs): likewise.
(elf_reloc_link_order): likewise.
(resolve_section): likewise.
* linker.c (_bfd_generic_reloc_link_order): likewise.
(bfd_generic_define_common_symbol): likewise.
(default_data_link_order): likewise.
(default_indirect_link_order): likewise.
* srec.c (srec_set_section_contents): likewise.
(srec_write_section): likewise.
* syms.c (_bfd_stab_section_find_nearest_line): likewise.
* reloc.c (_bfd_final_link_relocate): likewise.
(bfd_generic_get_relocated_section_contents): likewise.
(bfd_install_relocation): likewise.
For section which have SEC_ELF_OCTETS set, multiply output_base
and output_offset with bfd_octets_per_byte.
(bfd_perform_relocation): likewise.
2019-11-21 Alan Modra <amodra@gmail.com>
* elf32-arm.c (elf32_arm_size_stubs): Exclude dynamic library
BFDs that have not been loaded.
2019-11-19 Alan Modra <amodra@gmail.com>
PR 25197
* coffgen.c (coff_find_nearest_line_with_names): Check that C_FILE
u.syment.n_value does point at another C_FILE sym and not into
some auxent that happens to look like a C_FILE. Properly check
for integer overflow and avoid possible pointer wrap-around.
Simplify pr17512 checks.
2019-11-19 Alan Modra <amodra@gmail.com>
PR 25200
* reloc.c (bfd_default_reloc_type_lookup): Don't BFD_FAIL.
* elf.c (_bfd_elf_validate_reloc): Don't segfault on NULL howto.
elf_backend_init_file_header This patch renames elf_backend_post_process_headers and moves the prep_headers code into the new function. Naming the backend functions elf_backend_init_file_header and elf_backend_modify_headers makes it clear which function is called first. * elf-bfd.h (struct elf_backend_data <elf_backend_init_file_header>): Rename from elf_backend_post_process_headers. (_bfd_elf_post_process_headers): Delete. (_bfd_elf_init_file_header): Declare. * elf.c (_bfd_elf_compute_section_file_positions): Call new function in place of prep_headers and elf_backend_post_process_headers. (_bfd_elf_init_file_header): Renamed from prep_headers with updated args and made global. Delete dead code. (_bfd_elf_post_process_headers): Delete. * elf32-arm.c (elf32_arm_init_file_header): Rename from elf32_arm_post_process_headers and call _bfd_elf_init_file_header. Return status. (elf_backend_init_file_header): Define. (elf_backend_post_process_headers): Don't define. * elf32-i386.c (elf_i386_fbsd_init_file_header): Similarly. * elf32-m68hc1x.c (elf32_m68hc11_init_file_header): Similarly. * elf32-metag.c (elf_metag_init_file_header): Similarly. * elf32-spu.c (spu_elf_init_file_header * elf32-visium.c (visium_elf_init_file_header * elf64-alpha.c (elf64_alpha_fbsd_init_file_header * elf64-hppa.c (elf64_hppa_init_file_header * elf64-ia64-vms.c (elf64_vms_init_file_header * elfnn-aarch64.c (elfNN_aarch64_init_file_header * elfnn-ia64.c (elfNN_hpux_init_file_header * elfxx-mips.c (_bfd_mips_init_file_header * elfxx-mips.h (_bfd_mips_post_process_headers): Delete. (_bfd_mips_init_file_header): Declare. (elf_backend_post_process_headers): Delete. (elf_backend_init_file_header): Define. * elfxx-target.h (elf_backend_post_process_headers): Delete. (elf_backend_init_file_header): Define and use. * elf32-m68hc12.c (elf_backend_init_file_header): Define. (elf_backend_post_process_headers): Don't define. * elf32-m68hc1x.h (elf32_m68hc11_post_process_headers): Delete. (elf32_m68hc11_init_file_header): Declare. * elf32-ppc.c (elf_backend_post_process_headers): Remove unnecessary undef.
2019-11-18 07:39:40 +01:00
2019-11-18 Alan Modra <amodra@gmail.com>
* elf-bfd.h (struct elf_backend_data <elf_backend_init_file_header>):
Rename from elf_backend_post_process_headers.
(_bfd_elf_post_process_headers): Delete.
(_bfd_elf_init_file_header): Declare.
* elf.c (_bfd_elf_compute_section_file_positions): Call new function
in place of prep_headers and elf_backend_post_process_headers.
(_bfd_elf_init_file_header): Renamed from prep_headers with
updated args and made global. Delete dead code.
(_bfd_elf_post_process_headers): Delete.
* elf32-arm.c (elf32_arm_init_file_header): Rename from
elf32_arm_post_process_headers and call _bfd_elf_init_file_header.
Return status.
(elf_backend_init_file_header): Define.
(elf_backend_post_process_headers): Don't define.
* elf32-i386.c (elf_i386_fbsd_init_file_header): Similarly.
* elf32-m68hc1x.c (elf32_m68hc11_init_file_header): Similarly.
* elf32-metag.c (elf_metag_init_file_header): Similarly.
* elf32-spu.c (spu_elf_init_file_header
* elf32-visium.c (visium_elf_init_file_header
* elf64-alpha.c (elf64_alpha_fbsd_init_file_header
* elf64-hppa.c (elf64_hppa_init_file_header
* elf64-ia64-vms.c (elf64_vms_init_file_header
* elfnn-aarch64.c (elfNN_aarch64_init_file_header
* elfnn-ia64.c (elfNN_hpux_init_file_header
* elfxx-mips.c (_bfd_mips_init_file_header
* elfxx-mips.h (_bfd_mips_post_process_headers): Delete.
(_bfd_mips_init_file_header): Declare.
(elf_backend_post_process_headers): Delete.
(elf_backend_init_file_header): Define.
* elfxx-target.h (elf_backend_post_process_headers): Delete.
(elf_backend_init_file_header): Define and use.
* elf32-m68hc12.c (elf_backend_init_file_header): Define.
(elf_backend_post_process_headers): Don't define.
* elf32-m68hc1x.h (elf32_m68hc11_post_process_headers): Delete.
(elf32_m68hc11_init_file_header): Declare.
* elf32-ppc.c (elf_backend_post_process_headers): Remove
unnecessary undef.
2019-11-18 Alan Modra <amodra@gmail.com>
* elf-bfd.h (struct elf_backend_data <elf_backend_modify_headers>):
Rename from elf_backend_modify_program_headers.
(_bfd_elf_modify_headers): Declare.
* elf.c (assign_file_positions_except_relocs): Set
elf_program_header_size. Always call elf_backend_modify_headers.
Extract code modifying file header..
(_bfd_elf_modify_headers): ..to here. New function.
* elf32-arm.c (elf_backend_modify_headers): Renamed from
elf_backend_modify_program_headers.
* elf32-i386.c: Similarly.
* elf64-x86-64.c: Similarly.
* elfxx-target.h: Similarly. Default elf_backend_modify_headers
to _bfd_elf_modify_headers.
* elf-nacl.h (nacl_modify_headers): Rename from
nacl_modify_program_headers.
* elf-nacl.c (nacl_modify_headers): Rename from
nacl_modify_program_headers and call _bfd_elf_modify_headers.
* elf32-rx.c (elf32_rx_modify_headers): Similarly.
* elf32-spu.c (spu_elf_modify_headers): Similarly.
* elfnn-ia64.c (elfNN_ia64_modify_headers): Similarly.
* elf32-sh.c (elf_backend_modify_program_headers): Don't undef.
2019-11-18 Alan Modra <amodra@gmail.com>
PR 25196
* bfd.c (bfd_error_type): Add bfd_error_sorry.
(bfd_errmsgs): Likewise.
* elf.c (rewrite_elf_program_header): Don't abort on confused
lma/alignment. Replace bfd_error_bad_value with bfd_error_sorry.
(_bfd_elf_validate_reloc): Use bfd_error_sorry.
(_bfd_elf_final_write_processing): Likewise.
* bfd-in2.h: Regenerate.
2019-11-12 Jim Wilson <jimw@sifive.com>
PR 25181
* elfnn-riscv.c (_bfd_riscv_relax_call): Always add max_alignment to
foff. If sym_sec->output_section and sec->output_section are the same
and not *ABS* then set max_alignment to that section's alignment.
2019-11-07 Alan Modra <amodra@gmail.com>
* cpu-cr16c.c: Delete.
* elf32-cr16c.c: Delete.
* Makefile.am,
* archures.c,
* config.bfd,
* configure.ac,
* reloc.c,
* targets.c: Remove cr16c support.
* Makefile.in,
* bfd-in2.h,
* configure,
* libbfd.h,
* po/SRC-POTFILES.in: Regenerate.
2019-11-05 Tim Rühsen <tim.ruehsen@gmx.de>
* doc/chew.c (add_to_definition): Use correct type when
calculating size of array reallocation.
(nextword): Always initialise the word return parameter.
(compile): Check return value of nextword().
2019-10-30 Keith Seitz <keiths@redhat.com>
* elf-bfd.h (elf_backend_data) <elf_backend_core_find_build_id>:
New field.
(_bfd_elf32_core_find_build_id, _bfd_elf64_core_find_build_id):
New functions.
(elf_read_notes): Add declaration.
* elf.c (elf_read_notes): Move elf-bfd.h.
(_bfd_elf_core_find_build_id): New function.
(bfd_section_from_phdr): Scan core file PT_LOAD segments for
build-id if none is known.
(elf_parse_notes): For core files, scan for notes.
* elfcore.h (elf_core_file_matches_executable_p): If both
BFDs have identical build-ids, then they match.
(_bfd_elf_core_find_build_id): New function.
* elfxx-target.h (elf_backend_core_find_build_id): Define.
(elfNN_bed): Add elf_backend_core_find_build_id.
2019-10-29 Andrew Eikum <aeikum@codeweavers.com>
* libcoff-in.h (struct pe_tdata): Add dos_message field.
* libcoff.h: Regenerate.
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Copy the
dos_message field rather than initialising it.
(_bfd_XX_bfd_copy_private_bfd_data_common): Copy the dos_message
field.
* peicode.h (pe_mkobject): Initialise the dos_message field.
(pe_mkobject_hook): Copy the dos_message field.
(pe_bfd_object_p): Copy the dos_message field.
2019-10-25 Alan Modra <amodra@gmail.com>
PR 4499
* elf-nacl.c (nacl_modify_segment_map): Set no_sort_lma for all
PT_LOAD segments.
* elf32-spu.c (spu_elf_modify_segment_map): Likewise on overlay
PT_LOAD segments.
* elf.c (elf_sort_segments): New function.
(assign_file_positions_except_relocs): Use shortcuts to elfheader
and elf_tdata. Seek to e_phoff not sizeof_ehdr to write program
headers. Move PT_PHDR check..
(assign_file_positions_for_non_load_sections): ..and code setting
PT_PHDR p_vaddr and p_paddr, and code setting __ehdr_start value..
(assign_file_positions_for_load_sections): ..to here. Sort
PT_LOAD headers. Delete header_pad code. Use actual number of
headers rather than allocated in calculating size for program
headers. Don't assume program headers follow ELF file header.
Simplify pt_load_count code. Only set "off" for PT_LOAD or
PT_NOTE in cores.
(rewrite_elf_program_header): Set p_vaddr_offset for segments
that include file and program headers.
(copy_elf_program_header): Likewise, replacing header_size code.
2019-10-21 Alan Modra <amodra@gmail.com>
PR 452
* archive.c (normalize): Return file unchanged when
BFD_ARCHIVE_FULL_PATH.
(_bfd_construct_extended_name_table): Pass abfd, the output
bfd, to normalize.
(_bfd_archive_bsd44_construct_extended_name_table): Likewise.
* bfd.c (struct bfd): Make flags a full flagword.
(BFD_ARCHIVE_FULL_PATH): Define.
* bfd-in2.h: Regenerate.
2019-10-20 John David Anglin <danglin@gcc.gnu.org>
* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Provide 8-byte
minimum alignment for .plt section.
2019-10-19 John David Anglin <danglin@gcc.gnu.org>
* elf32-hppa.c: Revise import stub sequences.
(LONG_BRANCH_STUB_SIZE): Define.
(LONG_BRANCH_SHARED_STUB_SIZE): Define.
(IMPORT_STUB_SIZE): Define.
(IMPORT_SHARED_STUB_SIZE): Define.
(EXPORT_STUB_SIZE): Define.
(plt_stub): Revise to not use register %r22.
(LDO_R1_R22): Define.
(LDW_R22_R21): Define.
(LDW_R22_R19): Define.
(hppa_build_one_stub): Update stub generation and use new defines.
(hppa_size_one_stub): Likewise.
RISC-V: Report unresolved relocation error via linker's callback function. Two patches from Nelson Chu. It is better to use the linker's callback functions to handle the link time error when relocating. The unresolved relocation error can be regarded as an unsupported relocation. To make user easier to understand different errors, we need to extend the current error message format of the callback function since the format is fixed. bfd/ * elfnn-riscv.c (riscv_elf_relocate_section): Use asprintf to extend the error message if needed, and then store the result into the `msg_buf`. Finally, remember to free the unused `msg_buf`. All error message for the dangerous relocation should be set before we call the callback function. If we miss the error message since linker runs out of memory, we should set the default error message for the error. ld/ * testsuite/ld-riscv-elf/lib-nopic-01a.s: Create the shared library lib-nopic-01a.so, it will be linked with lib-nopic-01b.s. * testsuite/ld-riscv-elf/lib-nopic-01b.s: Add new test for the unresolved relocation. Link the non-pic code into a shared library may cause the error. * testsuite/ld-riscv-elf/lib-nopic-01b.d: Likewise. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run the new test only when the shared library is supported. R_RISCV_CALL, R_RISCV_JAL and R_RISCV_RVC_JUMP are pc-relative relocation. For now, we do not allow the object with these relocation links into a shared library since the referenced symbols may be loaded to the places that too far from the pc. We can improve the error message for these unsupported relocation to notice user that they should recompile their code with `fPIC`. bfd/ * elfnn-riscv.c (riscv_elf_relocate_section): Report the error message that user should recompile their code with `fPIC` when linking non-pic code into shared library. ld/ * testsuite/ld-riscv-elf/lib-nopic-01b.d: Update the error message. Change-Id: Ib3347a0a6fa1c2b20a9647c314d5bec2c322ff04
2019-10-18 00:38:27 +02:00
2019-10-17 Nelson Chu <nelson.chu@sifive.com>
* elfnn-riscv.c (riscv_elf_relocate_section): Report the error message
that user should recompile their code with `fPIC` when linking non-pic
code into shared library.
* elfnn-riscv.c (riscv_elf_relocate_section): Use asprintf to extend
the error message if needed, and then store the result into the
`msg_buf`. Finally, remember to free the unused `msg_buf`. All error
message for the dangerous relocation should be set before we call the
callback function. If we miss the error message since linker runs out
of memory, we should set the default error message for the error.
2019-10-16 Alan Modra <amodra@gmail.com>
PR 13616
* cpu-powerpc.c (bfd_arch_ppc_nop_fill): New function, use it
for all ppc arch info.
* linker.c (default_data_link_order): Pass info->big_endian to
arch_info->fill function.
2019-10-15 Alan Modra <amodra@gmail.com>
* elf32-m68hc1x.c (reloc_warning): Add printf attribute.
(elf32_m68hc11_relocate_section): Don't use a variable for format
strings. Delete some unnecessary xgettext:c-format comments.
2019-10-15 Alan Modra <amodra@gmail.com>
PR 24955
* elf32-arm.c (set_cmse_veneer_addr_from_implib): Use bfd_malloc
rather than xmalloc.
* elf32-m68hc1x.c (reloc_warning): New function.
(elf32_m68hc11_relocate_section): Use it here. Cast bfd_vma values
corresponding to %lx in format strings.
* elf32-nds32.c (nds32_insertion_sort): Use a stack temporary.
2019-10-15 Alan Modra <amodra@gmail.com>
PR 25100
* elf64-ppc.c (sfpr_define): Delete dead code that triggered a warning.
2019-10-15 Alan Modra <amodra@gmail.com>
* bfd.c (bfd_check_compression_header): Check for powers of two
with x == (x & -x).
2019-10-14 Alan Modra <amodra@gmail.com>
* syms.c (struct indexentry): Add idx field.
(cmpindexentry): Final sort on idx.
(_bfd_stab_section_find_nearest_line): Set idx.
2019-10-14 Alan Modra <amodra@gmail.com>
* dwarf2.c (struct lookup_funcinfo): Add idx field.
(compare_lookup_funcinfos): Perform final sort on idx.
(build_lookup_funcinfo_table): Set idx.
(compare_sequences): Perform final sort on num_lines.
(build_line_info_table): Set num_lines and line_info_lookup earlier.
(sort_line_sequences): Set num_lines for sort.
2019-10-14 Alan Modra <amodra@gmail.com>
* elflink.c (elf_sort_symbol): Sort on type and name as well.
(elf_link_add_object_symbols): Style fix.
2019-10-14 Alan Modra <amodra@gmail.com>
* elf.c (_bfd_elf_map_sections_to_segments): Init target_index
for sections about to be sorted.
(assign_file_positions_for_load_sections): Likewise.
(elf_sort_sections): Don't bother optimising both TOEND case.
* elflink.c (bfd_elf_final_link): Reset target_index.
2019-10-14 Alan Modra <amodra@gmail.com>
* elflink.c (elf_get_linked_section_vma): Delete.
(compare_link_order): Use elf_linked_to_section and sort by lma,
size, and id.
(elf_fixup_link_order): Use size_t variables where appropriate.
Make use of elf_linked_to_section. Formatting. Properly align
sections.
qsort issues qsort isn't guaranteed to be a stable sort, that is, elements comparing equal according to the comparison function may be reordered relative to their original ordering. Of course sometimes you may not care, but even in those cases it is good to force some ordering (ie. not have the comparison function return 0) so that linker output is reproducible over different libc qsort implementations. One way to make qsort stable (which the glibc manual incorrectly says is the only way) is to augment the elements being sorted with a monotonic counter of some kind, and use that counter as the final arbiter of ordering in the comparison function. Another way is to set up an array of pointers into the array of elements, first pointer to first element, second pointer to second element and so so, and sort the pointer array rather than the element array. Final arbiter in the comparison function then is the pointer difference. This works well with, for example, the symbol pointers returned by _bfd_elf_canonicalize_symtab which point into a symbol array. This patch fixes a few places where sorting by symbol pointers is appropriate, and adds comments where qsort stability is a non-issue. * elf-strtab.c (strrevcmp): Comment. * merge.c (strrevcmp): Likewise. * elf64-ppc.c (compare_symbols): Correct final pointer comparison. Comment on why comparing pointers ensures a stable sort. * elflink.c (struct elf_symbol): Add void* to union. (elf_sort_elf_symbol): Ensure a stable sort with pointer comparison. (elf_sym_name_compare): Likewise. (bfd_elf_match_symbols_in_sections): Style fix. (elf_link_sort_cmp1): Comment.
2019-10-14 05:05:21 +02:00
2019-10-14 Alan Modra <amodra@gmail.com>
* elf-strtab.c (strrevcmp): Comment.
* merge.c (strrevcmp): Likewise.
* elf64-ppc.c (compare_symbols): Correct final pointer comparison.
Comment on why comparing pointers ensures a stable sort.
* elflink.c (struct elf_symbol): Add void* to union.
(elf_sort_elf_symbol): Ensure a stable sort with pointer comparison.
(elf_sym_name_compare): Likewise.
(bfd_elf_match_symbols_in_sections): Style fix.
(elf_link_sort_cmp1): Comment.
2019-10-14 Alan Modra <amodra@gmail.com>
PR 24955
* elflink.c (elf_output_implib): Don't use xmalloc. Don't ignore
return value of bfd_alloc2.
* peXXigen.c (_bfd_XXi_write_codeview_record): Don't use xmalloc.
* pef.c (bfd_pef_print_symbol): Likewise. Don't ignore return
value of bfd_get_section_contents.
* som.c (som_write_space_strings): Don't use xmalloc.
(som_write_symbol_strings): Likewise.
2019-10-11 Max Filippov <jcmvbkbc@gmail.com>
* dwarf2.c (stash_maybe_enable_info_hash_tables): Only set
stash->info_hash_status = STASH_INFO_HASH_ON when
stash_maybe_update_info_hash_tables succeeds.
2019-10-09 Alan Modra <amodra@gmail.com>
PR 25070
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Catch overflow of
total_size calculation.
2019-10-08 Alan Modra <amodra@gmail.com>
PR 25078
* dwarf2.c (find_abstract_instance): Delete orig_info_ptr, add
recur_count. Error on recur_count reaching 100 rather than
info_ptr matching orig_info_ptr. Adjust calls.
Add support for new functionality in the msp430 backend of GCC. This functionality will generate a new GNU object attribute for the "data region" has been added. This object attribute is used mark whether the compiler has generated code assuming that data could be in the upper or lower memory regions. Code which assumes data is always in the lower memory region is incompatible with code which uses the full memory range for data. The patch also adds a new assembler directive ".mspabi_attribute" to handle the existing MSPABI object attributes. GCC will now emit both .gnu_attribute and .mspabi_attribute directives to indicate what options the source file was compiled with. The assembler will now check the values set in these directives against the options that the it has been invoked with. If there is a discrepancy, the assembler will exit with an error. bfd * elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Rename to.. (elf32_msp430_merge_msp430_attributes): Add support for merging the GNU object attribute for data region. binutils* readelf.c (display_msp430_gnu_attribute): New. (process_arch_specific): Use msp430 specific handler for GNU attributes. gas * config/tc-msp430.c (md_parse_option): Set lower_data_region_only to FALSE if the data region is set to "upper", "either" or "none". (msp430_object_attribute): New. (md_pseudo_table): Handle .mspabi_attribute and .gnu_attribute. (msp430_md_end): Replace hard-coded attribute values with enums. Handle data region object attribute. * doc/as.texi: Document MSP430 Data Region object attribute. * doc/c-msp430.texi: Document the .mspabi_attribute directive. * testsuite/gas/msp430/attr-430-small-bad.d: New test. * testsuite/gas/msp430/attr-430-small-bad.l: New test. * testsuite/gas/msp430/attr-430-small-good.d: New test. * testsuite/gas/msp430/attr-430-small.s: New test. * testsuite/gas/msp430/attr-430x-large-any-bad.d: New test. * testsuite/gas/msp430/attr-430x-large-any-bad.l: New test. * testsuite/gas/msp430/attr-430x-large-any-good.d: New test. * testsuite/gas/msp430/attr-430x-large-any.s: New test. * testsuite/gas/msp430/attr-430x-large-lower-bad.d: New test. * testsuite/gas/msp430/attr-430x-large-lower-bad.l: New test. * testsuite/gas/msp430/attr-430x-large-lower-good.d: New test. * testsuite/gas/msp430/attr-430x-large-lower.s: New test. * testsuite/gas/msp430/msp430.exp: Run new tests. include * elf/msp430.h: Add enums for MSPABI and GNU object attribute tag names and values. ld * testsuite/ld-msp430-elf/attr-gnu-main.s: New test. * testsuite/ld-msp430-elf/attr-gnu-obj.s: New test. * testsuite/ld-msp430-elf/attr-gnu-region-lower-upper.d: New test. * testsuite/ld-msp430-elf/attr-gnu-region-lower.d: New test. * testsuite/ld-msp430-elf/attr-gnu-region-upper.d: New test. * testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
2019-10-07 17:34:31 +02:00
2019-10-07 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Rename to..
(elf32_msp430_merge_msp430_attributes): Add support for merging
the GNU object attribute for data region.
2019-10-07 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Do allocate
space for local got non-tls relocs when PIE.
2019-10-07 Alan Modra <amodra@gmail.com>
* elflink.c (elf_fixup_link_order): Don't attempt to find
an elf_section for linker created bfd sections.
2019-10-07 Alan Modra <amodra@gmail.com>
* elf32-ppc.c (ppc_elf_tls_optimize): Don't process R_PPC_TLSLD
with non-local symbol. Don't double count __tls_get_addr calls
with marker relocs.
* elf64-ppc.c (ppc64_elf_tls_optimize): Likewise.
2019-10-07 Alan Modra <amodra@gmail.com>
* elf32-ppc.c (nomark_tls_get_addr): Rename from has_tls_get_addr_call
throughout.
* elf64-ppc.c (nomark_tls_get_addr): Likewise.
PowerPC PIC vs. DLL TLS issues 1) GOT entries generated for any of the GOT TLS relocations don't need dynamic relocations for locally defined symbols in PIEs. In the case of a tls_index doubleword, the dtpmod entry is known to be 1, and the dtprel entry is also known at link time and relative. Similarly, dtprel and tprel words are known at link time and relative. (GOT entries for other than TLS symbols are not relative and thus need dynamic relocations in PIEs.) 2) Local dynamic TLS code is really only meant for accesses local to the current binary. There was a cheapskate test for this before using the common tlsld_got slot, but the test wasn't exactly correct and might confuse anyone looking at the code. The proper test, SYMBOL_REFERENCES_LOCAL isn't so expensive that it should be avoided. 3) The same cheap test for local syms when optimising TLS sequences should be SYMBOL_REFERENCES_LOCAL too. bfd/ * elf64-ppc.c (ppc64_elf_check_relocs): Move initialisation of vars. (ppc64_elf_tls_optimize): Correct is_local condition. (allocate_got): Don't reserve dynamic relocations for any of the tls got relocs in PIEs when the symbol is local. (allocate_dynrelocs): Correct validity test for local sym using tlsld_got slot. (ppc64_elf_size_dynamic_sections): Don't reserve dynamic relocations for any of the tls got relocs in PIEs. (ppc64_elf_layout_multitoc): Likewise. (ppc64_elf_relocate_section): Correct validity test for local sym using tlsld_got slot. Don't emit dynamic relocations for any of the tls got relocs in PIEs when the symbol is local. * elf32-ppc.c (ppc_elf_tls_optimize): Correct is_local condition. (got_relocs_needed): Delete. (allocate_dynrelocs): Correct validity test for local sym using tlsld_got slot. Don't reserve dynamic relocations for any of the tls got relocs in PIEs when the symbol is local. (ppc_elf_size_dynamic_sections): Don't reserve dynamic relocations for any of the tls got relocs in PIEs. (ppc_elf_relocate_section): Correct validity test for local sym using tlsld_got slot. Don't emit dynamic relocations for any of the tls got relocs in PIEs when the symbol is local. ld/ * testsuite/ld-powerpc/tlsso.d: Adjust to suit tlsld_got usage change. * testsuite/ld-powerpc/tlsso.g: Likewise. * testsuite/ld-powerpc/tlsso.r: Likewise. * testsuite/ld-powerpc/tlsso32.d: Likewise. * testsuite/ld-powerpc/tlsso32.g: Likewise. * testsuite/ld-powerpc/tlsso32.r: Likewise.
2019-10-04 01:18:41 +02:00
2019-10-04 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_check_relocs): Move initialisation of vars.
(ppc64_elf_tls_optimize): Correct is_local condition.
(allocate_got): Don't reserve dynamic relocations for any of the
tls got relocs in PIEs when the symbol is local.
(allocate_dynrelocs): Correct validity test for local sym using
tlsld_got slot.
(ppc64_elf_size_dynamic_sections): Don't reserve dynamic relocations
for any of the tls got relocs in PIEs.
(ppc64_elf_layout_multitoc): Likewise.
(ppc64_elf_relocate_section): Correct validity test for local sym
using tlsld_got slot. Don't emit dynamic relocations for any of
the tls got relocs in PIEs when the symbol is local.
* elf32-ppc.c (ppc_elf_tls_optimize): Correct is_local condition.
(got_relocs_needed): Delete.
(allocate_dynrelocs): Correct validity test for local sym using
tlsld_got slot. Don't reserve dynamic relocations for any of the
tls got relocs in PIEs when the symbol is local.
(ppc_elf_size_dynamic_sections): Don't reserve dynamic relocations
for any of the tls got relocs in PIEs.
(ppc_elf_relocate_section): Correct validity test for local sym
using tlsld_got slot. Don't emit dynamic relocations for any of
the tls got relocs in PIEs when the symbol is local.
2019-10-04 Szabolcs Nagy <szabolcs.nagy@arm.com>
PR ld/22263
PR ld/25056
* elf32-arm.c (elf32_arm_tls_transition): Use bfd_link_dll instead of
bfd_link_pic for TLS checks.
(elf32_arm_final_link_relocate): Likewise.
(allocate_dynrelocs_for_symbol): Likewise.
2019-10-04 Szabolcs Nagy <szabolcs.nagy@arm.com>
PR ld/25062
* elf32-arm.c (elf32_arm_final_link_relocate): Sign extend data.
bfd, ld: add CTF section linking This is quite complicated because the CTF section's contents depend on the final contents of the symtab and strtab, because it has two sections whose contents are shuffled to be in 1:1 correspondence with the symtab, and an internal strtab that gets deduplicated against the ELF strtab (with offsets adjusted to point into the ELF strtab instead). It is also compressed if large enough, so its size depends on its contents! So we cannot construct it as early as most sections: we cannot even *begin* construction until after the symtab and strtab are finalized. Thankfully there is already one section treated similarly: compressed debugging sections: the only differences are that compressed debugging sections have extra handling to deal with their changing name if compressed (CTF sections are always called ".ctf" for now, though we have reserved ".ctf.*" against future use), and that compressed debugging sections have previously-uncompressed content which has to be stashed away for later compression, while CTF sections have no content at all until we generate it (very late). BFD also cannot do the link itself: libctf knows how to do it, and BFD cannot call libctf directly because libctf already depends on bfd for file I/O. So we have to use a pair of callbacks, one, examine_strtab, which allows a caller to examine the symtab and strtab after finalization (called from elf_link_swap_symbols_out(), right before the symtabs are written, and after the strtab has been finalized), and one which actually does the emission (called emit_ctf simply because it is grouped with a bunch of section-specific late-emission function calls at the bottom of bfd_elf_final_link, and a section-specific name seems best for that). emit_ctf is actually called *twice*: once from lang_process if the emulation suggests that this bfd target does not examine the symtab or strtab, and once via a bfd callback if it does. (This means that non-ELF targets still get CTF emitted, even though the late CTF emission stage is never called for them). v2: merged with non-ELF support patch: slight commit message adjustments. v3: do not spend time merging CTF, or crash, if the CTF section is explicitly discarded. Do not try to merge or compress CTF unless linking. v4: add CTF_COMPRESSION_THRESHOLD. Annul the freed input ctf_file_t's after writeout: set SEC_IN_MEMORY on the output contents so a future bfd enhancement knows it could free it. Add SEC_LINKER_CREATED | SEC_KEEP to avoid having to add .ctf to the linker script. Drop now-unnecessary ldlang.h-level elf-bfd.h include and hackery around it. Adapt to elf32.em->elf.em and elf-generic.em->ldelf*.c changes. v5: fix tabdamage. Drop #inclusions in .h files: include in .c files, .em files, and use struct forwards instead. Use bfd_section_is_ctf inline function rather than SECTION_IS_CTF macro. Move a few comments. * Makefile.def (dependencies): all-ld depends on all-libctf. * Makefile.in: Regenerated. include/ * bfdlink.h (elf_strtab_hash): New forward. (elf_sym_strtab): Likewise. (struct bfd_link_callbacks <examine_strtab>): New. (struct bfd_link_callbacks <emit_ctf>): Likewise. bfd/ * elf-bfd.h (bfd_section_is_ctf): New inline function. * elf.c (special_sections_c): Add ".ctf". (assign_file_positions_for_non_load_sections): Note that compressed debugging sections etc are not assigned here. Treat CTF sections like SEC_ELF_COMPRESS sections when is_linker_output: sh_offset -1. (assign_file_positions_except_relocs): Likewise. (find_section_in_list): Note that debugging and CTF sections, as well as reloc sections, are assigned later. (_bfd_elf_assign_file_positions_for_non_load): CTF sections get their size and contents updated. (_bfd_elf_set_section_contents): Skip CTF sections: unlike compressed sections, they have no uncompressed content to copy at this stage. * elflink.c (elf_link_swap_symbols_out): Call the examine_strtab callback right before the strtab is written out. (bfd_elf_final_link): Don't cache the section contents of CTF sections: they are not populated yet. Call the emit_ctf callback right at the end, after all the symbols and strings are flushed out. ld/ * ldlang.h: (struct lang_input_statement_struct): Add the_ctf. (struct elf_sym_strtab): Add forward. (struct elf_strtab_hash): Likewise. (ldlang_ctf_apply_strsym): Declare. (ldlang_write_ctf_late): Likewise. * ldemul.h (ldemul_emit_ctf_early): New. (ldemul_examine_strtab_for_ctf): Likewise. (ld_emulation_xfer_type) <emit_ctf_early>: Likewise. (ld_emulation_xfer_type) <examine_strtab_for_ctf>: Likewise. * ldemul.c (ldemul_emit_ctf_early): New. (ldemul_examine_strtab_for_ctf): Likewise. * ldlang.c: Include ctf-api.h. (CTF_COMPRESSION_THRESHOLD): New. (ctf_output): New. Initialized in... (ldlang_open_ctf): ... this new function. Open all the CTF sections in the input files: mark them non-loaded and empty so as not to copy their contents to the output, but linker-created so the section gets created in the target. (ldlang_merge_ctf): New, merge types via ctf_link_add_ctf and ctf_link. (ldlang_ctf_apply_strsym): New, an examine_strtab callback: wrap ldemul_examine_strtab_for_ctf. (lang_write_ctf): New, write out the CTF section. (ldlang_write_ctf_late): New, late call via bfd's emit_ctf hook. (lang_process): Call ldlang_open_ctf, ldlang_merge_ctf, and lang_write_ctf. * ldmain.c (link_callbacks): Add ldlang_ctf_apply_strsym, ldlang_write_ctf_late. * emultempl/aix.em: Add ctf-api.h. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/elf.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/msp430.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * ldcref.c: Likewise. * ldctor.c: Likewise. * ldelf.c: Likewise. * ldelfgen.c: Likewise. * ldemul.c: Likewise. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldgram.c: Likewise. * ldlex.l: Likewise. * ldmain.c: Likewise. * ldmisc.c: Likewise. * ldver.c: Likewise. * ldwrite.c: Likewise. * lexsup.c: Likewise. * mri.c: Likewise. * pe-dll.c: Likewise. * plugin.c: Likewise. * ldelfgen.c (ldelf_emit_ctf_early): New. (ldelf_examine_strtab_for_ctf): tell libctf about the symtab and strtab. (struct ctf_strsym_iter_cb_arg): New, state to do so. (ldelf_ctf_strtab_iter_cb): New: tell libctf about each string in the strtab in turn. (ldelf_ctf_symbols_iter_cb): New, tell libctf about each symbol in the symtab in turn. * ldelfgen.h (struct elf_sym_strtab): Add forward. (struct elf_strtab_hash): Likewise. (struct ctf_file): Likewise. (ldelf_emit_ctf_early): Declare. (ldelf_examine_strtab_for_ctf): Likewise. * emultempl/elf-generic.em (LDEMUL_EMIT_CTF_EARLY): Set it. (LDEMUL_EXAMINE_STRTAB_FOR_CTF): Likewise. * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Add emit_ctf_early and examine_strtab_for_ctf, NULL by default. * emultempl/armcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/beos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/linux.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/msp430.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pe.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pep.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/ticoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/vanilla.em (ld_vanilla_emulation): Likewise. * Makefile.am: Pull in libctf (and zlib, a transitive requirement for compressed CTF section emission). Pass it on to DejaGNU. * configure.ac: Add AM_ZLIB. * aclocal.m4: Added zlib.m4. * Makefile.in: Regenerated. * testsuite/ld-bootstrap/bootstrap.exp: Use it when relinking ld.
2019-07-13 23:38:00 +02:00
2019-09-30 Nick Alcock <nick.alcock@oracle.com>
* elf-bfd.h (bfd_section_is_ctf): New inline function.
* elf.c (special_sections_c): Add ".ctf".
(assign_file_positions_for_non_load_sections): Note that
compressed debugging sections etc are not assigned here. Treat
CTF sections like SEC_ELF_COMPRESS sections when is_linker_output:
sh_offset -1.
(assign_file_positions_except_relocs): Likewise.
(find_section_in_list): Note that debugging and CTF sections, as
well as reloc sections, are assigned later.
(_bfd_elf_assign_file_positions_for_non_load): CTF sections get
their size and contents updated.
(_bfd_elf_set_section_contents): Skip CTF sections: unlike
compressed sections, they have no uncompressed content to copy at
this stage.
* elflink.c (elf_link_swap_symbols_out): Call the examine_strtab
callback right before the strtab is written out.
(bfd_elf_final_link): Don't cache the section contents of CTF
sections: they are not populated yet. Call the emit_ctf callback
right at the end, after all the symbols and strings are flushed
out.
2019-07-13 Nick Alcock <nick.alcock@oracle.com>
* elf-strtab.c (_bfd_elf_strtab_len): New.
(_bfd_elf_strtab_str): Likewise.
* bfd-elf.h: Declare them.
libctf, bfd: fix ctf_bfdopen_ctfsect opening symbol and string sections The code in ctf_bfdopen_ctfsect (which is the ultimate place where you end up if you use ctf_open to open a CTF file and pull in the ELF string and symbol tables) was written before it was possible to actually test it, since the linker was not written. Now it is, it turns out that the previous code was completely nonfunctional: it assumed that you could load the symbol table via bfd_section_from_elf_index (...,elf_onesymtab()) and the string table via bfd_section_from_elf_index on the sh_link. Unfortunately BFD loads neither of these sections in the conventional fashion it uses for most others: the symbol table is immediately converted into internal form (which is useless for our purposes, since we also have to work in the absence of BFD for readelf, etc) and the string table is loaded specially via bfd_elf_get_str_section which is private to bfd/elf.c. So make this function public, export it in elf-bfd.h, and use it from libctf, which does something similar to what bfd_elf_sym_name and bfd_elf_string_from_elf_section do. Similarly, load the symbol table manually using bfd_elf_get_elf_syms and throw away the internal form it generates for us (we never use it). BFD allocates the strtab for us via bfd_alloc, so we can leave BFD to deallocate it: we allocate the symbol table ourselves before calling bfd_elf_get_elf_syms, so we still have to free it. Also change the rules around what you are allowed to provide: It is useful to provide a string section but no symbol table, because CTF sections can legitimately have no function info or data object sections while relying on the ELF strtab for some of their strings. So allow that combination. v4: adjust to upstream changes. ctf_bfdopen_ctfsect's first parameter is potentially unused again (if BFD is not in use for this link due to not supporting an ELF target). v5: fix tabdamage. bfd/ * elf-bfd.h (bfd_elf_get_str_section): Add. * elf.c (bfd_elf_get_str_section): No longer static. libctf/ * ctf-open-bfd.c: Add <assert.h>. (ctf_bfdopen_ctfsect): Open string and symbol tables using techniques borrowed from bfd_elf_sym_name. (ctf_new_archive_internal): Improve comment. * ctf-archive.c (ctf_arc_close): Do not free the ctfi_strsect. * ctf-open.c (ctf_bufopen): Allow opening with a string section but no symbol section, but not vice versa.
2019-07-11 17:26:54 +02:00
2019-07-13 Nick Alcock <nick.alcock@oracle.com>
* elf-bfd.h (bfd_elf_get_str_section): Add.
* elf.c (bfd_elf_get_str_section): No longer static.
2019-09-26 Alan Modra <amodra@gmail.com>
PR 24262
* Makefile.am (AM_CPPFLAGS): Add -DLIBDIR.
* plugin.c (load_plugin): Search both ${libdir}/bfd-plugins and
${bindir}/../lib/bfd-plugins if different.
* Makefile.in: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_check_relocs): Use bfd_link_executable
in choosing between different actions for shared library and
non-shared library cases. Delete ELIMINATE_COPY_RELOCS test.
(dec_dynrel_count): Likewise. Account for ifunc special case.
(ppc64_elf_adjust_dynamic_symbol): Copy relocs are for executables,
not non-pic.
(allocate_dynrelocs): Comment fixes. Delete ELIMINATE_COPY_RELOCS
test.
2019-09-23 Alan Modra <amodra@gmail.com>
* Makefile.am (SOURCE_HFILES): Add many missing .h files.
* Makefile.in: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h (bfd_symbol, bfd_section_already_linked),
(bfd_elf_version_tree): Delete forward declarations.
Move other forward decls and remaining elf function decl later.
(bfd_section_already_linked_table_init),
(bfd_section_already_linked_table_free),
(_bfd_handle_already_linked, _bfd_nearby_section),
(_bfd_fix_excluded_sec_syms): Move to bfdlink.h.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move ecoff function declarations..
* ecoff-bfd.h: ..to here, new file.
* ecoff.c: Include ecoff-bfd.h.
* ecofflink.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h (enum notice_asneeded_action): Move to bfdlink.h.
Move most other elf declarations..
* elf-bfd.h: ..to here.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move m68k function declaration..
* cpu-m68k.h: ..to here, new file..
* elf32-m68k.h: ..and here, new file.
* elf32-m68k.c: Include cpu-m68k.h and elf32-m68k.h.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move bfin function declaration..
* elf32-bfin.h: ..to here, new file.
* elf32-bfin.c: Include elf32-bfin.h.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move cr16 function declaration..
* elf32-cr16.h: ..to here, new file.
* elf32-cr16.c: Include elf32-cr16.h.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h (bfd_sunos_get_needed_list),
(bfd_sunos_record_link_assignment),
(bfd_sunos_size_dynamic_sections),
(bfd_i386linux_size_dynamic_sections),
(bfd_sparclinux_size_dynamic_sections): Delete obsolete decls.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move xcoff function declarations..
* xcofflink.h: ..to here, new file.
* xcofflink.c: Include xcofflink.h.
* coff-rs6000.c (bfd_xcoff_ar_archive_set_magic): Delete unused func.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Delete coff forward refs and move coff declaration..
* coff-bfd.h: ..to here.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move arm declaraions..
* cpu-arm.h: ..to here, new file..
* coff-arm.h: ..and here, new file..
* elf32-arm.h: ..and here, new file.
* cpu-arm.c: Include cpu-arm.h.
* coff-arm.c: Include cpu-arm.h and coff-arm.h.
* elf32-arm.c: Include cpu-arm.h and elf32-arm.h.
* pe-arm.c: Move function rename defines later.
* pe-arm-wince.c: Likewise and include sysdep.h and bfd.h early.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move tic6x function declaration..
* elf32-tic6x.h: ..to here.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move aarch64 declarations and defines..
* cpu-aarch64.h: ..to here, new file..
* elfxx-aarch64.h: ..and here.
* cpu-aarch64.c: Include cpu-aarch64.h.
* elfnn-aarch64.c: Likewise.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Delete ticoff function declarations.
* coff-tic54x.c (bfd_ticoff_set_section_load_page),
(bfd_ticoff_get_section_load_page): Make static.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move h8300 function declaration to..
* cpu-h8300.h: ..here, new file.
* cpu-h8300.c: Include cpu-h8300.h.
* elf32-h8300.c: Likewise.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move ia64 function declarations..
* elfxx-ia64.h: ..to here.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move v850 function declarations..
* elf32-v850.h: ..to here, new file.
* elf32-v850.c: Include elf32-v850.h.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move mips function declaration to..
* elfxx-mips.h: ..here.
* bfd-in2.h: Regenerate.
2019-09-23 Alan Modra <amodra@gmail.com>
* bfd-in.h: Move csky function declarations to..
* elf32-csky.h: ..here, new file.
* elf32-csky.c: Include elf32-csky.h.
* bfd-in2.h: Regenerate.
2019-09-20 Nelson Chu <nelson.chu@sifive.com>
* elfnn-riscv.c (riscv_pcgp_hi_reloc): Add new field undefined_weak.
(riscv_record_pcgp_hi_reloc): New parameter undefined_weak.
Set undefined_weak field from it.
(relax_func_t): New parameter undefined_weak.
(_bfd_riscv_relax_call): New ignored parameter undefined_weak.
(_bfd_riscv_relax_tls_le): Likewise.
(_bfd_riscv_relax_align): Likewise.
(_bfd_riscv_relax_delete): Likewise.
(_bfd_riscv_relax_lui): New parameter undefined_weak. If true,
allow relaxing. For LO12* relocs, set rs1 to x0 when undefined_weak.
(_bfd_riscv_relax_pc): New parameter undefined_weak. For LO12* relocs,
set undefined_weak from hi_reloc. If true, allow relaxing. For LO12*
relocs, set rs1 to x0 when undefined_weak and change to non-pcrel
reloc.
(_bfd_riscv_relax_section): New local undefined_weak. Set for
undef weak relocs that can be relaxed. Pass to relax_func call.
bfd macro conversion to inline functions, section This one exposed a bug in tic6x gas, found with inline function parameter type checking. struct bfd_section and struct bfd_symbol both have a flags field, so bfd_is_com_section (symbol) compiled OK when bfd_is_com_section was a macro but didn't special case common symbols. bfd/ * bfd-in.h (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment, bfd_section_flags), (bfd_section_userdata, bfd_is_com_section, discarded_section), (bfd_get_section_limit_octets, bfd_get_section_limit): Delete macros. * bfd.c (bfd_get_section_limit_octets, bfd_get_section_limit), (bfd_section_list_remove, bfd_section_list_append), (bfd_section_list_prepend, bfd_section_list_insert_after), (bfd_section_list_insert_before, bfd_section_removed_from_list): New inline functions. * section.c (bfd_is_und_section, bfd_is_abs_section), (bfd_is_ind_section, bfd_is_const_section, bfd_section_list_remove), (bfd_section_list_append, bfd_section_list_prepend), (bfd_section_list_insert_after, bfd_section_list_insert_before), (bfd_section_removed_from_list): Delete macros. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment, bfd_section_flags), (bfd_section_userdata, bfd_is_com_section, bfd_is_und_section), (bfd_is_abs_section, bfd_is_ind_section, bfd_is_const_section), (discarded_section): New inline functions. * bfd-in2.h: Regenerate. gas/ * config/tc-tic6x.c (tc_gen_reloc): Correct common symbol check. ld/ * emultempl/xtensaelf.em (xtensa_get_section_deps): Comment. Use bfd_section_userdata. (xtensa_set_section_deps): Use bfd_set_section_userdata. * ldlang.c (lang_output_section_get): Use bfd_section_userdata. (sort_def_symbol): Likewise, and bfd_set_section_userdata. (init_os): Use bfd_set_section_userdata. (print_all_symbols): Use bfd_section_userdata. * ldlang.h (get_userdata): Delete.
2019-09-17 01:29:25 +02:00
2019-09-20 Alan Modra <amodra@gmail.com>
* bfd-in.h (bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment, bfd_section_flags),
(bfd_section_userdata, bfd_is_com_section, discarded_section),
(bfd_get_section_limit_octets, bfd_get_section_limit): Delete macros.
* bfd.c (bfd_get_section_limit_octets, bfd_get_section_limit),
(bfd_section_list_remove, bfd_section_list_append),
(bfd_section_list_prepend, bfd_section_list_insert_after),
(bfd_section_list_insert_before, bfd_section_removed_from_list):
New inline functions.
* section.c (bfd_is_und_section, bfd_is_abs_section),
(bfd_is_ind_section, bfd_is_const_section, bfd_section_list_remove),
(bfd_section_list_append, bfd_section_list_prepend),
(bfd_section_list_insert_after, bfd_section_list_insert_before),
(bfd_section_removed_from_list): Delete macros.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment, bfd_section_flags),
(bfd_section_userdata, bfd_is_com_section, bfd_is_und_section),
(bfd_is_abs_section, bfd_is_ind_section, bfd_is_const_section),
(discarded_section): New inline functions.
* bfd-in2.h: Regenerate.
2019-09-20 Alan Modra <amodra@gmail.com>
* bfd-in.h (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_asymbol_flavour, bfd_set_asymbol_name): Delete.
* bfd.c (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_set_asymbol_name): New inline functions.
* targets.c (bfd_asymbol_flavour): Likewise.
* bfd-in2.h: Regenerate.
bfd macro conversion to inline functions This converts some of the macros that access struct bfd fields to inline functions. bfd/ * archive.c (bfd_generic_archive_p): Use bfd_set_thin_archive. * bfd-in.h (bfd_get_filename, bfd_get_cacheable, bfd_get_format), (bfd_get_target, bfd_get_flavour, bfd_family_coff, bfd_big_endian), (bfd_little_endian, bfd_header_big_endian, bfd_header_little_endian), (bfd_get_file_flags, bfd_applicable_file_flags), (bfd_applicable_section_flags, bfd_has_map, bfd_is_thin_archive), (bfd_valid_reloc_types, bfd_usrdata, bfd_get_start_address), (bfd_get_symcount, bfd_get_outsymbols, bfd_count_sections), (bfd_get_dynamic_symcount, bfd_get_symbol_leading_char): Delete. * bfd/bfd.c (bfd_get_filename, bfd_get_cacheable, bfd_get_format), (bfd_get_file_flags, bfd_get_start_address, bfd_get_symcount), (bfd_get_dynamic_symcount, bfd_get_outsymbols, bfd_count_sections), (bfd_has_map, bfd_is_thin_archive, bfd_set_thin_archive), (bfd_usrdata, bfd_set_usrdata): New inline functions. * targets.c (bfd_get_target, bfd_get_flavour), (bfd_applicable_file_flags, bfd_family_coff, bfd_big_endian), (bfd_little_endian, bfd_header_big_endian), (bfd_header_little_endian, bfd_applicable_section_flags), (bfd_get_symbol_leading_char): New inline functions. * bfd-in2.h: Regenerate. binutils/ * ar.c (write_archive): Use bfd_set_thin_archive. gdb/ * gdb_bfd.c (gdb_bfd_ref, gdb_bfd_unref): Use bfd_set_usrdata. * dwarf2read.c (dwarf2_read_gdb_index, dwarf2_read_debug_names), (read_indirect_string_from_dwz): Use bfd accessor. * dwarf2read.h (struct dwz_file <filename>): Likewise. * machoread.c (macho_symfile_read_all_oso): Likewise. * solib.c (solib_bfd_open): Likewise. ld/ * ldelf.c (ldelf_after_open, ldelf_place_orphan * ldlang.c (walk_wild_file, lang_process): Use bfd_usrdata. (load_symbols, ldlang_add_file): Use bfd_set_usrdata. * ldmain.c (add_archive_element): Use bfd_usrdata. * ldlang.h (bfd_input_just_syms): New inline function. * emultempl/aarch64elf.em (build_section_lists): Use it. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/ppc64elf.em (build_section_lists): Likewise. sim/ * ppc/emul_generic.c (emul_add_tree_options): Delete old bfd code.
2019-09-19 04:21:04 +02:00
2019-09-20 Alan Modra <amodra@gmail.com>
* archive.c (bfd_generic_archive_p): Use bfd_set_thin_archive.
* bfd-in.h (bfd_get_filename, bfd_get_cacheable, bfd_get_format),
(bfd_get_target, bfd_get_flavour, bfd_family_coff, bfd_big_endian),
(bfd_little_endian, bfd_header_big_endian, bfd_header_little_endian),
(bfd_get_file_flags, bfd_applicable_file_flags),
(bfd_applicable_section_flags, bfd_has_map, bfd_is_thin_archive),
(bfd_valid_reloc_types, bfd_usrdata, bfd_get_start_address),
(bfd_get_symcount, bfd_get_outsymbols, bfd_count_sections),
(bfd_get_dynamic_symcount, bfd_get_symbol_leading_char): Delete.
* bfd/bfd.c (bfd_get_filename, bfd_get_cacheable, bfd_get_format),
(bfd_get_file_flags, bfd_get_start_address, bfd_get_symcount),
(bfd_get_dynamic_symcount, bfd_get_outsymbols, bfd_count_sections),
(bfd_has_map, bfd_is_thin_archive, bfd_set_thin_archive),
(bfd_usrdata, bfd_set_usrdata): New inline functions.
* targets.c (bfd_get_target, bfd_get_flavour),
(bfd_applicable_file_flags, bfd_family_coff, bfd_big_endian),
(bfd_little_endian, bfd_header_big_endian),
(bfd_header_little_endian, bfd_applicable_section_flags),
(bfd_get_symbol_leading_char): New inline functions.
* bfd-in2.h: Regenerate.
2019-09-20 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_glibc_dynamic_reloc): New function.
(ppc64_elf_relocate_section): Warn if emitting unsupported dynamic
relocations.
bfd_section_* macros This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
2019-09-18 Alan Modra <amodra@gmail.com>
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
2019-09-18 Alan Modra <amodra@gmail.com>
* bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section.
(bfd_get_output_section): Delete.
(bfd_asymbol_base): Delete.
(bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy.
(bfd_set_asymbol_name): New macro.
* bfd-in2.h: Regenerate.
* aout-cris.c: Update throughout to use bfd_asymbol_section.
* aoutx.h: Likewise.
* cofflink.c: Likewise.
* dwarf2.c: Likewise.
* ecoff.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-mips.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elfn32-mips.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfxx-mips.c: Likewise.
* linker.c: Likewise.
* pdp11.c: Likewise.
* elf64-mmix.c (mmix_elf_reloc): Part expand bfd_get_output_section.
2019-09-18 Simon Marchi <simon.marchi@polymtl.ca>
* Makefile.in: Re-generate.
* configure: Re-generate.
* doc/Makefile.in: Re-generate.
Don't use bfd_get_* macro to set bfd fields * aoutx.h (slurp_symbol_table): Don't set symcount using bfd_get macros. * pdp11.c (slurp_symbol_table): Likewise. * som.c (som_slurp_symbol_table): Likewise. * coff-ppc.c (ppc_bfd_coff_final_link): Likewise. * coffcode.h (coff_slurp_symbol_table): Likewise. * cofflink.c (_bfd_coff_final_link): Likewise. * ecoff.c (ecoff_slurp_symbolic_header): Likewise. (_bfd_ecoff_slurp_symbolic_info): Likewise. (_bfd_ecoff_slurp_symbol_table): Likewise. (_bfd_ecoff_bfd_final_link): Likewise. * elf.c (_bfd_elf_canonicalize_symtab): Likewise. * elflink.c (elf_link_output_symstrtab): Likewise. (bfd_elf_final_link): Likewise. * peicode.h (pe_ILF_build_a_bfd): Likewise. * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise. * aoutx.h (some_aout_object_p, slurp_symbol_table): Don't set start_address or symcount using bfd_get macros. * coffgen.c (coff_real_object_p): Likewise. * pdp11.c (some_aout_object_p, slurp_symbol_table): Likewise. * som.c (som_object_setup, som_slurp_symbol_table): Likewise. * elfcore.h (elf_core_file_p): Don't set start_address using bfd_get macro. * elf.c (_bfd_elf_canonicalize_dynamic_symtab): Don't set dynsymcount using bfd_get macro. * bfd.c (bfd_set_file_flags): Don't set flags using bfd_get macro. * linker.c (bfd_generic_link_read_symbols): Don't set outsymbols or symcount using bfd_get macros. (_bfd_generic_final_link, generic_add_output_symbol): Likewise. * syms.c (bfd_set_symtab): Likewise. * vms-alpha.c (alpha_vms_bfd_final_link): Likewise. * archive.c (do_slurp_bsd_armap): Don't set has_armap using bfd_has_map macro. (do_slurp_coff_armap, bfd_slurp_armap): Likewise. * archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise. * coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise. * coff64-rs6000.c (xcoff64_slurp_armap): Likewise. * ecoff.c (_bfd_ecoff_slurp_armap): Likewise. * som.c (som_slurp_armap): Likewise.
2019-09-18 07:37:33 +02:00
2019-09-18 Alan Modra <amodra@gmail.com>
* aoutx.h (slurp_symbol_table): Don't set symcount using bfd_get
macros.
* pdp11.c (slurp_symbol_table): Likewise.
* som.c (som_slurp_symbol_table): Likewise.
* coff-ppc.c (ppc_bfd_coff_final_link): Likewise.
* coffcode.h (coff_slurp_symbol_table): Likewise.
* cofflink.c (_bfd_coff_final_link): Likewise.
* ecoff.c (ecoff_slurp_symbolic_header): Likewise.
(_bfd_ecoff_slurp_symbolic_info): Likewise.
(_bfd_ecoff_slurp_symbol_table): Likewise.
(_bfd_ecoff_bfd_final_link): Likewise.
* elf.c (_bfd_elf_canonicalize_symtab): Likewise.
* elflink.c (elf_link_output_symstrtab): Likewise.
(bfd_elf_final_link): Likewise.
* peicode.h (pe_ILF_build_a_bfd): Likewise.
* xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise.
* aoutx.h (some_aout_object_p, slurp_symbol_table): Don't set
start_address or symcount using bfd_get macros.
* coffgen.c (coff_real_object_p): Likewise.
* pdp11.c (some_aout_object_p, slurp_symbol_table): Likewise.
* som.c (som_object_setup, som_slurp_symbol_table): Likewise.
* elfcore.h (elf_core_file_p): Don't set start_address using
bfd_get macro.
* elf.c (_bfd_elf_canonicalize_dynamic_symtab): Don't set dynsymcount
using bfd_get macro.
* bfd.c (bfd_set_file_flags): Don't set flags using bfd_get macro.
* linker.c (bfd_generic_link_read_symbols): Don't set outsymbols
or symcount using bfd_get macros.
(_bfd_generic_final_link, generic_add_output_symbol): Likewise.
* syms.c (bfd_set_symtab): Likewise.
* vms-alpha.c (alpha_vms_bfd_final_link): Likewise.
* archive.c (do_slurp_bsd_armap): Don't set has_armap using
bfd_has_map macro.
(do_slurp_coff_armap, bfd_slurp_armap): Likewise.
* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
* coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
* coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
* ecoff.c (_bfd_ecoff_slurp_armap): Likewise.
* som.c (som_slurp_armap): Likewise.
2019-09-18 Alan Modra <amodra@gmail.com>
* archures.c (bfd_get_arch): Make param const.
(bfd_get_mach, bfd_arch_bits_per_byte): Likewise.
(bfd_arch_bits_per_address, bfd_octets_per_byte): Likewise.
* bfd-in2.h: Regenerate.
2019-09-18 Alan Modra <amodra@gmail.com>
* bfd-in.h (carsym.name): Make const.
* reloc.c (struct reloc_howto_struct.name): Likewise.
* targets.c (bfd_target.name): Likewise.!
* bfd.c (bfd_get_sign_extend_vma): Make variable const.
* som.c (som_bfd_fill_in_ar_symbols): Use an intermediary variable
when setting carsym.name.
* bfd-in2.h: Regenerate.
2019-09-18 Alan Modra <amodra@gmail.com>
* mach-o.c (bfd_mach_o_fat_member_init): Likewise. Replace
xstrdup and xmalloc with bfd_strdup and bfd_malloc. Return an
error status. Adjust calls.
* vms-lib.c (_bfd_vms_lib_get_module): Test mhd->id earlier.
Close bfd on failure. Replace xstrdup/bfd_alloc use with
bfd_malloc. Use bfd_set_filename.
2019-09-18 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (must_be_dyn_reloc): Return 0 for TOC16 relocs.
(ppc64_elf_check_relocs): Support dynamic/copy relocs for TOC16.
(ppc64_elf_adjust_dynamic_symbol): Don't keep dynamic reloc when
needs_copy even if all relocs are in rw sections.
(dec_dynrel_count): Handle TOC16 relocs.
(ppc64_elf_relocate_section): Support dynamic relocs for TOC16.
(ppc64_elf_finish_dynamic_symbol): Adjust to handle needs_copy
semantic change.
2019-09-16 Phil Blundell <pb@pbcl.net>
* version.m4: Set version to 2.33.50.
* Makefile.in, configure, doc/Makefile.in: Regenerated.
2019-09-11 Tom Tromey <tom@tromey.com>
* opncls.c (bfd_set_filename): New function.
* bfd-in2.h: Regenerate.
Tidy ld/ldmisc.c The idea here is to not use elf-bfd.h and coff-bfd.h in generic linker code. bfd/ * targets.c (struct bfd_target): Add _bfd_group_name. (BFD_JUMP_TABLE): Likewise. * coffgen.c (bfd_coff_group_name): New function. * elf.c (bfd_elf_group_name): New function. * linker.c (_bfd_nolink_bfd_group_name): New function. * section.c (bfd_generic_group_name): New function. * elf-bfd.h (bfd_elf_group_name): Declare. * libbfd-in.h (_bfd_nolink_bfd_group_name): Declare. * libcoff-in.h (bfd_coff_group_name): Declare. * aout-target.h (MY_bfd_group_name): Define. * aout-tic30.c (MY_bfd_group_name): Define. * bfd.c (bfd_group_name): Define. * binary.c (binary_bfd_group_name): Define. * coff-alpha.c (_bfd_ecoff_bfd_group_name): Define. * coff-mips.c (_bfd_ecoff_bfd_group_name): Define. * coff-rs6000.c (_bfd_xcoff_bfd_group_name): Define. * coffcode.h (coff_bfd_group_name): Define. * elfxx-target.h (bfd_elfNN_bfd_group_name): Define. * i386msdos.c (msdos_bfd_group_name): Define. * ihex.c (ihex_bfd_group_name): Define. * mach-o-target.c (bfd_mach_o_bfd_group_name): Define. * mmo.c (mmo_bfd_group_name): Define. * pef.c (bfd_pef_bfd_group_name): Define. * plugin.c (bfd_plugin_bfd_group_name): Define. * ppcboot.c (ppcboot_bfd_group_name): Define. * som.c (som_bfd_group_name): Define. * srec.c (srec_bfd_group_name): Define. * tekhex.c (tekhex_bfd_group_name): Define. * verilog.c (verilog_bfd_group_name): Define. * vms-alpha.c (vms_bfd_group_name, alpha_vms_bfd_group_name): Define. * xsym.c (bfd_sym_bfd_group_name): Define. * coff64-rs6000.c (rs6000_xcoff64_vec): Init new field. (rs6000_xcoff64_aix_vec): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * ldmisc.c: Don't #include elf-bfd.h or coff-bfd.h. (vfinfo): Use bfd_group_name.
2019-09-09 07:53:27 +02:00
2019-09-11 Alan Modra <amodra@gmail.com>
* targets.c (struct bfd_target): Add _bfd_group_name.
(BFD_JUMP_TABLE): Likewise.
* coffgen.c (bfd_coff_group_name): New function.
* elf.c (bfd_elf_group_name): New function.
* linker.c (_bfd_nolink_bfd_group_name): New function.
* section.c (bfd_generic_group_name): New function.
* elf-bfd.h (bfd_elf_group_name): Declare.
* libbfd-in.h (_bfd_nolink_bfd_group_name): Declare.
* libcoff-in.h (bfd_coff_group_name): Declare.
* aout-target.h (MY_bfd_group_name): Define.
* aout-tic30.c (MY_bfd_group_name): Define.
* bfd.c (bfd_group_name): Define.
* binary.c (binary_bfd_group_name): Define.
* coff-alpha.c (_bfd_ecoff_bfd_group_name): Define.
* coff-mips.c (_bfd_ecoff_bfd_group_name): Define.
* coff-rs6000.c (_bfd_xcoff_bfd_group_name): Define.
* coffcode.h (coff_bfd_group_name): Define.
* elfxx-target.h (bfd_elfNN_bfd_group_name): Define.
* i386msdos.c (msdos_bfd_group_name): Define.
* ihex.c (ihex_bfd_group_name): Define.
* mach-o-target.c (bfd_mach_o_bfd_group_name): Define.
* mmo.c (mmo_bfd_group_name): Define.
* pef.c (bfd_pef_bfd_group_name): Define.
* plugin.c (bfd_plugin_bfd_group_name): Define.
* ppcboot.c (ppcboot_bfd_group_name): Define.
* som.c (som_bfd_group_name): Define.
* srec.c (srec_bfd_group_name): Define.
* tekhex.c (tekhex_bfd_group_name): Define.
* verilog.c (verilog_bfd_group_name): Define.
* vms-alpha.c (vms_bfd_group_name, alpha_vms_bfd_group_name): Define.
* xsym.c (bfd_sym_bfd_group_name): Define.
* coff64-rs6000.c (rs6000_xcoff64_vec): Init new field.
(rs6000_xcoff64_aix_vec): Likewise.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.
Enhance the disassembler so that it will reliably determine whether a reloc applies to the middle of the next insn. PR 24907 binutils* objdump.c (null_print): New function. (disassemble_bytes): Delete previous_octets local and replace with a test of the max_reloc_offset_into_insn field of the bfd_arch_info structure. If a reloc is a potential match for the next insn, then perform a dummy disassembly in order to calculate its real length. bfd * archures.c (bfd_arch_info_type): Add max_reloc_offset_into_insn field. (bfd_default_arch_struct): Initialise the new field. * bfd-in2.h: Regenerate. * cpu-aarch64.c: Initialise the new field. * cpu-alpha.c: Likewise. * cpu-arc.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-bpf.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-cris.c: Likewise. * cpu-crx.c: Likewise. * cpu-csky.c: Likewise. * cpu-d10v.c: Likewise. * cpu-d30v.c: Likewise. * cpu-dlx.c: Likewise. * cpu-epiphany.c: Likewise. * cpu-fr30.c: Likewise. * cpu-frv.c: Likewise. * cpu-ft32.c: Likewise. * cpu-h8300.c: Likewise. * cpu-hppa.c: Likewise. * cpu-i386.c: Likewise. * cpu-ia64.c: Likewise. * cpu-iamcu.c: Likewise. * cpu-ip2k.c: Likewise. * cpu-iq2000.c: Likewise. * cpu-k1om.c: Likewise. * cpu-l1om.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m10200.c: Likewise. * cpu-m10300.c: Likewise. * cpu-m32c.c: Likewise. * cpu-m32r.c: Likewise. * cpu-m68hc11.c: Likewise. * cpu-m68hc12.c: Likewise. * cpu-m68k.c: Likewise. * cpu-m9s12x.c: Likewise. * cpu-m9s12xg.c: Likewise. * cpu-mcore.c: Likewise. * cpu-mep.c: Likewise. * cpu-metag.c: Likewise. * cpu-microblaze.c: Likewise. * cpu-mips.c: Likewise. * cpu-mmix.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-mt.c: Likewise. * cpu-nds32.c: Likewise. * cpu-nfp.c: Likewise. * cpu-nios2.c: Likewise. * cpu-ns32k.c: Likewise. * cpu-or1k.c: Likewise. * cpu-pdp11.c: Likewise. * cpu-pj.c: Likewise. * cpu-plugin.c: Likewise. * cpu-powerpc.c: Likewise. * cpu-pru.c: Likewise. * cpu-riscv.c: Likewise. * cpu-rl78.c: Likewise. * cpu-rs6000.c: Likewise. * cpu-rx.c: Likewise. * cpu-s12z.c: Likewise. * cpu-s390.c: Likewise. * cpu-score.c: Likewise. * cpu-sh.c: Likewise. * cpu-sparc.c: Likewise. * cpu-spu.c: Likewise. * cpu-tic30.c: Likewise. * cpu-tic4x.c: Likewise. * cpu-tic54x.c: Likewise. * cpu-tic6x.c: Likewise. * cpu-tic80.c: Likewise. * cpu-tilegx.c: Likewise. * cpu-tilepro.c: Likewise. * cpu-v850.c: Likewise. * cpu-v850_rh850.c: Likewise. * cpu-vax.c: Likewise. * cpu-visium.c: Likewise. * cpu-wasm32.c: Likewise. * cpu-xc16x.c: Likewise. * cpu-xgate.c: Likewise. * cpu-xstormy16.c: Likewise. * cpu-xtensa.c: Likewise. * cpu-z80.c: Likewise. * cpu-z8k.c: Likewise. gas * testsuite/gas/arm/pr24907.s: New test. * testsuite/gas/arm/pr24907.d: Expected disassembly.
2019-09-10 16:20:58 +02:00
2019-09-10 Nick Clifton <nickc@redhat.com>
PR 24907
* archures.c (bfd_arch_info_type): Add max_reloc_offset_into_insn
field.
(bfd_default_arch_struct): Initialise the new field.
* bfd-in2.h: Regenerate.
* cpu-aarch64.c: Initialise the new field.
* cpu-alpha.c: Likewise.
* cpu-arc.c: Likewise.
* cpu-arm.c: Likewise.
* cpu-avr.c: Likewise.
* cpu-bfin.c: Likewise.
* cpu-bpf.c: Likewise.
* cpu-cr16.c: Likewise.
* cpu-cr16c.c: Likewise.
* cpu-cris.c: Likewise.
* cpu-crx.c: Likewise.
* cpu-csky.c: Likewise.
* cpu-d10v.c: Likewise.
* cpu-d30v.c: Likewise.
* cpu-dlx.c: Likewise.
* cpu-epiphany.c: Likewise.
* cpu-fr30.c: Likewise.
* cpu-frv.c: Likewise.
* cpu-ft32.c: Likewise.
* cpu-h8300.c: Likewise.
* cpu-hppa.c: Likewise.
* cpu-i386.c: Likewise.
* cpu-ia64.c: Likewise.
* cpu-iamcu.c: Likewise.
* cpu-ip2k.c: Likewise.
* cpu-iq2000.c: Likewise.
* cpu-k1om.c: Likewise.
* cpu-l1om.c: Likewise.
* cpu-lm32.c: Likewise.
* cpu-m10200.c: Likewise.
* cpu-m10300.c: Likewise.
* cpu-m32c.c: Likewise.
* cpu-m32r.c: Likewise.
* cpu-m68hc11.c: Likewise.
* cpu-m68hc12.c: Likewise.
* cpu-m68k.c: Likewise.
* cpu-m9s12x.c: Likewise.
* cpu-m9s12xg.c: Likewise.
* cpu-mcore.c: Likewise.
* cpu-mep.c: Likewise.
* cpu-metag.c: Likewise.
* cpu-microblaze.c: Likewise.
* cpu-mips.c: Likewise.
* cpu-mmix.c: Likewise.
* cpu-moxie.c: Likewise.
* cpu-msp430.c: Likewise.
* cpu-mt.c: Likewise.
* cpu-nds32.c: Likewise.
* cpu-nfp.c: Likewise.
* cpu-nios2.c: Likewise.
* cpu-ns32k.c: Likewise.
* cpu-or1k.c: Likewise.
* cpu-pdp11.c: Likewise.
* cpu-pj.c: Likewise.
* cpu-plugin.c: Likewise.
* cpu-powerpc.c: Likewise.
* cpu-pru.c: Likewise.
* cpu-riscv.c: Likewise.
* cpu-rl78.c: Likewise.
* cpu-rs6000.c: Likewise.
* cpu-rx.c: Likewise.
* cpu-s12z.c: Likewise.
* cpu-s390.c: Likewise.
* cpu-score.c: Likewise.
* cpu-sh.c: Likewise.
* cpu-sparc.c: Likewise.
* cpu-spu.c: Likewise.
* cpu-tic30.c: Likewise.
* cpu-tic4x.c: Likewise.
* cpu-tic54x.c: Likewise.
* cpu-tic6x.c: Likewise.
* cpu-tic80.c: Likewise.
* cpu-tilegx.c: Likewise.
* cpu-tilepro.c: Likewise.
* cpu-v850.c: Likewise.
* cpu-v850_rh850.c: Likewise.
* cpu-vax.c: Likewise.
* cpu-visium.c: Likewise.
* cpu-wasm32.c: Likewise.
* cpu-xc16x.c: Likewise.
* cpu-xgate.c: Likewise.
* cpu-xstormy16.c: Likewise.
* cpu-xtensa.c: Likewise.
* cpu-z80.c: Likewise.
* cpu-z8k.c: Likewise.
2019-09-09 Phil Blundell <pb@pbcl.net>
binutils 2.33 branch created.
bfd_get_filename This macro says: /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ I reckon that isn't such a good idea since it can result in char* variables where const char* is appropriate. Not very many places need the char* cast. bfd/ * aout-target.h (object_p): Formatting. * bfd-in.h (bfd_get_filename): Don't cast to char*. * corefile.c (generic_core_file_matches_executable_p): Constify variables and remove cast. * bfd-in2.h: Regenerate. binutils/ * nm.c (print_object_filename_bsd, print_object_filename_sysv), (print_object_filename_posix, print_archive_filename_bsd), (print_archive_filename_sysv, print_archive_filename_posix), (print_archive_member_bsd, print_archive_member_sysv), (print_archive_member_posix): Constify parameter. (struct output_fns <print_object_filename, print_archive_filename>), (<print_archive_member>): Likewise. * objcopy.c (copy_archive): Add cast for make_tempdir. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify variable. * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise. gdb/ * coffread.c (coff_symfile_read): Constify filename variable. * dbxread.c (dbx_symfile_init, coffstab_build_psymtabs), (elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise. * gdb_bfd.c (gdb_bfd_close_or_warn): Likewise. * solib.c (reload_shared_libraries_1): Likewise. * symfile.c (reread_symbols): Likewise. * solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename. * solib-darwin.c (darwin_bfd_open): Likewise. * symfile-mem.c (symbol_file_add_from_memory): Likewise. sim/cris/ * sim-if.c (sim_open): Constify filename variable.
2019-09-06 04:37:05 +02:00
2019-09-06 Alan Modra <amodra@gmail.com>
* aout-target.h (object_p): Formatting.
* bfd-in.h (bfd_get_filename): Don't cast to char*.
* corefile.c (generic_core_file_matches_executable_p): Constify
variables and remove cast.
* bfd-in2.h: Regenerate.
PowerPC64 GOT_PCREL relocs PC-relative relocs typically use the addend in adjusting what they are relative to. For example: bcl 20,31,1f 1: mflr 12 addi 12,12,xxx-1b generates "R_PPC64_REL16 xxx+0x4" for the addi (when little-endian). The addend reflects the fact that you want the offset relative to the previous insn not the current one in this case. So the question is, will we ever want to do something like that for an instruction using R_PPC64_GOT_PCREL34? I thought so at the time I first implemented support in ld but at the time I think the hardware was possibly going to support pcrel+offset+reg addressing. In which case you might want something like: load_big_offset_into_r2 pld 3,sym-big_offset@got@pcrel(2) which would be a way of supporting more than 8G offsets from code to the GOT. We could do the same with load_big_offset_into_r2 pla 9,sym-big_offset@got@pcrel ldx 3,9,2 However, this is really a poor version of TOC-pointer relative code. So let's go with an addend on R_PPC64_GOT_PCREL34 meaning that sym+addend should be put in a GOT entry, and the relocation calculate the pc-relative offset to that GOT entry. Note that this is an extension to the ABI, which says (by the expression given for GOT relocs) that non-zero addends on GOT and PLT relocs are ignored. This is true for all GOT/PLT relocs, not just the pcrel ones. * elf64-ppc.c (ppc64_elf_check_relocs): Interpret an addend in GOT_PCREL and PLT_PCREL relocs as affecting the value stored in the GOT/PLT entry rather than affecting the offset to that GOI/PLT entry. (ppc64_elf_edit_toc, ppc64_elf_relocate_section): Likewise.
2019-09-05 02:36:42 +02:00
2019-09-05 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_check_relocs): Interpret an addend in
GOT_PCREL and PLT_PCREL relocs as affecting the value stored
in the GOT/PLT entry rather than affecting the offset to that
GOI/PLT entry.
(ppc64_elf_edit_toc, ppc64_elf_relocate_section): Likewise.
2019-09-05 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (xlate_pcrel_opt): Handle prefix loads and stores
in second instruction.
(ppc64_elf_relocate_section): Likewise.
2019-09-05 Alan Modra <amodra@gmail.com>
PR 24955
* libbfd-in.h (bfd_strdup): New inline function.
* archive.c (_bfd_get_elt_at_filepos): Use bfd_strdup. Close
bfd on error.
* elfcode.h (_bfd_elf_bfd_from_remote_memory): Use bfd_strdup.
* opncls.c (bfd_fopen): Use bfd_strdup. Close fd and stream
on error.
(bfd_openstreamr): Use bfd_strdup.
(bfd_openr_iovec, bfd_openw, bfd_create): Likewise.
* plugin.c (try_load_plugin): Use bfd_malloc.
* libbfd.h: Regenerate.
2019-09-02 Alan Modra <amodra@gmail.com>
PR 11983
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Free debug_filename
on success. Tidy.
(read_alt_indirect_string): Likewise.
(read_alt_indirect_ref): Likewise.
2019-08-31 Jim Wilson <jimw@sifive.com>
PR 23825
* elfnn-riscv.c (riscv_elf_create_dynamic_sections): Add SEC_LOAD,
SEC_DATA, and SEC_HAS_CONTENTS to .tdata.dyn section.
2019-08-30 Jim Wilson <jimw@sifive.com>
* elfnn-riscv.c (riscv_elf_relocate_section): For unresolvable reloc
error, call bfd_set_error, set ret to FALSE, and goto out label.
2019-08-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24951
* archive.c (_bfd_get_elt_at_filepos): Copy BFD_COMPRESS,
BFD_DECOMPRESS and BFD_COMPRESS_GABI flags for thin archive.
2019-08-29 Alan Modra <amodra@gmail.com>
PR 24697
* elf32-ppc.c (ppc_elf_check_relocs): Call bad_shared_reloc
when !bfd_link_executable for R_PPC_EMB_SDA2I16 and
R_PPC_EMB_SDA2REL. Don't call bad_shared_reloc for any other
reloc.
2019-08-29 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (xlate_pcrel_opt): Add poff parameter. Allow offset
on second insn, return it in poff.
(ppc64_elf_relocate_section): Add offset to paddi addend for
PCREL_OPT.
2019-08-28 Jim Wilson <jimw@sifive.com>
* elfnn-riscv.c (_bfd_riscv_relax_lui): Add check to exclude abs
section when setting max_alignment. Update comment.
(_bfd_riscv_relax_pc): Likewise.
2019-08-29 Alan Modra <amodra@gmail.com>
PR 24891
* bfd.c (struct bfd): Add no_element_cache.
* archive.c (_bfd_get_elt_at_filepos): Don't add element to
archive cache when no_element_cache.
(bfd_generic_archive_p): Set no_element_cache when opening first
element to check format. Close first element too.
(do_slurp_bsd_armap): Don't zero ardata->cache here.
* bfd-in2.h: Regenerate.
2019-08-24 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_edit_toc): Exclude undefined weak
symbols from GOT optimisation.
2019-08-23 Stafford Horne <shorne@gmail.com>
* elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Use correct value for
PLT GOT entries.
2019-08-23 Nick Clifton <nickc@redhat.com>
PR 24456
* elf.c (bfd_section_from_shdr): Issue an informative warning
message and continue processing other sections after encountering
a reloc section for a section which already has other relocs
associated with it.
2019-08-23 Alan Modra <amodra@gmail.com>
PR 24933
* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit
on error without freeing plts[] contents.
2019-08-22 Dennis Zhang <dennis.zhang@arm.com>
* cpu-arm.c: New entries for Cortex-M35P, Cortex-A77, Cortex-A76AE.
2019-08-22 Nick Clifton <nickc@redhat.com>
PR 24922
* pei-x86_64.c (pex64_xdata_print_uwd_codes): Add checks before
reading data from extra records.
AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602). This patch fixes a few linker crashes due to TLS code reaching an assert when it shouldn't. The first scenario is with weak TLS symbols that remain weak during linking. In this case the mid-end would not have seen a TLS symbol and so wouldn't have allocated the TLS section. We currently assert here and the linker crashes with a not very useful message. This patch changes this to return the value 0 for the TLS symbol in question emulating what lld and gold and other BFD targets do. However because weak TLS is implementation defined and we don't define any behavior for it I also emit a warning to the user to inform them of such. Secondly when a strong TLS reference is undefined. The linker crashes even after it correctly reported that there is an undefined reference. This changes it so that it gracefully exits and reports a useful error. bfd/ChangeLog: PR ld/24601 * elfnn-aarch64.c (aarch64_relocate): Handle weak TLS and undefined TLS. Also Pass input_bfd to _bfd_aarch64_elf_resolve_relocation. * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use it. * elfxx-aarch64.h (_bfd_aarch64_elf_resolve_relocation): Emit warning for weak TLS. ld/ChangeLog: PR ld/24601 * testsuite/ld-aarch64/aarch64-elf.exp (undef-tls, weak-tls): New. * testsuite/ld-aarch64/undef-tls.d: New test. * testsuite/ld-aarch64/undef-tls.s: New test. * testsuite/ld-aarch64/weak-tls.d: New test. * testsuite/ld-aarch64/weak-tls.s: New test.
2019-08-22 12:35:35 +02:00
2019-08-22 Tamar Christina <tamar.christina@arm.com>
PR ld/24601
* elfnn-aarch64.c (aarch64_relocate): Handle weak TLS and undefined TLS.
Also Pass input_bfd to _bfd_aarch64_elf_resolve_relocation.
* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use it.
* elfxx-aarch64.h (_bfd_aarch64_elf_resolve_relocation): Emit warning
for weak TLS.
2019-08-22 Alan Modra <amodra@gmail.com>
* elf32-arm.c (cmse_scan): Don't use ARM_GET_SYM_CMSE_SPCL,
instead recognize CMSE_PREFIX in symbol name.
(elf32_arm_gc_mark_extra_sections): Likewise.
(elf32_arm_filter_cmse_symbols): Don't test ARM_GET_SYM_CMSE_SPCL.
(elf32_arm_swap_symbol_in): Don't invoke ARM_SET_SYM_CMSE_SPCL.
2019-08-20 Dennis Zhang <dennis.zhang@arm.com>
* cpu-aarch64.c: New entries for Cortex-A34, Cortex-A65,
Cortex-A77, cortex-A65AE, and Cortex-A76AE.
Arm: Fix performance issue with thumb-2 tailcalls We currently use a padding NOP after a Thumb to Arm interworking veneer (BX pc). The NOP is never executed but may result in a performance penalty on some cores. For this reason this patch changes the NOPs after Thumb to Arm veneers into B .-2 and adds a note to this in the source code for future reference. bfd/ChangeLog: * elf32-arm.c (elf32_thumb2_plt_entry, elf32_arm_plt_thumb_stub, elf32_arm_stub_long_branch_v4t_thumb_thumb, elf32_arm_stub_long_branch_v4t_thumb_arm, elf32_arm_stub_short_branch_v4t_thumb_arm, elf32_arm_stub_long_branch_v4t_thumb_arm_pic, elf32_arm_stub_long_branch_v4t_thumb_thumb_pic, elf32_arm_stub_long_branch_v4t_thumb_tls_pic): Change nop to branch to previous instruction. ld/ChangeLog: * testsuite/ld-arm/cortex-a8-fix-b-plt.d: Update Testcase. * testsuite/ld-arm/cortex-a8-fix-b-rel-arm.d: Likewise. * testsuite/ld-arm/cortex-a8-fix-bcc-plt.d: Likewise. * testsuite/ld-arm/farcall-cond-thumb-arm.d: Likewise. * testsuite/ld-arm/farcall-mixed-app.d: Likewise. * testsuite/ld-arm/farcall-mixed-app2.d: Likewise. * testsuite/ld-arm/farcall-mixed-lib-v4t.d: Likewise. * testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d: Likewise. * testsuite/ld-arm/farcall-thumb-arm-short.d: Likewise. * testsuite/ld-arm/farcall-thumb-arm.d: Likewise. * testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise. * testsuite/ld-arm/farcall-thumb-thumb.d: Likewise. * testsuite/ld-arm/fix-arm1176-on.d: Likewise. * testsuite/ld-arm/ifunc-10.dd: Likewise. * testsuite/ld-arm/ifunc-2.dd: Likewise. * testsuite/ld-arm/ifunc-4.dd: Likewise. * testsuite/ld-arm/ifunc-6.dd: Likewise. * testsuite/ld-arm/ifunc-8.dd: Likewise. * testsuite/ld-arm/jump-reloc-veneers-long.d: Likewise. * testsuite/ld-arm/mixed-app.d: Likewise. * testsuite/ld-arm/thumb2-b-interwork.d: Likewise. * testsuite/ld-arm/tls-longplt.d: Likewise. * testsuite/ld-arm/tls-thumb1.d: Likewise.
2019-08-20 17:34:26 +02:00
2019-08-20 Tamar Christina <tamar.christina@arm.com>
* elf32-arm.c (elf32_thumb2_plt_entry, elf32_arm_plt_thumb_stub,
elf32_arm_stub_long_branch_v4t_thumb_thumb,
elf32_arm_stub_long_branch_v4t_thumb_arm,
elf32_arm_stub_short_branch_v4t_thumb_arm,
elf32_arm_stub_long_branch_v4t_thumb_arm_pic,
elf32_arm_stub_long_branch_v4t_thumb_thumb_pic,
elf32_arm_stub_long_branch_v4t_thumb_tls_pic): Change nop to branch to
previous instruction.
2019-08-19 Tom Tromey <tromey@adacore.com>
* dwarf2.c (_bfd_dwarf2_find_symbol_bias): Create hash table
holding symbols.
2019-08-19 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (struct ppc64_elf_obj_tdata): Rename has_gotrel
to has_optrel.
(struct _ppc64_elf_section_data): Likewise.
(ppc64_elf_check_relocs): Set has_optrel for more relocs.
(ppc64_elf_edit_toc): Do ha/lo insn checks in GOT loop rather
than TOC loop. Check PLT16 insns too.
2019-08-16 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24905
* elf64-x86-64.c (elf_x86_64_check_relocs): Move PIC check for
PC-relative relocations back to ...
(elf_x86_64_relocate_section): Here.
2019-08-16 Martin Liska <mliska@suse.cz>
PR ld/24912
* elflink.c: Report error only for not relocatable.
* linker.c (_bfd_generic_link_add_one_symbol): Do not handle
here lto_slim_object as it's handled in caller.
2019-08-16 Alan Modra <amodra@gmail.com>
* elf32-ppc.c (ppc_elf_relocate_section): Optimize unaligned relocs.
2019-08-15 Jim Wilson <jimw@sifive.com>
* elfnn-riscv.c (perform_relocation) <R_RISCV_RVC_LUI>: If
RISCV_CONST_HIGH_PART (value) is zero, then convert c.lui instruction
to c.li instruction, and use ENCODE_RVC_IMM to set value.
2019-08-15 Tom Tromey <tromey@adacore.com>
* dwarf2.c (scan_unit_for_symbols): Check for end of CU, not end
of section.
2019-08-14 Alan Modra <amodra@gmail.com>
PR 24623
* dwarf2.c (stash_comp_unit): New function, extracted from..
(_bfd_dwarf2_find_nearest_line): ..here.
(find_abstract_instance): Parse comp units and decode line info
as needed.
2019-08-14 Alan Modra <amodra@gmail.com>
* dwarf2.c (comp_unit_maybe_decode_line_info): Declare.
(comp_unit_find_nearest_line): Use it here..
(_bfd_dwarf2_find_symbol_bias): ..and here.
2019-08-14 Alan Modra <amodra@gmail.com>
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove addr_size parameter.
* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
* coffgen.c (coff_find_nearest_line_with_names): Adjust
_bfd_dwarf2_find_nearest_line calls.
* elf.c (_bfd_elf_find_nearest_line, _bfd_elf_find_line): Likewise.
* elf32-arm.c (elf32_arm_find_nearest_line): Likewise.
* elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_find_nearest_line): Likewise.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
* mach-o.c (bfd_mach_o_find_nearest_line): Likewise.
* libbfd.h: Regenerate.
Add support for a MIPS specific .MIPS.xhash section. This patch is a reimplementation of [1] which was submitted in 2015 by Neil Schellenberger. Copyright issue was sorted out [2] last year. It proposed a new section (.gnu.xhash) and related dynamic tag (DT_GNU_XHASH). The new section would be virtually identical to the existing .gnu.hash except for the translation table (xlat) which would contain correct MIPS .dynsym indexes corresponding to the hashvals in chains. This is because MIPS ABI imposes a different ordering on the dynsyms than the one expected by the .gnu.hash section. Another addition would be a leading word (ngnusyms) which would contain the number of entries in the translation table. In this patch, the new section name and dynamic tag are changed to reflect the fact that the section should be treated as MIPS-specific (.MIPS.xhash and DT_MIPS_XHASH). This patch addresses the alignment issue as reported in [3], which is caused by the leading word added to the .MIPS.xhash section. Leading word is removed in this patch, and the number of entries in the translation table is now calculated using DT_MIPS_SYMTABNO dynamic tag (this is addressed by the corresponding glibc patch). Suggestions on coding style in [4] were taken into account. Existing GNU hash testcase was covered, and another one was added in the MIPS part of the testsuite. The other major change is reserving MIPS ABI version 5 for .MIPS.xhash, marking the need of support for .MIPS.xhash in the dynamic linker (again, addressed in the corresponding glibc patch). This is something which I am not sure of, especially after reading [5]. I am confused on whether this ABI version is reserved for IFUNC, or it can be used for this purpose. Already mentioned glibc patch is submitted at: https://sourceware.org/ml/libc-alpha/2019-06/msg00456.html [1] https://sourceware.org/ml/binutils/2015-10/msg00057.html [2] https://sourceware.org/ml/binutils/2018-03/msg00025.html [3] https://sourceware.org/ml/binutils/2016-01/msg00006.html [4] https://sourceware.org/ml/binutils/2016-02/msg00097.html [5] https://sourceware.org/ml/libc-alpha/2016-12/msg00853.html ld * emulparams/elf32bmip.sh: Add .MIPS.xhash section. * emulparams/elf32bmipn32-defs.sh: Add .MIPS.xhash section. * emulparams/elf64bmip-defs.sh: Add .MIPS.xhash section. * emultempl/mipself.em: Remove mips_after_parse function. * testsuite/ld-elf/hash.d: Update comment. * testsuite/ld-mips-elf/hash1.d: New test. * testsuite/ld-mips-elf/hash1.s: Ditto. * testsuite/ld-mips-elf/hash1a.d: Remove. * testsuite/ld-mips-elf/hash1b.d: Ditto. * testsuite/ld-mips-elf/hash1c.d: Ditto * testsuite/ld-mips-elf/hash2.d: New test. * testsuite/ld-mips-elf/mips-elf.exp: New tests. * testsuite/ld-mips-elf/start.s: New test. bfd * elf-bfd.h (struct elf_backend_data): New members. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .gnu.hash section if necessary. (struct collect_gnu_hash_codes): New member. (elf_gnu_hash_process_symidx): New function name. (elf_renumber_gnu_hash_syms): Ignore local and undefined symbols. Record xlat location for every symbol which should have a .MIPS.xhash entry. (bfd_elf_size_dynamic_sections): Add DT_GNU_HASH dynamic tag to dynamic section if necessary. (GNU_HASH_SECTION_NAME): New define. (bfd_elf_size_dynsym_hash_dynstr): Get .MIPS.xhash section. Update the section size info. * elfxx-mips.c (struct mips_elf_hash_sort_data): New members. (struct mips_elf_link_hash_entry): New member. (mips_elf_link_hash_newfunc): Initialize .MIPS.xhash translation table location. (mips_elf_sort_hash_table): Initialize the pointer to the .MIPS.xhash section. (mips_elf_sort_hash_table_f): Populate the .MIPS.xhash translation table entry with the symbol dynindx. (_bfd_mips_elf_section_from_shdr): Add SHT_MIPS_XHASH. (_bfd_mips_elf_fake_sections): Initialize .MIPS.xhash section info. (_bfd_mips_elf_create_dynamic_sections): Create .MIPS.xhash section. (_bfd_mips_elf_size_dynamic_sections): Add DT_MIPS_XHASH tag to dynamic section. (_bfd_mips_elf_finish_synamic_sections): Add DT_MIPS_XHASH. (_bfd_mips_elf_final_write_processing): Set .MIPS.xhash section sh_link info. (_bfd_mips_elf_get_target_dtag): Get DT_MIPS_XHASH tag. (MIPS_LIBC_ABI_XHASH): New ABI version enum value. (_bfd_mips_post_process_headers): Mark the ABI version as MIPS_LIBC_ABI_XHASH if there exists a .MIPS.xhash section, but not a .hash section. (_bfd_mips_elf_record_xhash_symbol): New function. Record a position in the translation table, associated with the hash entry. * elfxx-mips.h (literal_reloc_p): Define elf_backend_record_xhash_symbol backend hook. * elfxx-target.h: Initialize elf_backend_record_xhash_symbol backend hook. include * elf/mips.h (SHT_GNU_XHASH): New define. (DT_GNU_XHASH): New define. binutils * readelf.c (get_mips_dynamic_type): Return MIPS_XHASH dynamic type. (get_mips_section_type_name): Return MI{S_XHASH name string. (dynamic_section_mips_val): Initialize the .MIPS.xhash dynamic info. (process_symbol_table): Initialize the .MIPS.xhash section pointer. Adjust the readelf output to support the new section. (process_object): Set the .MIPS.xhash dynamic info to zero.
2019-08-09 12:06:37 +02:00
2019-08-09 Mihailo Stojanovic <mihailo.stojanovic@rt-rk.com>
* elf-bfd.h (struct elf_backend_data): New members.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Create
.gnu.hash section if necessary.
(struct collect_gnu_hash_codes): New member.
(elf_gnu_hash_process_symidx): New function name.
(elf_renumber_gnu_hash_syms): Ignore local and undefined
symbols. Record xlat location for every symbol which should have
a .MIPS.xhash entry.
(bfd_elf_size_dynamic_sections): Add DT_GNU_HASH dynamic tag to
dynamic section if necessary.
(GNU_HASH_SECTION_NAME): New define.
(bfd_elf_size_dynsym_hash_dynstr): Get .MIPS.xhash section.
Update the section size info.
* elfxx-mips.c (struct mips_elf_hash_sort_data): New members.
(struct mips_elf_link_hash_entry): New member.
(mips_elf_link_hash_newfunc): Initialize .MIPS.xhash translation
table location.
(mips_elf_sort_hash_table): Initialize the pointer to the
.MIPS.xhash section.
(mips_elf_sort_hash_table_f): Populate the .MIPS.xhash
translation table entry with the symbol dynindx.
(_bfd_mips_elf_section_from_shdr): Add SHT_MIPS_XHASH.
(_bfd_mips_elf_fake_sections): Initialize .MIPS.xhash section
info.
(_bfd_mips_elf_create_dynamic_sections): Create .MIPS.xhash
section.
(_bfd_mips_elf_size_dynamic_sections): Add DT_MIPS_XHASH tag to
dynamic section.
(_bfd_mips_elf_finish_synamic_sections): Add DT_MIPS_XHASH.
(_bfd_mips_elf_final_write_processing): Set .MIPS.xhash section
sh_link info.
(_bfd_mips_elf_get_target_dtag): Get DT_MIPS_XHASH tag.
(MIPS_LIBC_ABI_XHASH): New ABI version enum value.
(_bfd_mips_post_process_headers): Mark the ABI version as
MIPS_LIBC_ABI_XHASH if there exists a .MIPS.xhash section,
but not a .hash section.
(_bfd_mips_elf_record_xhash_symbol): New function. Record a
position in the translation table, associated with the hash
entry.
* elfxx-mips.h (literal_reloc_p): Define
elf_backend_record_xhash_symbol backend hook.
* elfxx-target.h: Initialize elf_backend_record_xhash_symbol
backend hook.
2019-08-07 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf64-bpf.c (bpf_elf_relocate_section): New function.
(bpf_elf_insn_disp_reloc): Delete function.
(elf_backend_relocate_section): Define.
2019-08-07 Alan Modra <amodra@gmail.com>
PR 24644
* archive64.c (_bfd_archive_64_bit_slurp_armap): Properly check
for overflow in expressions involving nsymz.
2019-08-01 Ilia Diachkov <ilia.diachkov@optimitech.com>
* elfnn-riscv.c (_bfd_riscv_relax_lui): Set lui relax safety area to
two pages in relro presence.
2019-08-01 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (insn_num_slots, get_rsr_lend_opcode)
(get_wsr_lbeg_opcode): New functions.
(check_loop_aligned): Detect relaxed loops and adjust loop_len
and insn_len for the first actual instruction of the loop.
2019-07-30 Alan Modra <amodra@gmail.com>
PR 24768
* bfd.c (struct bfd): Add lto_slim_object flag.
* bfd-in2.h: Regenerate.
2019-07-29 Martin Liska <mliska@suse.cz>
PR 24768
* archive.c (_bfd_compute_and_write_armap): Come up with
report_plugin_err variable.
* bfd-in2.h (struct bfd): Add lto_slim_object flag.
* elf.c (struct lto_section): New.
(_bfd_elf_make_section_from_shdr): Parse content of
.gnu_lto_.lto section.
* elflink.c: Report error for a missing LTO plugin.
* linker.c (_bfd_generic_link_add_one_symbol): Likewise.
2019-07-28 Alan Modra <amodra@gmail.com>
PR 24857
PR 24339
* elflink.c (elf_link_add_object_symbols): Report an informative
error on finding local symbols with index equal or greater than
symbol table sh_info. Correct comment. Allow such symbols in
dynamic objects. Abort on NULL section for symbol.
2019-07-26 Alan Modra <amodra@gmail.com>
* elf-bfd.h (struct output_elf_obj_tdata): Delete "linker" field.
(elf_linker): Don't define.
* elflink.c (bfd_elf_final_link): Don't set elf_linker.
2019-07-25 YunQiang Su <syq@debian.org>
PR 24832
* elfxx-mips.c (mips_set_isa_flags): Default to MIPS 3 for 64-bit
mips inputs.
2019-07-24 Claudiu Zissulescu <claziss@synopsys.com>
* elf32-arc.c (bfd_get_32_me): Add a small description, fix
formating.
(reloc_type_to_name): Fix formating.
(arc_elf_object_p): Likewise.
(debug_arc_reloc): Likewise.
(arc_do_relocation): Likewise.
2019-07-24 Claudiu Zissulescu <claziss@synopsys.com>
* elf32-arc.c (bfd_get_32_me): New function.
(bfd_put_32_me): Likewise.
(arc_elf_relax_section): Likewise.
(bfd_elf32_bfd_relax_section): Define.
Complain about mbind, ifunc, and unique in final_write It's not as good as complaining in gas/config/obj-elf.c since you lose any reference to the source file. bfd/ * elf-bfd.h (struct elf_backend_data): Return bfd_boolean from elf_backend_final_write_processing, don't pass linker arg. (_bfd_elf_final_write_processing): Update prototype. * elf.c (_bfd_elf_write_object_contents): Adjust call. (_bfd_elf_final_write_processing): Return error on incompatible OSABI and has_gnu_osabi. Remove linker arg. * elf-nacl.h (nacl_final_write_processing): Update prototype. * elf-vxworks.h (elf_vxworks_final_write_processing): Likewise. * elfxx-mips.h (_bfd_mips_final_write_processing): Likewise. (_bfd_mips_elf_final_write_processing): Likewise. * elf-hppa.h (elf_hppa_final_write_processing): Return status and remove linker arg. * elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise. * elf-nacl.c (nacl_final_write_processing): Likewise. * elf-vxworks.c (elf_vxworks_final_write_processing): Likewise. * elf32-arc.c (arc_elf_final_write_processing): Likewise. * elf32-arm.c (arm_final_write_processing): Likewise. (elf32_arm_final_write_processing): Likewise. (elf32_arm_nacl_final_write_processing): Likewise. (elf32_arm_vxworks_final_write_processing): Likewise. * elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise. * elf32-bfin.c (elf32_bfin_final_write_processing): Likewise. * elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise. * elf32-cris.c (cris_elf_final_write_processing): Likewise. * elf32-h8300.c (elf32_h8_final_write_processing): Likewise. * elf32-lm32.c (lm32_elf_final_write_processing): Likewise. * elf32-m32r.c (m32r_elf_final_write_processing): Likewise. * elf32-m68k.c (elf_m68k_final_write_processing): Likewise. * elf32-mips.c (mips_vxworks_final_write_processing): Likewise. * elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise. * elf32-nds32.c (nds32_elf_final_write_processing): Likewise. * elf32-or1k.c (or1k_elf_final_write_processing): Likewise. * elf32-pj.c (pj_elf_final_write_processing): Likewise. * elf32-ppc.c (ppc_final_write_processing): Likewise. (ppc_elf_final_write_processing): Likewise. (ppc_elf_vxworks_final_write_processing): Likewise. * elf32-sparc.c (sparc_final_write_processing): Likewise. (elf32_sparc_final_write_processing): Likewise. (elf32_sparc_vxworks_final_write_processing): Likewise. * elf32-v850.c (v850_elf_final_write_processing): Likewise. * elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise. * elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise. * elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise. * elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise. * elfxx-mips.c (_bfd_mips_final_write_processing): Likewise. (_bfd_mips_elf_final_write_processing): Likewise. gas/ * config/obj-elf.c (obj_elf_section, obj_elf_type): Set has_gnu_osabi. * testsuite/gas/elf/section12a.d: Update xfails. * testsuite/gas/elf/section12b.d: Likewise.
2019-07-24 02:13:30 +02:00
2019-07-24 Alan Modra <amodra@gmail.com>
* elf-bfd.h (struct elf_backend_data): Return bfd_boolean from
elf_backend_final_write_processing, don't pass linker arg.
(_bfd_elf_final_write_processing): Update prototype.
* elf.c (_bfd_elf_write_object_contents): Adjust call.
(_bfd_elf_final_write_processing): Return error on incompatible
OSABI and has_gnu_osabi. Remove linker arg.
* elf-nacl.h (nacl_final_write_processing): Update prototype.
* elf-vxworks.h (elf_vxworks_final_write_processing): Likewise.
* elfxx-mips.h (_bfd_mips_final_write_processing): Likewise.
(_bfd_mips_elf_final_write_processing): Likewise.
* elf-hppa.h (elf_hppa_final_write_processing): Return status
and remove linker arg.
* elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise.
* elf-nacl.c (nacl_final_write_processing): Likewise.
* elf-vxworks.c (elf_vxworks_final_write_processing): Likewise.
* elf32-arc.c (arc_elf_final_write_processing): Likewise.
* elf32-arm.c (arm_final_write_processing): Likewise.
(elf32_arm_final_write_processing): Likewise.
(elf32_arm_nacl_final_write_processing): Likewise.
(elf32_arm_vxworks_final_write_processing): Likewise.
* elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise.
* elf32-bfin.c (elf32_bfin_final_write_processing): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise.
* elf32-cris.c (cris_elf_final_write_processing): Likewise.
* elf32-h8300.c (elf32_h8_final_write_processing): Likewise.
* elf32-lm32.c (lm32_elf_final_write_processing): Likewise.
* elf32-m32r.c (m32r_elf_final_write_processing): Likewise.
* elf32-m68k.c (elf_m68k_final_write_processing): Likewise.
* elf32-mips.c (mips_vxworks_final_write_processing): Likewise.
* elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise.
* elf32-nds32.c (nds32_elf_final_write_processing): Likewise.
* elf32-or1k.c (or1k_elf_final_write_processing): Likewise.
* elf32-pj.c (pj_elf_final_write_processing): Likewise.
* elf32-ppc.c (ppc_final_write_processing): Likewise.
(ppc_elf_final_write_processing): Likewise.
(ppc_elf_vxworks_final_write_processing): Likewise.
* elf32-sparc.c (sparc_final_write_processing): Likewise.
(elf32_sparc_final_write_processing): Likewise.
(elf32_sparc_vxworks_final_write_processing): Likewise.
* elf32-v850.c (v850_elf_final_write_processing): Likewise.
* elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise.
* elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
* elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise.
* elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise.
* elfxx-mips.c (_bfd_mips_final_write_processing): Likewise.
(_bfd_mips_elf_final_write_processing): Likewise.
2019-07-24 Alan Modra <amodra@gmail.com>
* elf-vxworks.c (elf_vxworks_final_write_processing): Don't return
early.
* elf32-arc.c (arc_elf_final_write_processing): Likewise.
* elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
2019-07-24 Alan Modra <amodra@gmail.com>
* elf32-visium.c (visium_elf_post_process_headers): Don't set
EI_OSABI header byte here.
(ELF_OSABI): Define.
SHF_GNU_MBIND requires ELFOSABI_GNU When SHF_GNU_MBIND was added in the SHF_LOOS to SHF_HIOS range, it should have required ELFOSABI_GNU since these flags are already in use by other OSes. HPUX SHF_HP_TLS in fact has the same value. That means no place in binutils should test SHF_GNU_MBIND without first checking OSABI, and SHF_GNU_MBIND should not be set without also setting OSABI. At least, that's the ideal, but the patch accepts SHF_GNU_MBIND on ELFOSABI_NONE object files since gas didn't always set OSABI. However, to reinforce the fact that SHF_GNU_MBIND isn't proper without a non-zero OSABI, readelf will display the flag as LOOS+0 if OSABI isn't set. The clash with SHF_HP_TLS means that hppa64-linux either has that flag on .tbss sections or supports GNU_MBIND, not both. (hppa64-linux users, if there are any, may have noticed that GNU ld since 2017 mysteriously aligned their .tbss sections to a 4k boundary. That was one consequence of SHF_HP_TLS being blindly interpreted as SHF_GNU_MBIND.) Since it seems that binutils, gdb, gcc, glibc, and the linux kernel don't care about SHF_HP_TLS I took that flag out of .tbss for hppa64-linux. bfd/ * elf-bfd.h (enum elf_gnu_osabi): Add elf_gnu_osabi_mbind. * elf.c (_bfd_elf_make_section_from_shdr): Set elf_gnu_osabi_mbind. (get_program_header_size): Formatting. Only test SH_GNU_MBIND when elf_gnu_osabi_mbind is set. (_bfd_elf_map_sections_to_segments): Likewise. (_bfd_elf_init_private_section_data): Likewise. (_bfd_elf_final_write_processing): Update comment. * elf64-hppa.c (elf64_hppa_special_sections): Move .tbss entry. (elf_backend_special_sections): Define without .tbss for linux. binutils/ * readelf.c (get_parisc_segment_type): Split off hpux entries.. (get_ia64_segment_type): ..and these.. (get_hpux_segment_type): ..to here. (get_segment_type): Condition GNU_MBIND on osabi. Use get_hpux_segment_type. (get_symbol_binding): Do not print UNIQUE for ELFOSABI_NONE. (get_symbol_type): Do not print IFUNC for ELFOSABI_NONE. gas/ * config/obj-elf.c (obj_elf_change_section): Don't emit a fatal error for non-SHF_ALLOC SHF_GNU_MBIND here. (obj_elf_parse_section_letters): Return SHF_GNU_MBIND in new gnu_attr param. (obj_elf_section): Adjust obj_elf_parse_section_letters call. Formatting. Set SHF_GNU_MBIND and elf_osabi from gnu_attr. Emit normal error for non-SHF_ALLOC SHF_GNU_MBIND and wrong osabi. (obj_elf_type): Set elf_osabi for ifunc. * testsuite/gas/elf/section12a.d: xfail msp430 and hpux. * testsuite/gas/elf/section12b.d: Likewise. * testsuite/gas/elf/section13.d: Likewise. * testsuite/gas/elf/section13.l: Adjust expected error. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Condition SHF_GNU_MBIND on osabi. Set output elf_gnu_osabi_mbind.
2019-07-23 10:24:42 +02:00
2019-07-23 Alan Modra <amodra@gmail.com>
* elf-bfd.h (enum elf_gnu_osabi): Add elf_gnu_osabi_mbind.
* elf.c (_bfd_elf_make_section_from_shdr): Set elf_gnu_osabi_mbind.
(get_program_header_size): Formatting. Only test SH_GNU_MBIND
when elf_gnu_osabi_mbind is set.
(_bfd_elf_map_sections_to_segments): Likewise.
(_bfd_elf_init_private_section_data): Likewise.
(_bfd_elf_final_write_processing): Update comment.
* elf64-hppa.c (elf64_hppa_special_sections): Move .tbss entry.
(elf_backend_special_sections): Define without .tbss for linux.
ELF final_write_processing Move setting of OSABI to final_write_processing, after symbols are written. This allows OSABI to be set based on symbols actually written to the output rather than assuming input symbols will be output. Corrects object files such as the one generated on powerpc64le-linux by ld-powerpc/pr23927.s which has a local STT_GNU_IFUNC symbol but prior to this patch the file was marked ELFOSABI_NONE. * elf-bfd.h (enum elf_gnu_osabi): Rename from elf_gnu_symbols. Remove none, any, all enums. (struct elf_obj_tdata): Rename has_gnu_symbols field to has_gnu_osabi. (_bfd_elf_final_write_processing): Declare. * elf.c (_bfd_elf_write_object_contents): Unconditionally call elf_backend_final_write_processing. (_bfd_elf_post_process_headers): Move body of function to.. (_bfd_elf_final_write_processing): ..here, but set EI_OSABI byte only when not already set. Adjust for rename. * elfxx-target.h (elf_backend_final_write_processing): Default to _bfd_elf_final_write_processing. * elf-hppa.h (elf_hppa_final_write_processing): Call _bfd_elf_final_write_processing. * elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise. * elf-nacl.c (nacl_final_write_processing): Likewise. * elf-vxworks.c (elf_vxworks_final_write_processing): Likewise. * elf32-arc.c (arc_elf_final_write_processing): Likewise. * elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise. * elf32-bfin.c (elf32_bfin_final_write_processing): Likewise. * elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise. * elf32-cris.c (cris_elf_final_write_processing): Likewise. * elf32-h8300.c (elf32_h8_final_write_processing): Likewise. * elf32-lm32.c (lm32_elf_final_write_processing): Likewise. * elf32-m32r.c (m32r_elf_final_write_processing): Likewise. * elf32-m68k.c (elf_m68k_final_write_processing): Likewise. * elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise. * elf32-nds32.c (nds32_elf_final_write_processing): Likewise. * elf32-or1k.c (or1k_elf_final_write_processing): Likewise. * elf32-pj.c (pj_elf_final_write_processing): Likewise. * elf32-v850.c (v850_elf_final_write_processing): Likewise. * elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise. * elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise. * elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise. * elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise. * elf32-arm.c (arm_final_write_processing): Split out from.. (elf32_arm_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (elf32_arm_nacl_final_write_processing): Adjust. * elfxx-mips.c (_bfd_mips_final_write_processing): Split out from.. (_bfd_mips_elf_final_write_processing): ..here. Call _bfd_elf_final_write_processing. * elfxx-mips.h (_bfd_mips_final_write_processing): Declare. * elf32-mips.c (mips_vxworks_final_write_processing): Adjust. * elf32-ppc.c (ppc_final_write_processing): Split out from.. (ppc_elf_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (ppc_elf_vxworks_final_write_processing): Adjust. * elf32-sparc.c (sparc_final_write_processing): Split out from.. (elf32_sparc_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (elf32_sparc_vxworks_final_write_processing): Adjust. * elf32-d10v.c (elf_backend_final_write_processing): Don't define. * elf32-d30v.c (elf_backend_final_write_processing): Don't define. * elf32-m68hc11.c (elf_backend_final_write_processing): Don't define. * elf32-m68hc12.c (elf_backend_final_write_processing): Don't define. * elf32-s12z.c (elf_backend_final_write_processing): Don't define. * elf32-i386.c (elf_i386_check_relocs): Don't set has_gnu_symbols. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elflink.c (elf_link_add_object_symbols): Likewise. (elf_link_output_symstrtab): Set has_gnu_osabi for symbols here instead.
2019-07-23 10:16:38 +02:00
2019-07-23 Alan Modra <amodra@gmail.com>
* elf-bfd.h (enum elf_gnu_osabi): Rename from elf_gnu_symbols.
Remove none, any, all enums.
(struct elf_obj_tdata): Rename has_gnu_symbols field to has_gnu_osabi.
(_bfd_elf_final_write_processing): Declare.
* elf.c (_bfd_elf_write_object_contents): Unconditionally call
elf_backend_final_write_processing.
(_bfd_elf_post_process_headers): Move body of function to..
(_bfd_elf_final_write_processing): ..here, but set EI_OSABI byte
only when not already set. Adjust for rename.
* elfxx-target.h (elf_backend_final_write_processing): Default to
_bfd_elf_final_write_processing.
* elf-hppa.h (elf_hppa_final_write_processing): Call
_bfd_elf_final_write_processing.
* elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise.
* elf-nacl.c (nacl_final_write_processing): Likewise.
* elf-vxworks.c (elf_vxworks_final_write_processing): Likewise.
* elf32-arc.c (arc_elf_final_write_processing): Likewise.
* elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise.
* elf32-bfin.c (elf32_bfin_final_write_processing): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise.
* elf32-cris.c (cris_elf_final_write_processing): Likewise.
* elf32-h8300.c (elf32_h8_final_write_processing): Likewise.
* elf32-lm32.c (lm32_elf_final_write_processing): Likewise.
* elf32-m32r.c (m32r_elf_final_write_processing): Likewise.
* elf32-m68k.c (elf_m68k_final_write_processing): Likewise.
* elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise.
* elf32-nds32.c (nds32_elf_final_write_processing): Likewise.
* elf32-or1k.c (or1k_elf_final_write_processing): Likewise.
* elf32-pj.c (pj_elf_final_write_processing): Likewise.
* elf32-v850.c (v850_elf_final_write_processing): Likewise.
* elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise.
* elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
* elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise.
* elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise.
* elf32-arm.c (arm_final_write_processing): Split out from..
(elf32_arm_final_write_processing): ..here. Call
_bfd_elf_final_write_processing.
(elf32_arm_nacl_final_write_processing): Adjust.
* elfxx-mips.c (_bfd_mips_final_write_processing): Split out from..
(_bfd_mips_elf_final_write_processing): ..here. Call
_bfd_elf_final_write_processing.
* elfxx-mips.h (_bfd_mips_final_write_processing): Declare.
* elf32-mips.c (mips_vxworks_final_write_processing): Adjust.
* elf32-ppc.c (ppc_final_write_processing): Split out from..
(ppc_elf_final_write_processing): ..here. Call
_bfd_elf_final_write_processing.
(ppc_elf_vxworks_final_write_processing): Adjust.
* elf32-sparc.c (sparc_final_write_processing): Split out from..
(elf32_sparc_final_write_processing): ..here. Call
_bfd_elf_final_write_processing.
(elf32_sparc_vxworks_final_write_processing): Adjust.
* elf32-d10v.c (elf_backend_final_write_processing): Don't define.
* elf32-d30v.c (elf_backend_final_write_processing): Don't define.
* elf32-m68hc11.c (elf_backend_final_write_processing): Don't define.
* elf32-m68hc12.c (elf_backend_final_write_processing): Don't define.
* elf32-s12z.c (elf_backend_final_write_processing): Don't define.
* elf32-i386.c (elf_i386_check_relocs): Don't set has_gnu_symbols.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elflink.c (elf_link_add_object_symbols): Likewise.
(elf_link_output_symstrtab): Set has_gnu_osabi for symbols here
instead.
2019-07-23 Omar Majid <omajid@redhat.com>
* coffcode.h (coff_set_arch_mach_hook): Handle I386_APPLE_MAGIC,
I386_FREEBSD_MAGIC, I386_LINUX_MAGIC, I386_NETBSD_MAGIC,
AMD64_APPLE_MAGIC, AMD64_FREEBSD_MAGIC, AMD64_LINUX_MAGIC,
AMD64_NETBSD_MAGIC.
* peXXigen.c: Add comment about source of .NET magic numbers.
[PowerPC64] pc-relative TLS relocations This patch supports using pcrel instructions in TLS code sequences. A number of new relocations are needed, gas operand modifiers to generate those relocations, and new TLS optimisation. For optimisation it turns out that the new pcrel GD and LD sequences can be distinguished from the non-pcrel GD and LD sequences by there being different relocations on the new sequence. The final "add ra,rb,13" on IE sequences similarly needs a new relocation, or as I chose, a modification of R_PPC64_TLS. On pcrel IE code, the R_PPC64_TLS points one byte into the "add" instruction rather than being on the instruction boundary. GD: pla 3,z@got@tlsgd@pcrel # R_PPC64_GOT_TLSGD34 bl __tls_get_addr@notoc(z@tlsgd) # R_PPC64_TLSGD and R_PPC64_REL24_NOTOC edited to IE pld 3,z@got@tprel@pcrel add 3,3,13 edited to LE paddi 3,13,z@tprel nop LD: pla 3,z@got@tlsld@pcrel # R_PPC64_GOT_TLSLD34 bl __tls_get_addr@notoc(z@tlsld) # R_PPC64_TLSLD and R_PPC64_REL24_NOTOC .. paddi 9,3,z2@dtprel pld 10,z3@got@dtprel@pcrel add 10,10,3 edited to LE paddi 3,13,0x1000 nop IE: pld 9,z@got@tprel@pcrel # R_PPC64_GOT_TPREL34 add 3,9,z@tls@pcrel # R_PPC64_TLS at insn+1 ldx 4,9,z@tls@pcrel lwax 5,9,z@tls@pcrel stdx 5,9,z@tls@pcrel edited to LE paddi 9,13,z@tprel nop ld 4,0(9) lwa 5,0(9) std 5,0(9) LE: paddi 10,13,z@tprel include/ * elf/ppc64.h (R_PPC64_TPREL34, R_PPC64_DTPREL34), (R_PPC64_GOT_TLSGD34, R_PPC64_GOT_TLSLD34), (R_PPC64_GOT_TPREL34, R_PPC64_GOT_DTPREL34): Define. (IS_PPC64_TLS_RELOC): Include new tls relocs. bfd/ * reloc.c (BFD_RELOC_PPC64_TPREL34, BFD_RELOC_PPC64_DTPREL34), (BFD_RELOC_PPC64_GOT_TLSGD34, BFD_RELOC_PPC64_GOT_TLSLD34), (BFD_RELOC_PPC64_GOT_TPREL34, BFD_RELOC_PPC64_GOT_DTPREL34), (BFD_RELOC_PPC64_TLS_PCREL): New pcrel tls relocs. * elf64-ppc.c (ppc64_elf_howto_raw): Add howtos for pcrel tls relocs. (ppc64_elf_reloc_type_lookup): Translate pcrel tls relocs. (must_be_dyn_reloc, dec_dynrel_count): Add R_PPC64_TPREL64. (ppc64_elf_check_relocs): Support pcrel tls relocs. (ppc64_elf_tls_optimize, ppc64_elf_relocate_section): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-ppc.c (ppc_elf_suffix): Map "tls@pcrel", "got@tlsgd@pcrel", "got@tlsld@pcrel", "got@tprel@pcrel", and "got@dtprel@pcrel". (fixup_size, md_assemble): Handle pcrel tls relocs. (ppc_force_relocation, ppc_fix_adjustable): Likewise. (md_apply_fix, tc_gen_reloc): Likewise. ld/ * testsuite/ld-powerpc/tlsgd.d, * testsuite/ld-powerpc/tlsgd.s, * testsuite/ld-powerpc/tlsie.d, * testsuite/ld-powerpc/tlsie.s, * testsuite/ld-powerpc/tlsld.d, * testsuite/ld-powerpc/tlsld.s: New tests. * testsuite/ld-powerpc/powerpc.exp: Run them.
2019-07-19 08:06:58 +02:00
2019-07-19 Alan Modra <amodra@gmail.com>
* reloc.c (BFD_RELOC_PPC64_TPREL34, BFD_RELOC_PPC64_DTPREL34),
(BFD_RELOC_PPC64_GOT_TLSGD34, BFD_RELOC_PPC64_GOT_TLSLD34),
(BFD_RELOC_PPC64_GOT_TPREL34, BFD_RELOC_PPC64_GOT_DTPREL34),
(BFD_RELOC_PPC64_TLS_PCREL): New pcrel tls relocs.
* elf64-ppc.c (ppc64_elf_howto_raw): Add howtos for pcrel tls relocs.
(ppc64_elf_reloc_type_lookup): Translate pcrel tls relocs.
(must_be_dyn_reloc, dec_dynrel_count): Add R_PPC64_TPREL64.
(ppc64_elf_check_relocs): Support pcrel tls relocs.
(ppc64_elf_tls_optimize, ppc64_elf_relocate_section): Likewise.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
2019-07-18 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_relocate_section): Don't bother selecting
a TLS section symbol for edited relocs. Tighten TLS symbol/reloc
match test.
2019-07-18 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (TLS_EXPLICIT): Define as 256.
(ppc64_elf_check_relocs): Don't store TLS_EXPLICIT even if char
is more than 8 bits.
(ppc64_elf_tls_optimize): Likewise. Make tls_set, tls_clear, and
tls_type vars unsigned int.
(ppc64_elf_relocate_section): Use r_type rather than TLS_EXPLICIT
to select r_type edit.
2019-07-18 Alan Modra <amodra@gmail.com>
* elf32-ppc.c (TLS_GDIE): Rename from TLS_TPRELGD throughout file.
Correct comment.
* elf64-ppc.c (TLS_GDIE): Likewise.
2019-07-18 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_tls_optimize): Correct test for allowed
range of tp-relative offsets.
Fix __bss_start assertion failure in _bfd_elf_fix_symbol_flags > Building LLVM 6.0 on FreeBSD/powerpc (devel/llvm60 port) the assertion > in the subject trips (displays twice) when linking libLTO.so.1. The > issue has been filed in FreeBSD's bugzilla, at > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237068 . It appears > the 'llvm::hashing::detail::get_execution_seed()::seed@@JL_LLVM_6.0' > symbol is being weakly aliased to an indirect symbol > __bss_start@@JL_LLVM_6.0. Since __bss_start@@JL_LLVM_6.0 is an > indirect symbol, it fails the assertion. I haven't looked under a debugger at your testcase but I think I know what is going on here. You have a shared library with a weakly defined llvm::hashing::detail::get_execution_seed()::seed which happens to be at the same location as __bss_start in that library. At the time the linker loads symbols for that library, it sees they are both versioned and thus introduces non-versioned indirect symbols for them. The linker considers the symbols as possibly being aliases, setting up h->u.alias and h->is_weakalias such that __bss_start@@JL_LLVM_6.0 is the definition. No real problem so far, the definition is bfd_link_hash_defined, except that the zero size, no type __bss_start symbol possibly should not be considered an alias in the first place. Later, __bss_start as defined by the linker script is entered into the linker symbol table. This is similar to __bss_start being defined by a regular object file in that ELF symbol resolution rules say that the value of __bss_start in the library is overridden by __bss_start in the executable/library being produced. So to accomplish the override, ld flips __bss_start from being an indirect symbol pointing at __bss_start@@JL_LLVM_6.0 to __bss_start@@JL_LLVM_6.0 being an indirect symbol pointing at __bss_start. That's how we get an unexpected indirect symbol and hit the assert. What should happen I think, is for the def->def_regular code above the assert to run in this case. The symbols are no longer aliases. * elflink.c (_bfd_elf_fix_symbol_flags): If the def for an alias is no longer bfd_link_hash_defined, clear the alias.
2019-07-12 07:58:19 +02:00
2019-07-15 Alan Modra <amodra@gmail.com>
* elflink.c (_bfd_elf_fix_symbol_flags): If the def for an
alias is no longer bfd_link_hash_defined, clear the alias.
Dynamic TLS section symbols It is possible to create shared libraries on PowerPC using -ftls-model=inital-exec or -ftls-model=local-exec. The first is half reasonable, getting you a shared library that can't be dlopen'd but otherwise is reasonable. The second is quite bad. Not only do you lose being able to dlopen, the library also has dynamic text relocations. Worse, the TPREL16_LO, TPREL16_HA and other TPREL16 dynamic relocs emitted were wrong, resulting in wrong values being applied by ld.so. Using the first TLS section symbol in dynamic relocations for local TLS symbols doesn't work. It's wrong because TLS symbols used by TLS relocs have values relative to the TLS segment, whereas the TLS section symbols are addresses. This patch instead uses a symbol index of zero which is used elsewhere by PowerPC on dynamic TLS relocs. It's not strictly ABI compliant to use a non-TLS symbol with TLS relocs but symbol index zero can be interpreted as "no symbol". Not using the first TLS section symbol means it doesn't need to be dynamic. The patch also fixes a further problem with PowerPC32 dynamic TPREL16* relocs, which shouldn't have the symbol value in the addend as we do for non-TLS symbols. bfd/ * elflink.c (_bfd_elf_omit_section_dynsym_default): Don't keep tls_sec. (_bfd_elf_init_1_index_section): Prefer not using TLS sections. (_bfd_elf_init_2_index_sections): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): When emitting dynamic relocations for local TLS symbols, use STN_UNDEF as the relocation symbol. * elf32-ppc.c (ppc_elf_relocate_section): Likewise, and don't leave TLS symbol value in the addend. ld/ * testsuite/ld-powerpc/tlsso.r: Update. * testsuite/ld-powerpc/tlsso32.g: Update. * testsuite/ld-powerpc/tlsso32.r: Update. * testsuite/ld-powerpc/tlstocso.r: Update. * testsuite/ld-cris/tls-dso-dtpoffd2.d: Update. * testsuite/ld-cris/tls-dso-dtpoffd4.d: Update. * testsuite/ld-cris/tls-dso-tpoffgotcomm1.d: Update. * testsuite/ld-cris/tls-gd-1.d: Update. * testsuite/ld-cris/tls-gd-1h.d: Update. * testsuite/ld-cris/tls-gd-2.d: Update. * testsuite/ld-cris/tls-gd-2h.d: Update. * testsuite/ld-cris/tls-ie-10.d: Update. * testsuite/ld-cris/tls-ie-11.d: Update. * testsuite/ld-cris/tls-ie-8.d: Update. * testsuite/ld-cris/tls-ie-9.d: Update. * testsuite/ld-cris/tls-js1.d: Update. * testsuite/ld-cris/tls-ld-4.d: Update. * testsuite/ld-cris/tls-ld-5.d: Update. * testsuite/ld-cris/tls-ld-6.d: Update. * testsuite/ld-cris/tls-ld-7.d: Update. * testsuite/ld-cris/tls-ldgd-14.d: Update. * testsuite/ld-cris/tls-ldgd-15.d: Update. * testsuite/ld-cris/tls-ldgdx-14.d: Update. * testsuite/ld-cris/tls-ldgdx-15.d: Update. * testsuite/ld-cris/tls-local-54.d: Update. * testsuite/ld-cris/tls-local-60.d: Update. * testsuite/ld-cris/tls-local-61.d: Update. * testsuite/ld-cris/tls-local-63.d: Update. * testsuite/ld-cris/tls-local-64.d: Update. * testsuite/ld-cris/tls-ok-30.d: Update. * testsuite/ld-cris/tls-ok-32.d: Update. * testsuite/ld-cris/tls-ok-34.d: Update. * testsuite/ld-mips-elf/tls-multi-got-1.got: Update. * testsuite/ld-mips-elf/tls-multi-got-1.r: Update. * testsuite/ld-mips-elf/tlsdyn-pie-o32.d: Update. * testsuite/ld-mips-elf/tlsdyn-pie-o32.got: Update. * testsuite/ld-mips-elf/tlslib-o32-hidden.got: Update. * testsuite/ld-mips-elf/tlslib-o32-ver.got: Update. * testsuite/ld-mips-elf/tlslib-o32.got: Update. * testsuite/ld-s390/tlspic.rd: Update. * testsuite/ld-s390/tlspic_64.rd: Update. * testsuite/ld-sparc/tlssunnopic32.rd: Update. * testsuite/ld-sparc/tlssunnopic64.rd: Update. * testsuite/ld-sparc/tlssunpic32.rd: Update. * testsuite/ld-sparc/tlssunpic64.rd: Update.
2019-07-11 14:38:39 +02:00
2019-07-13 Alan Modra <amodra@gmail.com>
* elflink.c (_bfd_elf_omit_section_dynsym_default): Don't keep
tls_sec.
(_bfd_elf_init_1_index_section): Prefer not using TLS sections.
(_bfd_elf_init_2_index_sections): Likewise.
* elf64-ppc.c (ppc64_elf_relocate_section): When emitting dynamic
relocations for local TLS symbols, use STN_UNDEF as the relocation
symbol.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise, and don't
leave TLS symbol value in the addend.
2019-07-08 Alan Modra <amodra@gmail.com>
PR 24785
* elf32-ppc.c (_bfd_elf_ppc_set_arch): Sanity check .PPC.EMB.apuinfo
size before reading first word.
2019-07-02 Nick Clifton <nickc@redhat.com>
PR 24717
* elf.c (is_debuginfo_file): New function.
(assign_file_positions_for_non_load_sections): Do not warn about
allocated sections outside of loadable segments if they are found
in a debuginfo file.
* elf-bfd.h (is_debuginfo_file): Prototype.
2019-07-02 Nick Clifton <nickc@redhat.com>
PR 24753
* compress.c (bfd_get_full_section_contents): Do not complain
about linker created sections that are larger than the file size.
2019-07-02 Christophe Lyon <christophe.lyon@linaro.org>
* bfd/elf32-arm.c (CMSE_STUB_NAME): New define.
(elf32_arm_get_stub_entry): Do not try to emit long-branch stubs
for CMSE stubs.
(arm_dedicated_stub_output_section_name): Use CMSE_STUB_NAME.
2019-07-02 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* elf32-arm.c (elf32_arm_gc_mark_extra_sections): Mark debug
sections when .text section contain secure entry functions
is marked.
2019-07-01 Nick Clifton <nickc@redhat.com>
PR 23839
* elf32-arm.c (elf32_arm_update_relocs): Do not include the
section VMA in the offset used to update exidx relocs.
2019-06-28 Nick Clifton <nickc@redhat.com>
PR 24708
* elf.c (_bfd_elf_slurp_version_tables): Check for an excessively
large version reference section.
* compress.c (bfd_get_full_section_contents): Check for an
uncompressed section whose size is larger than the file size.
2019-06-28 Alan Modra <amodra@gmail.com>
* format.c (bfd_check_format_matches): Don't match plugin target
if another target matches. Expand comment.
* targets.c (_bfd_target_vector): Move plugin_vec after all other
non-corefile targets, outside !SELECT_VECS.
* config.bfd: Don't handle targ=plugin here.
* configure.ac: Don't add plugin to enable_targets or handle in
target loop setting selvecs and other target vars.
* configure: Regenerate.
2019-06-26 Nick Clifton <nickc@redhat.com>
PR 24703
* mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add error
messages for failures.
* mach-o.c (bfd_mach_o_canonicalize_relocs): Set an bfd error code
if returning an error value.
2019-06-25 Jan Beulich <jbeulich@suse.com>
* elf-properties.c (elf_find_and_remove_property): Rename last
parameter. Mention it in comment.
2019-06-24 Ilia Diachkov <ilia.diachkov@optimitech.com>
* elfnn-riscv.c (_bfd_riscv_relax_lui): Delete early exit when
SEC_MERGE or SEC_CODE flags are set.
(_bfd_riscv_relax_section): New local symtype. Set sym_sec and
symtype consistently. Don't include sec_addr (sym_sec) in symval.
Add check for SEC_INFO_TYPE_MERGE and call _bfd_merged_section_offset.
Add sec_addr (sym_sec) after handling merge sections.
2019-06-24 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24721
* elf-properties.c (elf_merge_gnu_property_list): Remove the
property after reporting property removal.
2019-06-23 Alan Modra <amodra@gmail.com>
PR 24704
* elf64-ppc.c (R_PPC64_GOT16_DS): Don't set has_gotrel.
(ppc64_elf_edit_toc): Don't remove R_PPC64_GOT16_DS got entries.
Reduce range of offsets allowed for other GOT relocs.
2019-06-23 Alan Modra <amodra@gmail.com>
PR 24689
* elfcode.h (elf_object_p): Warning fix.
2019-06-21 Alan Modra <amodra@gmail.com>
PR 24689
* elfcode.h (elf_object_p): Check type of e_shstrndx section.
2019-06-19 Alan Modra <amodra@gmail.com>
PR 24697
* elf32-ppc.c (ppc_elf_relocate_section): Don't read insn for
R_PPC_EMB_RELSDA. Mask low bit of R_PPC_EMB_SDA21 r_offset.
2019-06-19 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_inline_plt): Correct st_other test for
functions that require r2 valid to use local entry.
(ppc64_elf_size_stubs, ppc64_elf_relocate_section): Likewise.
2019-06-17 Szabolcs Nagy <szabolcs.nagy@arm.com>
* elfnn-aarch64.c (elfNN_aarch64_allocate_local_dynrelocs): Remove.
(elfNN_aarch64_size_dynamic_sections): Remove loc_hash_table traversal
with elfNN_aarch64_allocate_local_dynrelocs.
2019-06-14 Szabolcs Nagy <szabolcs.nagy@arm.com>
* elfnn-aarch64.c: Enable MOVW_PREL relocs for ELF32.
2019-06-14 Alan Modra <amodra@gmail.com>
* Makefile.in: Regenerate.
* configure: Regenerate.
2019-06-14 Alan Modra <amodra@gmail.com>
* elf64-ppc.c: Fix comments involving paddi.
2019-06-12 Adam Lackorzymski <adam@os.inf.tu-dresden.de>
PR 24643
* elf32-arm.c (arm_elf_find_function): Fail if the symol table is
absent, or the bfd is not in the ELF formart.
* elfnn-aarch64.c (aarch64_elf_find_function): Likewise.
2019-06-10 Christos Zoulas <christos@zoulas.com>
PR 24650
* elf.c (elfcore_make_auxv_note_section): New function.
(elfcore_grok_note): Use it.
(elfcore_grok_freebsd_note): Likewise.
(elfcore_grok_openbsd_note): Likewise.
(elfcore_grok_netbsd_note): Likewise. Plus add support for
NT_NETBSDCORE_AUXV notes.
2019-06-06 Sudakshina Das <sudi.das@arm.com>
* elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Set
alignment of the new gnu property section.
2019-06-06 Sudakshina Das <sudi.das@arm.com>
* bfd-in.h: Change comment.
* bfd-in2.h: Regenerate.
* elfnn-aarch64.c (elfNN_aarch64_merge_gnu_properties): Update warning.
* elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties):
Likwise.
2019-05-28 Faraz Shahbazker <fshahbazker@wavecomp.com>
* elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_PCHI16>:
Remove overflow check.
2019-05-28 Alan Modra <amodra@gmail.com>
PR 24596
* cofflink.c (coff_link_check_archive_element): Don't assume
element is a coff object file after calling add_archive_element.
2019-05-28 Alan Modra <amodra@gmail.com>
PR 24596
* elf32-microblaze.c (microblaze_elf_finish_dynamic_sections): Don't
attempt to set sh_entsize for excluded PLT section.
2019-05-28 Alan Modra <amodra@gmail.com>
PR 24596
* elf64-alpha.c (elf64_alpha_relocate_section): Don't attempt
to emit R_ALPHA_GOTTPREL in PIEs, for which no space is
allocated in alpha_dynamic_entries_for_reloc.
2019-05-28 Alan Modra <amodra@gmail.com>
PR 24596
* elf32-lm32.c (lm32_elf_finish_dynamic_sections): Don't segfault
on NULL output_section.
* elflink.c (elf_final_link_free): Don't free -1 symshndxbuf.
2019-05-28 Alan Modra <amodra@gmail.com>
PR 24596
* elf32-m68k.c (elf_m68k_get_got_entry): Don't create a new
entry when MUST_FIND. Abort when MUST_FIND not found.
(elf_m68k_get_bfd2got_entry): Likewise.
(elf_m68k_relocate_section): Remove now useless assert.
2019-05-28 Alan Modra <amodra@gmail.com>
PR 24596
* elf64-hppa.c (elf64_hppa_finalize_dynreloc): Get the output bfd
from bfd_link_info, not an output section owner.
(elf64_hppa_finish_dynamic_symbol, elf64_hppa_finalize_opd): Likewise.
(elf_hppa_final_link_relocate): Likewise.
2019-05-28 Alan Modra <amodra@gmail.com>
PR 24596
* aout-tic30.c (MY_bfd_final_link): Don't segfault on missing
create_object_symbols_section, obj_textsec, obj_datasec or
obj_bsssec. Fix other errors in placement.
* config.bfd: Obsolete tic30-aout.
2019-05-28 Alan Modra <amodra@gmail.com>
PR 24596
* dwarf2.c (save_section_vma, section_vma_same): Check for NULL
end of section list as well as section_count.
* xcofflink.c (xcoff_link_add_symbols): Fix temporarily changed
section list before returning error.
2019-05-27 Alan Modra <amodra@gmail.com>
* elf.c (bfd_elf_set_group_contents): Exit on zero size section.
2019-05-27 Alan Modra <amodra@gmail.com>
PR 24596
* linker.c (_bfd_generic_link_output_symbols): Heed BSF_KEEP.
2019-05-24 Szabolcs Nagy <szabolcs.nagy@arm.com>
* elfnn-aarch64.c (elfNN_aarch64_merge_symbol_attribute): New function.
(struct elf_aarch64_link_hash_table): Add variant_pcs member.
(elfNN_aarch64_allocate_dynrelocs): Update variant_pcs.
(elfNN_aarch64_size_dynamic_sections): Add DT_AARCH64_VARIANT_PCS.
(elf_backend_merge_symbol_attribute): Define.
2019-05-24 Alan Modra <amodra@gmail.com>
* po/SRC-POTFILES.in: Regenerate.
2019-05-24 Alan Modra <amodra@gmail.com>
* elf64-ppc.c: Comment on powerxx _notoc stub variants.
(LI_R11_0, LIS_R11, ORI_R11_R11_0, SLDI_R11_R11_34): Define.
(PADDI_R12_PC, PLD_R12_PC, D34, HA34): Define.
(struct ppc_link_hash_table): Add powerxx_stubs.
(ppc64_elf_check_relocs): Set powerxx_stubs.
(build_powerxx_offset, size_powerxx_offset),
(num_relocs_for_powerxx_offset),
(emit_relocs_for_powerxx_offset): New functions.
(plt_stub_size): Size powerxx stubs.
(ppc_build_one_stub): Emit powerxx stubs.
(ppc_size_one_stub): Size powerxx stubs. Omit .eh_frame for
powerxx stubs.
2019-05-24 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (ppc64_elf_check_relocs): Set has_gotrel for
R_PPC64_GOT_PCREL34.
(xlate_pcrel_opt): New function.
(ppc64_elf_edit_toc): Handle R_PPC64_GOT_PCREL34.
(ppc64_elf_relocate_section): Edit GOT indirect to GOT relative
for R_PPC64_GOT_PCREL34. Implement R_PPC64_PCREL_OPT optimisation.
PowerPC relocations for prefix insns include/ * elf/ppc64.h (R_PPC64_PLTSEQ_NOTOC, R_PPC64_PLTCALL_NOTOC), (R_PPC64_PCREL_OPT, R_PPC64_D34, R_PPC64_D34_LO, R_PPC64_D34_HI30), (R_PPC64_D34_HA30, R_PPC64_PCREL34, R_PPC64_GOT_PCREL34), (R_PPC64_PLT_PCREL34, R_PPC64_PLT_PCREL34_NOTOC), (R_PPC64_ADDR16_HIGHER34, R_PPC64_ADDR16_HIGHERA34), (R_PPC64_ADDR16_HIGHEST34, R_PPC64_ADDR16_HIGHESTA34), (R_PPC64_REL16_HIGHER34, R_PPC64_REL16_HIGHERA34), (R_PPC64_REL16_HIGHEST34, R_PPC64_REL16_HIGHESTA34), (R_PPC64_D28, R_PPC64_PCREL28): Define. bfd/ * reloc.c (BFD_RELOC_PPC64_D34, BFD_RELOC_PPC64_D34_LO), (BFD_RELOC_PPC64_D34_HI30, BFD_RELOC_PPC64_D34_HA30), (BFD_RELOC_PPC64_PCREL34, BFD_RELOC_PPC64_GOT_PCREL34), (BFD_RELOC_PPC64_PLT_PCREL34), (BFD_RELOC_PPC64_ADDR16_HIGHER34, BFD_RELOC_PPC64_ADDR16_HIGHERA34), (BFD_RELOC_PPC64_ADDR16_HIGHEST34, BFD_RELOC_PPC64_ADDR16_HIGHESTA34), (BFD_RELOC_PPC64_REL16_HIGHER34, BFD_RELOC_PPC64_REL16_HIGHERA34), (BFD_RELOC_PPC64_REL16_HIGHEST34, BFD_RELOC_PPC64_REL16_HIGHESTA34), (BFD_RELOC_PPC64_D28, BFD_RELOC_PPC64_PCREL28): New reloc enums. * elf64-ppc.c (PNOP): Define. (ppc64_elf_howto_raw): Add reloc howtos for new relocations. (ppc64_elf_reloc_type_lookup): Translate new bfd reloc numbers. (ppc64_elf_ha_reloc): Adjust addend for highera34 and highesta34 relocs. (ppc64_elf_prefix_reloc): New function. (struct ppc_link_hash_table): Add notoc_plt. (is_branch_reloc): Add R_PPC64_PLTCALL_NOTOC. (is_plt_seq_reloc): Add R_PPC64_PLT_PCREL34, R_PPC64_PLT_PCREL34_NOTOC, and R_PPC64_PLTSEQ_NOTOC. (ppc64_elf_check_relocs): Handle pcrel got and plt relocs. Set has_pltcall for section on seeing R_PPC64_PLTCALL_NOTOC. Handle possible need for dynamic relocs on non-pcrel powerxx relocs. (dec_dynrel_count): Handle non-pcrel powerxx relocs. (ppc64_elf_inline_plt): Handle R_PPC64_PLTCALL_NOTOC. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_tls_optimize): Handle R_PPC64_PLTSEQ_NOTOC. (ppc64_elf_relocate_section): Handle new powerxx relocs. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-ppc.c (ppc_elf_suffix): Support @pcrel, @got@pcrel, @plt@pcrel, @higher34, @highera34, @highest34, and @highesta34. (fixup_size): Handle new powerxx relocs. (md_assemble): Warn for @pcrel on non-prefix insns. Accept @l, @h and @ha on prefix insns, and infer reloc without any @ suffix. Translate powerxx relocs to suit DQ and DS field instructions. Include operand tests as well as opcode test to translate BFD_RELOC_HI16_S to BFD_RELOC_PPC_16DX_HA. (ppc_fix_adjustable): Return false for pcrel GOT and PLT relocs. (md_apply_fix): Handle new powerxx relocs. * config/tc-ppc.h (TC_FORCE_RELOCATION_SUB_LOCAL): Accept BFD_RELOC_PPC64_ADDR16_HIGHER34, BFD_RELOC_PPC64_ADDR16_HIGHERA34, BFD_RELOC_PPC64_ADDR16_HIGHEST34, BFD_RELOC_PPC64_ADDR16_HIGHESTA34, BFD_RELOC_PPC64_D34, and BFD_RELOC_PPC64_D28. * testsuite/gas/ppc/prefix-reloc.d, * testsuite/gas/ppc/prefix-reloc.s: New test. * testsuite/gas/ppc/ppc.exp: Run it.
2018-08-29 06:52:34 +02:00
2019-05-24 Alan Modra <amodra@gmail.com>
* reloc.c (BFD_RELOC_PPC64_D34, BFD_RELOC_PPC64_D34_LO),
(BFD_RELOC_PPC64_D34_HI30, BFD_RELOC_PPC64_D34_HA30),
(BFD_RELOC_PPC64_PCREL34, BFD_RELOC_PPC64_GOT_PCREL34),
(BFD_RELOC_PPC64_PLT_PCREL34),
(BFD_RELOC_PPC64_ADDR16_HIGHER34, BFD_RELOC_PPC64_ADDR16_HIGHERA34),
(BFD_RELOC_PPC64_ADDR16_HIGHEST34, BFD_RELOC_PPC64_ADDR16_HIGHESTA34),
(BFD_RELOC_PPC64_REL16_HIGHER34, BFD_RELOC_PPC64_REL16_HIGHERA34),
(BFD_RELOC_PPC64_REL16_HIGHEST34, BFD_RELOC_PPC64_REL16_HIGHESTA34),
(BFD_RELOC_PPC64_D28, BFD_RELOC_PPC64_PCREL28): New reloc enums.
* elf64-ppc.c (PNOP): Define.
(ppc64_elf_howto_raw): Add reloc howtos for new relocations.
(ppc64_elf_reloc_type_lookup): Translate new bfd reloc numbers.
(ppc64_elf_ha_reloc): Adjust addend for highera34 and highesta34
relocs.
(ppc64_elf_prefix_reloc): New function.
(struct ppc_link_hash_table): Add notoc_plt.
(is_branch_reloc): Add R_PPC64_PLTCALL_NOTOC.
(is_plt_seq_reloc): Add R_PPC64_PLT_PCREL34,
R_PPC64_PLT_PCREL34_NOTOC, and R_PPC64_PLTSEQ_NOTOC.
(ppc64_elf_check_relocs): Handle pcrel got and plt relocs. Set
has_pltcall for section on seeing R_PPC64_PLTCALL_NOTOC. Handle
possible need for dynamic relocs on non-pcrel powerxx relocs.
(dec_dynrel_count): Handle non-pcrel powerxx relocs.
(ppc64_elf_inline_plt): Handle R_PPC64_PLTCALL_NOTOC.
(toc_adjusting_stub_needed): Likewise.
(ppc64_elf_tls_optimize): Handle R_PPC64_PLTSEQ_NOTOC.
(ppc64_elf_relocate_section): Handle new powerxx relocs.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
2019-05-23 Jose E. Marchesi <jose.marchesi@oracle.com>
* config.bfd (targ_cpu): Process bpf-*-none only if BFD64.
* configure.ac: Set target_size=64 for bpf_elf64_le_vec and
bpf_elf64_be_vec.
* configure: Regenerate.
2019-05-23 Jose E. Marchesi <jose.marchesi@oracle.com>
* configure: Regenerated.
* Makefile.am (ALL_MACHINES): Add cpu-bpf.lo.
(ALL_MACHINES_CFILES): Add cpu-bpf.c.
(BFD64_BACKENDS): Add elf64-bpf.lo.
(BFD64_BACKENDS_CFILES): Add elf64-bpf.c.
* Makefile.in (SOURCE_HFILES): Regenerate.
* config.bfd (targ_cpu): Handle bpf-*-* targets.
* cpu-bpf.c: New file.
* elf64-bpf.c: Likewise.
* targets.c (_bfd_target_vector): Add bpf_elf64_be_vec and
bpf_elf64_le_vec.
* archures.c: Define architecture bfd_arch_bpf and machine
bfd_arch_bpf.
* reloc.c: Define BFD relocations used by the BPF target.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
2019-05-22 Alan Modra <amodra@gmail.com>
* elf32-arm.c (arm_allocate_glue_section_space): Clear section
contents.
2019-05-22 Alan Modra <amodra@gmail.com>
* vms-alpha.c (_bfd_vms_write_etir): Don't attempt further
processing on "size error in section".
2019-05-22 Alan Modra <amodra@gmail.com>
* som.c (som_bfd_free_cached_info): Call
_bfd_generic_close_and_cleanup.
2019-05-21 Faraz Shahbazker <fshahbazker@wavecomp.com>
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Generate error
for TLS_TPREL_HI16(/LO16) relocations in shared library.
2019-05-21 Faraz Shahbazker <fshahbazker@wavecomp.com>
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Add NULL pointer
checks. Search the RELA table for n64 relocations.
[MIPS] Add generation of PLT entries with compact jumps for MIPS R6 Add a new option to get the linker to emit PLTs that use compact branches instead of delay slot branches. bfd/ * elfxx-mips.c (LA25_BC): New macro. (mips_elf_link_hash_table)<compact_branches>: New field. (STUB_JALRC): New macro. (mipsr6_o32_exec_plt0_entry_compact): New array. (mipsr6_n32_exec_plt0_entry_compact): Likewise. (mipsr6_n64_exec_plt0_entry_compact): Likewise. (mipsr6_exec_plt_entry_compact): Likewise. (mips_elf_create_la25_stub): Use BC instead of J for stubs when compact_branches is true. (_bfd_mips_elf_finish_dynamic_symbol): Choose the compact PLT for MIPSR6 with compact_branches. Do not reorder the compact branches PLT. Switch the lazy stub for MIPSR6 with compact_branches to use JALRC. (mips_finish_exec_plt): Choose the compact PLT0 for MIPSR6 when compact_branches is true. (_bfd_mips_elf_compact_branches): New function. * elfxx-mips.h (_bfd_mips_elf_compact_branches): New prototype. ld/ * emultempl/mipself.em (compact_branches): New static variable. (mips_create_output_section_statements): Call _bfd_mips_elf_compact_branches. (PARSE_AND_LIST_PROLOGUE): Add OPTION_COMPACT_BRANCHES and OPTION_NO_COMPACT_BRANCHES. (PARSE_AND_LIST_LONGOPTS): Add compact-branches, no-compact-branches. (PARSE_AND_LIST_OPTIONS): Add --compact-branches, --no-compact-branches. (PARSE_AND_LIST_ARGS_CASES): Handle the above. * ld.texinfo: Document --compact-branches, --no-compact-branches. * testsuite/ld-mips-elf/pic-and-nonpic-1-r6.dd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1-r6.nd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.dd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.gd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1a-r6.s: New test source. * testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2019-05-14 02:03:19 +02:00
2019-05-21 Matthew Fortune <matthew.fortune@mips.com>
Faraz Shahbazker <fshahbazker@wavecomp.com>
* elfxx-mips.c (LA25_BC): New macro.
(mips_elf_link_hash_table)<compact_branches>: New field.
(STUB_JALRC): New macro.
(mipsr6_o32_exec_plt0_entry_compact): New array.
(mipsr6_n32_exec_plt0_entry_compact): Likewise.
(mipsr6_n64_exec_plt0_entry_compact): Likewise.
(mipsr6_exec_plt_entry_compact): Likewise.
(mips_elf_create_la25_stub): Use BC instead of J for stubs
when compact_branches is true.
(_bfd_mips_elf_finish_dynamic_symbol): Choose the compact
PLT for MIPSR6 with compact_branches. Do not reorder the
compact branches PLT. Switch the lazy stub for MIPSR6
with compact_branches to use JALRC.
(mips_finish_exec_plt): Choose the compact PLT0 for MIPSR6
when compact_branches is true.
(_bfd_mips_elf_compact_branches): New function.
* elfxx-mips.h (_bfd_mips_elf_compact_branches): New prototype.
2019-05-21 Tamar Christina <tamar.christina@arm.com>
PR ld/24373
* elfnn-aarch64.c (_bfd_aarch64_erratum_843419_branch_to_stub):
Fix print formatter.
2019-05-21 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 24460
* elf32-arm.c (get_value_helper): Remove.
(elf32_arm_final_link_relocate): Fix branch future relocations.
AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) The Cortex-A53 erratum currently has two ways it can resolve the erratum when using the flag --fix-cortex-a53-843419: 1) If the address is within the range of an ADR instruction it rewrites the ADRP into an ADR, and those doesn't need the use of a veneer. 2) If the address is not within range, it adds a branch to a veneer which will execute the final bit of the erratum workaround and branch back to the call site. When we do this we always generate the veneers and we always align the size of the text section to 4KB. This is because we only know which workaround we can use after all linking has finished and all addresses are known. This means even though the veneers are not used, we still generate the section and we still change the size of the input section. This is problematic for small memory devices as this would require the user to take about a ~4KB hit in memory even though it's not even used. Since there's no real way to restart the linking process from the final write phase this patch solves the issue by allowing the user more control over which erratum workaround gets used. Concretely this changes the option --fix-cortex-a53-843419 to take optional arguments --fix-cortex-a53-843419[=full|adr|adrp] - full (default): Use both ADRP and ADR workaround. This is equivalent to not specifying any options and is the default behavior before this patch. - adr: Only use the ADR workaround, this will not cause any increase in binary size but linking will fail if the referenced address is out of range of an ADR instruction. - adrp: Use only the ADRP workaround, this will never rewrite your ADRP. In the cases where the user knows how big their binaries are the `adr` option would prevent the unneeded overhead. bfd/ChangeLog: PR ld/24373 * bfd-in.h (enum erratum_84319_opts): New (bfd_elf64_aarch64_set_options, bfd_elf32_aarch64_set_options): Change int to enum erratum_84319_opts. * bfd-in2.h: Regenerate. * elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Change fix_erratum_843419 to use new enum, remove fix_erratum_843419_adr. (_bfd_aarch64_add_stub_entry_after): Conditionally create erratum stub. (aarch64_size_one_stub): Conditionally size erratum 843419 stubs. (_bfd_aarch64_resize_stubs): Amend comment. (elfNN_aarch64_size_stubs): Don't generate stubs when no workaround requested. (bfd_elfNN_aarch64_set_options): Use new fix_erratum_843419 enum. (_bfd_aarch64_erratum_843419_branch_to_stub): Implement selection of erratum workaround. (clear_erratum_843419_entry): Update erratum conditional. ld/ChangeLog: PR ld/24373 * emultempl/aarch64elf.em (PARSE_AND_LIST_LONGOPTS): Add optional args to flags. * NEWS: Add changes to flag. (PARSE_AND_LIST_OPTIONS): Update help descriptions. (PARSE_AND_LIST_ARGS_CASES): Add new options to parser. * testsuite/ld-aarch64/aarch64-elf.exp: Add new run_dump_tests. * testsuite/ld-aarch64/erratum843419-adr.d: New test. * testsuite/ld-aarch64/erratum843419-adrp.d: New test. * testsuite/ld-aarch64/erratum843419-far-adr.d: New test. * testsuite/ld-aarch64/erratum843419-far-full.d: New test. * testsuite/ld-aarch64/erratum843419-far.s: New test. * testsuite/ld-aarch64/erratum843419-full.d: New test. * testsuite/ld-aarch64/erratum843419-near.s: New test. * testsuite/ld-aarch64/erratum843419-no-args.d: New test.
2019-05-21 14:04:08 +02:00
2019-05-21 Tamar Christina <tamar.christina@arm.com>
PR ld/24373
* bfd-in.h (enum erratum_84319_opts): New
(bfd_elf64_aarch64_set_options, bfd_elf32_aarch64_set_options): Change
int to enum erratum_84319_opts.
* bfd-in2.h: Regenerate.
* elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Change
fix_erratum_843419 to use new enum, remove fix_erratum_843419_adr.
(_bfd_aarch64_add_stub_entry_after): Conditionally create erratum stub.
(aarch64_size_one_stub): Conditionally size erratum 843419 stubs.
(_bfd_aarch64_resize_stubs): Amend comment.
(elfNN_aarch64_size_stubs): Don't generate stubs when no workaround
requested.
(bfd_elfNN_aarch64_set_options): Use new fix_erratum_843419 enum.
(_bfd_aarch64_erratum_843419_branch_to_stub): Implement selection of
erratum workaround.
(clear_erratum_843419_entry): Update erratum conditional.
2019-05-21 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com>
PR ld/24571
* bfd/elf32-avr.c (elf32_avr_relax_section): Adjust range check
when computing distance_short_enough.
2019-05-21 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com>
PR ld/24564
* bfd/elf32-avr.c (avr_relative_distance_considering_wrap_around):
Wrap around even if distance equals avr_pc_wrap_around.
2019-05-20 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation.
2019-05-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Add case for Tag_MVE_arch.
2019-05-16 Alan Modra <amodra@gmail.com>
* elf32-arm.c (elf32_arm_write_section): Revert last change.
2019-05-15 Alan Modra <amodra@gmail.com>
* elf32-arm.c (elf32_arm_write_section): Don't leave
error case of STM32L4XX_ERRATUM_BRANCH_TO_VENEER with
unitialised section contents.
2019-05-14 Jamey Hicks <jamey.hicks@gmail.com>
PR 19921
* verilog.c: (VerilogDataWidth): New variable.
(verilog_write_record): Emit bytes in VerilogDataWidth bundles.
2019-05-08 Nick Clifton <nickc@redhat.com>
PR 24523
* elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Return TRUE
rather than FALSE if encountering a non-ELF file.
2019-05-06 Alan Modra <amodra@gmail.com>
* elf32-pj.c (pj_elf_reloc): Don't report undefined weak as an error.
2019-05-06 Alan Modra <amodra@gmail.com>
* reloc.c (BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA),
(BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA):
Sort before BFD_RELOC_PPC64_DTPREL16_HIGHESTA entry.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
PR24511, nm should not mark symbols in .init_array as "t" This patch restricts the section names matched in coff_section_type, a function that translates section names to symbol type, and arranges to translate section flags to symbol type before looking at names. The latter change resulted in various test failures due to improper section flags being used in tests, and by the plugin support, so fix that too. The new test fails on many ELF targets that lack .init/fini_array in their scripts. I've just xfailed those. pru-elf oddly defines __init_array_begin rather than __init_array_start. I've left that target as a FAIL, and pj-elf too which reports an error for undefined weak symbols. bfd/ PR 24511 * syms.c (coff_section_type): Only allow '.', '$' and numeric following the standard section names. (bfd_decode_symclass): Prioritize section flag tests in decode_section_type before name tests in coff_section_type. * plugin.c (bfd_plugin_canonicalize_symtab): Init fake_section and fake_common_section using BFD_FAKE_SECTION. Use "fake" as their names and choose standard .text section flags for fake_section. ld/ PR 24511 * testsuite/ld-elf/pr14156a.d: Allow for .init/.fini being a data section on hppa64. * testsuite/ld-elf/pr14156b.d: Likewise. * testsuite/ld-scripts/pr18963.t: Map standard sections to set output section flags. * testsuite/ld-scripts/sane1.t: Likewise. * testsuite/ld-elf/init-fini-arrays.s: Reference __init_array_start and __fini_array_start. Define __start et al. * testsuite/ld-elf/pr24511.d: New test.
2019-05-03 14:06:46 +02:00
2019-05-04 Alan Modra <amodra@gmail.com>
PR 24511
* syms.c (coff_section_type): Only allow '.', '$' and numeric
following the standard section names.
(bfd_decode_symclass): Prioritize section flag tests in
decode_section_type before name tests in coff_section_type.
* plugin.c (bfd_plugin_canonicalize_symtab): Init fake_section
and fake_common_section using BFD_FAKE_SECTION. Use "fake" as
their names and choose standard .text section flags for
fake_section.
2019-05-02 Nick Clifton <nickc@redhat.com>
PR 24493
* coffcode.h (styp_to_sec_flags): Treat .gnu.debuglink and
.gnu.debugaltlink sections as debugging sections.
2019-04-30 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (struct ppc64_elf_obj_tdata): Add has_gotrel.
(struct _ppc64_elf_section_data): Likewise.
(ppc64_elf_check_relocs): Set above fields.
(ppc64_elf_edit_toc): Add a pass over GOT relocs.
(ppc64_elf_relocate_section): Edit GOT indirect to GOT relative
when possible.
2019-04-26 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24486
* elflink.c (elf_link_output_extsym): Don't complain undefined
weak dynamic reference.
[BFD, AArch64] Improve bti/pac plts. This patch aims to improve the definitions of BTI and PAC based PLTs. The following changes are made: * PLT0 does not need PAC instructions since the PLTGOT[2] (and PLTGOT[1]) are readonly so they cannot be corrupted at runtime. Thus both PAC plt0 and BTI+PAC plt0 are removed and we can use basic plt0 and BTI plt0 instead, respectively. * We can remove the extra padding nops when we add the new bti instructions. BTI plt0 and BTI TLSDESC plt are updated. * For better performance PLTn could be padded to 24bytes. Both BTI pltn and PAC pltn are updated. *** bfd/ChangeLog *** 2019-04-25 Sudakshina Das <sudi.das@arm.com> * elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): Remove. (PLT_BTI_TLSDESC_ENTRY_SIZE): Remove. (PLT_PAC_ENTRY_SIZE, PLT_BTI_PAC_ENTRY_SIZE): Remove. (PLT_BTI_SMALL_ENTRY_SIZE, PLT_PAC_SMALL_ENTRY_SIZE): Update. (elfNN_aarch64_small_plt0_pac_entry): Remove. (elfNN_aarch64_small_plt0_bti_pac_entry): Remove. (elfNN_aarch64_small_plt0_bti_entry): Update. (elfNN_aarch64_small_plt_bti_entry): Update. (elfNN_aarch64_small_plt_pac_entry): Update. (elfNN_aarch64_tlsdesc_small_plt_bti_entry): Update. (setup_plt_values): Setup new entries. (elfNN_aarch64_finish_dynamic_sections): Remove size change. (elfNN_aarch64_plt_sym_val): Likewise. *** ld/ChangeLog *** 2019-04-25 Sudakshina Das <sudi.das@arm.com> * testsuite/ld-aarch64/bti-pac-plt-1.d: Update. * testsuite/ld-aarch64/bti-pac-plt-2.d: Update. * testsuite/ld-aarch64/bti-plt-1.d: Update. * testsuite/ld-aarch64/bti-plt-3.d: Update. * testsuite/ld-aarch64/bti-plt-5.d: Update. * testsuite/ld-aarch64/pac-plt-1.d: Update. * testsuite/ld-aarch64/pac-plt-2.d: Update.
2019-04-25 12:37:25 +02:00
2019-04-25 Sudakshina Das <sudi.das@arm.com>
* elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): Remove.
(PLT_BTI_TLSDESC_ENTRY_SIZE): Remove.
(PLT_PAC_ENTRY_SIZE, PLT_BTI_PAC_ENTRY_SIZE): Remove.
(PLT_BTI_SMALL_ENTRY_SIZE, PLT_PAC_SMALL_ENTRY_SIZE): Update.
(elfNN_aarch64_small_plt0_pac_entry): Remove.
(elfNN_aarch64_small_plt0_bti_pac_entry): Remove.
(elfNN_aarch64_small_plt0_bti_entry): Update.
(elfNN_aarch64_small_plt_bti_entry): Update.
(elfNN_aarch64_small_plt_pac_entry): Update.
(elfNN_aarch64_tlsdesc_small_plt_bti_entry): Update.
(setup_plt_values): Setup new entries.
(elfNN_aarch64_finish_dynamic_sections): Remove size change.
(elfNN_aarch64_plt_sym_val): Likewise.
2019-04-22 Jim Wilson <jimw@sifive.com>
* elfnn-riscv.c (PRSTATUS_SIZE) [ARCH_SIZE==32]: Change from 0 to 204.
2019-04-19 Alan Modra <amodra@gmail.com>
* elf32-s12z.c (elf_backend_can_gc_sections): Don't define
2019-04-17 H.J. Lu <hongjiu.lu@intel.com>
* elf64-x86-64.c (elf_x86_64_need_pic): Suggest -fPIE when not
building shared object.
* elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Likewise.
2019-04-17 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24458
* elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): Also check x86
linker_def.
[binutils, ARM, 16/16] Add support to VLDR and VSTR of system registers GNU as' Arm backend assumes each mnemonic has a single entry in the instruction table but VLDR (system register) and VSTR (system register) are different instructions than VLDR and VSTR. It is thus necessary to add some form of demultiplexing in the parser. It starts by creating a new operand type OP_VLDR which indicate that the operand is either the existing OP_RVSD operand or a system register. The function parse_operands () then tries these two cases in order, calling the new parse_sys_vldr_vstr for the second case. Since the encoding function is specified in the instruction table entry, it also need to have some sort of demultiplexing. This is done in do_vldr_vstr which either calls the existing do_neon_ldr_str () or calls the new do_t_vldr_vstr_sysreg (). A new internal relocation is needed as well since the offset has a shorter range than in other Thumb coprocessor instructions. Disassembly also requires special care since VSTR (system register) reuse the STC encoding with the coprocessor number 15. Armv8.1-M Mainline ARM manual states that coprocessor 8, 14 and 15 are reserved for floating-point and MVE instructions a feature bit check is added if the coprocessor number is one of this value and we are trying to match a coprocessor instruction (eg. STC) to forbid the match. ChangeLog entries are as follows: *** bfd/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * reloc.c (BFD_RELOC_ARM_T32_VLDR_VSTR_OFF_IMM): New internal relocation. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. *** gas/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * config/tc-arm.c (parse_sys_vldr_vstr): New function. (OP_VLDR): New enum operand_parse_code enumerator. (parse_operands): Add logic for OP_VLDR. (do_t_vldr_vstr_sysreg): New function. (do_vldr_vstr): Likewise. (insns): Guard VLDR and VSTR by arm_ext_v4t for Thumb mode. (md_apply_fix): Add bound check for VLDR and VSTR co-processor offset. Add masking logic for BFD_RELOC_ARM_T32_VLDR_VSTR_OFF_IMM relocation. * testsuite/gas/arm/archv8m_1m-cmse-main-bad.s: Add examples of bad uses of VLDR and VSTR. * testsuite/gas/arm/archv8m_1m-cmse-main-bad.l: Add error messages for above bad uses. * testsuite/gas/arm/archv8m_1m-cmse-main.s: Add examples of VLDR and VSTR valid uses. * testsuite/gas/arm/archv8m_1m-cmse-main.d: Add disassembly for the above examples. *** opcodes/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm-dis.c (coprocessor_opcodes): Document new %J and %K format specifier. Add entries for VLDR and VSTR of system registers. (print_insn_coprocessor): Forbid coprocessor numbers 8, 14 and 15 in coprocessor instructions on Armv8.1-M Mainline targets. Add handling of %J and %K format specifier.
2019-04-15 13:23:24 +02:00
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* reloc.c (BFD_RELOC_ARM_T32_VLDR_VSTR_OFF_IMM): New internal
relocation.
* bfd-in2.h: Regenerate.
* libbfd.h: Likewise.
[binutils, ARM, 12/16] Scalar Low Overhead loop instructions for Armv8.1-M Mainline s patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils. This patch adds support to the Scalar low overhead loop instructions: LE WLS DLS We also add a new assembler resolvable relocation bfd_reloc_code_real enum for the 12-bit branch offset used in these instructions. ChangeLog entries are as follows: *** bfd/ChnageLog *** 2019-04-12 Sudakshina Das <sudi.das@arm.com> * reloc.c (BFD_RELOC_ARM_THUMB_LOOP12): New. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. *** gas/ChangeLog *** 2019-04-12 Sudakshina Das <sudi.das@arm.com> Andre Vieira <andre.simoesdiasvieira@arm.com> * config/tc-arm.c (operand_parse_code): Add OP_LR and OP_oLR for the LR operand and optional LR operand. (parse_operands): Add switch cases for OP_LR and OP_oLR for both type checking and value checking. (encode_thumb32_addr_mode): New entries for DLS, WLS and LE. (v8_1_loop_reloc): New helper function for handling labels for the low overhead loop instructions. (do_t_loloop): New function to encode DLS, WLS and LE. (insns): New entries for WLS, DLS and LE. (md_pcrel_from_section): New switch case for BFD_RELOC_ARM_THUMB_LOOP12. (md_appdy_fix): Likewise. (tc_gen_reloc): Likewise. * testsuite/gas/arm/armv8_1-m-tloop.s: New. * testsuite/gas/arm/armv8_1-m-tloop.d: New. * testsuite/gas/arm/armv8_1-m-tloop-bad.s: New. * testsuite/gas/arm/armv8_1-m-tloop-bad.d: New. * testsuite/gas/arm/armv8_1-m-tloop-bad.l: New. *** opcodes/ChangeLog *** 2019-04-12 Sudakshina Das <sudi.das@arm.com> * arm-dis.c (print_insn_thumb32): Updated to accept new %P and %Q patterns.
2019-04-15 12:58:47 +02:00
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_ARM_THUMB_LOOP12): New.
* bfd-in2.h: Regenerated.
* libbfd.h: Regenerated.
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_THUMB_PCREL_BFCSEL): New relocation.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
[binutils, ARM, 10/16] BFCSEL infrastructure with new global reloc R_ARM_THM_BF12 This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils. This adds infrastructure for the BFCSEL instructions which is one of the first instructions in Arm that have more than one relocations in them. This adds a new relocation R_ARM_THM_BF12. The inconsistency between external R_ARM_THM_BF12 and internal BFD_RELOC_ARM_THUMB_BF13 is because internally we count the static bit-0 of the immediate and we don't externally. ChangeLog entries are as follows : ChangeLog entries are as follows : *** bfd/ChnageLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * reloc.c (BFD_RELOC_ARM_THUMB_BF13): New. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF13. (elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF13 and R_ARM_THM_BF12 together. (elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF13. *** elfcpp/ChangeLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * arm.h (R_ARM_THM_BF12): New relocation code. *** gas/ChangeLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * config/tc-arm.c (md_pcrel_from_section): New switch case for BFD_RELOC_ARM_THUMB_BF13. (md_appdy_fix): Likewise. (tc_gen_reloc): Likewise. *** include/ChangeLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF12. *** opcodes/ChangeLog *** 2019-04-04 Sudakshina Das <sudi.das@arm.com> * arm-dis.c (print_insn_thumb32): Updated to accept new %Z pattern.
2019-04-15 12:46:54 +02:00
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_ARM_THUMB_BF13): New.
* bfd-in2.h: Regenerated.
* libbfd.h: Regenerated.
* elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF13.
(elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF13
and R_ARM_THM_BF12 together.
(elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF13.
[binutils, ARM, 8/16] BFL infrastructure with new global reloc R_ARM_THM_BF18 This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils. This adds infrastructure for the BFL instructions which is one of the first instructions in Arm that have more than one relocations in them. This adds a new relocation R_ARM_THM_BF18. The inconsistency between external R_ARM_THM_BF18 and internal BFD_RELOC_ARM_THUMB_BF19 is because internally we count the static bit-0 of the immediate and we don't externally. ChangeLog entries are as follows : *** bfd/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * reloc.c (BFD_RELOC_ARM_THUMB_BF19): New * libbfd.h: Regenerated. * bfd-in2.h: Regenerated. * bfd-elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF18. (elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF19 and R_ARM_THM_BF18 together. (elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF19. *** elfcpp/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * arm.h (R_ARM_THM_BF18): New relocation code. *** gas/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * config/tc-arm.c (md_pcrel_from_section): New switch case for BFD_RELOC_ARM_THUMB_BF19. (md_appdy_fix): Likewise. (tc_gen_reloc): Likewise. *** include/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF18. *** opcodes/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * arm-dis.c (print_insn_thumb32): Updated to accept new %Y pattern.
2019-04-15 12:37:51 +02:00
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_ARM_THUMB_BF19): New
* libbfd.h: Regenerated.
* bfd-in2.h: Regenerated.
* bfd-elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF18.
(elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF19
and R_ARM_THM_BF18 together.
(elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF19.
[binutils, ARM, 5/16] BF insns infrastructure with new global reloc R_ARM_THM_BF16 This patch is part of a series of patches to add support for Armv8.1-M Mainline instructions to binutils. This adds infrastructure for the BF instructions which is one of the first instructions in Arm that have more than one relocations in them. This is the third infrastructure patch that adds a new relocation R_ARM_THM_BF16. The inconsistency between external R_ARM_THM_BF16 and internal BFD_RELOC_ARM_THUMB_BF17 is because internally we count the static bit-0 of the immediate and we don't externally. ChangeLog entries are as follows : *** bfd/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * reloc.c (BFD_RELOC_ARM_THUMB_BF17): New enum. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * bfd-elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF16. (elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF17 and R_ARM_THM_BF16 together. (get_value_helper): New reloc helper. (elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF16. *** elfcpp/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * arm.h (R_ARM_THM_BF16): New relocation code. *** gas/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * config/tc-arm.c (md_pcrel_from_section): New switch case for BFD_RELOC_ARM_THUMB_BF17. (md_appdy_fix): Likewise. (tc_gen_reloc): Likewise. *** include/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * elf/arm.h (START_RELOC_NUMBERS): New entry for R_ARM_THM_BF16. *** opcodes/ChangeLog *** 2019-04-15 Sudakshina Das <sudi.das@arm.com> * arm-dis.c (print_insn_thumb32): Updated to accept new %W pattern.
2019-04-15 12:18:57 +02:00
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_ARM_THUMB_BF17): New enum.
* bfd-in2.h: Regenerated.
* libbfd.h: Regenerated.
* bfd-elf32-arm.c (elf32_arm_howto_table_1): New entry for R_ARM_THM_BF16.
(elf32_arm_reloc_map elf32_arm_reloc_map): Map BFD_RELOC_ARM_THUMB_BF17
and R_ARM_THM_BF16 together.
(get_value_helper): New reloc helper.
(elf32_arm_final_link_relocate): New switch case for R_ARM_THM_BF16.
2019-04-15 Sudakshina Das <sudi.das@arm.com>
* reloc.c (BFD_RELOC_THUMB_PCREL_BRANCH5): New enum.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
[binutils, ARM, 1/16] Add support for Armv8.1-M Mainline CLI The patch is straightforward, it does the following: - support the new Tag_CPU_arch build attribute value, ie.: + declare the new value + update all the asserts forcing logic to be reviewed for new architectures + create a corresponding bfd_mach_arm_8_1M_MAIN enumerator in bfd and add mapping from Tag_CPU_arch to it + teach readelf about new Tag_CPU_arch value - declare armv8.1-m.main as a supported architecture value - define Armv8.1-M Mainline in terms of feature bits available - tell objdump mapping from bfd_mach_arm_8_1M_MAIN enumerator to feature bits available - update architecture-specific logic in gas and bfd guarded by the asserts mentioned above. - tests for all the above ChangeLog entries are as follows: *** bfd/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * archures.c (bfd_mach_arm_8_1M_MAIN): Define. * bfd-in2.h: Regenerate. * cpu-arm.c (arch_info_struct): Add entry for Armv8.1-M Mainline. * elf32-arm.c (using_thumb_only): Return true for Armv8.1-M Mainline and update assert. (using_thumb2): Likewise. (using_thumb2_bl): Update assert. (arch_has_arm_nop): Likewise. (bfd_arm_get_mach_from_attributes): Add case for Armv8.1-M Mainline. (tag_cpu_arch_combine): Add logic for Armv8.1-M Mainline merging. *** binutils/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * readelf.c (arm_attr_tag_CPU_arch): Add entry for Armv8.1-M Mainline. *** gas/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * config/tc-arm.c (cpu_arch_ver): Add entry for Armv8.1-M Mainline Tag_CPU_arch build attribute value. Reindent. (get_aeabi_cpu_arch_from_fset): Update assert. (aeabi_set_public_attributes): Update assert for Tag_DIV_use logic. * testsuite/gas/arm/attr-march-armv8_1-m.main.d: New test. *** include/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * elf/arm.h (TAG_CPU_ARCH_V8_1M_MAIN): new macro. (MAX_TAG_CPU_ARCH): Set value to above macro. * opcode/arm.h (ARM_EXT2_V8_1M_MAIN): New macro. (ARM_AEXT_V8_1M_MAIN): Likewise. (ARM_AEXT2_V8_1M_MAIN): Likewise. (ARM_ARCH_V8_1M_MAIN): Likewise. *** ld/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * testsuite/ld-arm/attr-merge-13.attr: New test. * testsuite/ld-arm/attr-merge-13a.s: New test. * testsuite/ld-arm/attr-merge-13b.s: New test. *** opcodes/ChangeLog *** 2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm-dis.c (select_arm_features): Add logic for Armv8.1-M Mainline.
2019-04-15 11:54:42 +02:00
2019-04-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
* archures.c (bfd_mach_arm_8_1M_MAIN): Define.
* bfd-in2.h: Regenerate.
* cpu-arm.c (arch_info_struct): Add entry for Armv8.1-M Mainline.
* elf32-arm.c (using_thumb_only): Return true for Armv8.1-M Mainline
and update assert.
(using_thumb2): Likewise.
(using_thumb2_bl): Update assert.
(arch_has_arm_nop): Likewise.
(bfd_arm_get_mach_from_attributes): Add case for Armv8.1-M Mainline.
(tag_cpu_arch_combine): Add logic for Armv8.1-M Mainline merging.
x86: Add -z cet-report=[none|warning|error] Add -z cet-report=[none|warning|error] to report the missing Intel Indirect Branch Tracking (IBT) and Shadow Stack (SHSTK) properties in input .note.gnu.property section. -z cet-report=none, which is the default, will make the linker not report missing properties in input files. -z cet-report=warning will make the linker issue a warning for missing properties in input files. -z cet-report=error will make the linker issue an error for missing properties in input files. Note that -z ibt will turn off the missing IBT property report and -z shstk will turn off the missing SHSTK property report. Supported for Linux/i386 and Linux/x86_64. bfd/ * elf-linker-x86.h (elf_x86_cet_report): New. (elf_linker_x86_params): Add cet_report. * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report missing IBT and SHSTK properties if needed. ld/ * ld.texi: Document -z cet-report=[none|warning|error]. * emulparams/cet.sh: Add -z cet-report=[none|warning|error]. * testsuite/ld-i386/i386.exp: Run -z cet-report=[warning|error] tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/property-x86-cet1.d: New file. * testsuite/ld-i386/property-x86-cet2a.d: Likewise. * testsuite/ld-i386/property-x86-cet2b.d: Likewise. * testsuite/ld-i386/property-x86-cet3a.d: Likewise. * testsuite/ld-i386/property-x86-cet3b.d: Likewise. * testsuite/ld-i386/property-x86-cet4a.d: Likewise. * testsuite/ld-i386/property-x86-cet4b.d: Likewise. * testsuite/ld-i386/property-x86-cet5a.d: Likewise. * testsuite/ld-i386/property-x86-cet5b.d: Likewise. * testsuite/ld-i386/property-x86-cet6.d: Likewise. * testsuite/ld-x86-64/property-x86-cet.s: Likewise. * testsuite/ld-x86-64/property-x86-cet1-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet1.d: Likewise. * testsuite/ld-x86-64/property-x86-cet2a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet2a.d: Likewise. * testsuite/ld-x86-64/property-x86-cet2b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet2b.d: Likewise. * testsuite/ld-x86-64/property-x86-cet3a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet3a.d: Likewise. * testsuite/ld-x86-64/property-x86-cet3b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet3b.d: Likewise. * testsuite/ld-x86-64/property-x86-cet4a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet4a.d: Likewise. * testsuite/ld-x86-64/property-x86-cet4b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet4b.d: Likewise. * testsuite/ld-x86-64/property-x86-cet5a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet5a.d: Likewise. * testsuite/ld-x86-64/property-x86-cet5b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet5b.d: Likewise. * testsuite/ld-x86-64/property-x86-cet6-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-cet6.d: Likewise.
2019-04-11 17:18:51 +02:00
2019-04-11 H.J. Lu <hongjiu.lu@intel.com>
* elf-linker-x86.h (elf_x86_cet_report): New.
(elf_linker_x86_params): Add cet_report.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
missing IBT and SHSTK properties if needed.
Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry Instead of BFD_ASSERT (h != NULL) with ld: BFD ... assertion fail .../bfd/elf64-x86-64.c:2562 ld: bad.o: invalid string offset 50331648 >= 371 for section `nterp' check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry with ld: bad.o: section 'g': corrupt VTENTRY entry * elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of "h != NULL". Don't check "h != NULL" before calling. bfd_elf_gc_record_vtentry. * elf32-arm.c (elf32_arm_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-csky.c (csky_elf_check_relocs): Likewise. * elf32-d10v.c (elf32_d10v_check_relocs): Likewise. * elf32-dlx.c (elf32_dlx_check_relocs): Likewise. * elf32-fr30.c (fr30_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-iq2000.c (iq2000_elf_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-mcore.c (mcore_elf_check_relocs): Likewise. * elf32-metag.c (elf_metag_check_relocs): Likewise. * elf32-or1k.c (or1k_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_check_relocs): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_check_relocs): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise. * elf64-mmix.c (mmix_elf_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_s390_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt VTENTRY entry.
2019-04-11 15:44:53 +02:00
2019-04-11 H.J. Lu <hongjiu.lu@intel.com>
2019-04-11 16:53:55 +02:00
PR ld/24436
Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry Instead of BFD_ASSERT (h != NULL) with ld: BFD ... assertion fail .../bfd/elf64-x86-64.c:2562 ld: bad.o: invalid string offset 50331648 >= 371 for section `nterp' check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry with ld: bad.o: section 'g': corrupt VTENTRY entry * elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of "h != NULL". Don't check "h != NULL" before calling. bfd_elf_gc_record_vtentry. * elf32-arm.c (elf32_arm_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-csky.c (csky_elf_check_relocs): Likewise. * elf32-d10v.c (elf32_d10v_check_relocs): Likewise. * elf32-dlx.c (elf32_dlx_check_relocs): Likewise. * elf32-fr30.c (fr30_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-iq2000.c (iq2000_elf_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-mcore.c (mcore_elf_check_relocs): Likewise. * elf32-metag.c (elf_metag_check_relocs): Likewise. * elf32-or1k.c (or1k_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_check_relocs): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_check_relocs): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise. * elf64-mmix.c (mmix_elf_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_s390_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt VTENTRY entry.
2019-04-11 15:44:53 +02:00
* elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of
"h != NULL". Don't check "h != NULL" before calling.
bfd_elf_gc_record_vtentry.
* elf32-arm.c (elf32_arm_check_relocs): Likewise.
* elf32-bfin.c (bfin_check_relocs): Likewise.
* elf32-cris.c (cris_elf_check_relocs): Likewise.
* elf32-csky.c (csky_elf_check_relocs): Likewise.
* elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
* elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
* elf32-fr30.c (fr30_elf_check_relocs): Likewise.
* elf32-frv.c (elf32_frv_check_relocs): Likewise.
* elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
* elf32-i386.c (elf_i386_check_relocs): Likewise.
* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
* elf32-m68k.c (elf_m68k_check_relocs): Likewise.
* elf32-mcore.c (mcore_elf_check_relocs): Likewise.
* elf32-metag.c (elf_metag_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
* elf32-s390.c (elf_s390_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
* elf32-vax.c (elf_vax_check_relocs): Likewise.
* elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
* elf64-mmix.c (mmix_elf_check_relocs): Likewise.
* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
* elf64-s390.c (elf_s390_check_relocs): Likewise.
* elf64-x86-64.c (elf_s390_check_relocs): Likewise.
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
* elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt
VTENTRY entry.
2019-04-11 Alan Modra <amodra@gmail.com>
PR 24435
* elflink.c (elf_link_add_object_symbols): Don't read partial
dynamic entries from fuzzed objects.
2019-04-11 Tamar Christina <tamar.christina@arm.com>
PR ld/24302
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Don't emit
DT_TLSDESC_GOT and DT_TLSDESC_PLT when DF_BIND_NOW.
(elfNN_aarch64_finish_dynamic_sections): Don't write PLT if DF_BIND_NOW.
2019-04-10 Michael Forney <mforney@mforney.org>
PR 24427
* doc/chew.c (free_words): Correctly free "push_text" strings.
2019-04-08 H.J. Lu <hongjiu.lu@intel.com>
* config.bfd: Remove i[3-7]86-*-kaos* and i[3-7]86-*-chaos targets.
2019-04-08 Alan Modra <amodra@gmail.com>
* configure.ac (elfxx_x86): Define and use.
* configure: Regenerate.
x86: Move x86-specific linker options to elf_linker_x86_params Remove x86-specific linker options from bfd_link_info and put them in elf_linker_x86_params. Add _bfd_elf_linker_x86_set_options to pass x86-specific linker options from ld to bfd. bfd/ * elf-linker-x86.h: New file. * elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params to get x86-specific linker options. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_link_setup_gnu_properties): Likewise. * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise. (_bfd_x86_elf_link_setup_gnu_properties): Likewise. (_bfd_elf_linker_x86_set_options): New function. * elfxx-x86.h: Include "elf-linker-x86.h". (elf_x86_link_hash_table): Add params. include/ * bfdlink.h (bfd_link_info): Remove x86-specific linker options. ld/ * Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em. (eelf_i386_sol2.c): Also depend on $(srcdir)/emultempl/solaris2-x86.em. (eelf_x86_64_sol2.c): Likewise. * Makefile.in: Regenerated. * emulparams/call_nop.sh: Set x86-specific linker options via params. * emulparams/cet.sh: Likewise. * emulparams/reloc_overflow.sh: Likewise. * emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New. Set to "elf-x86". * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to "solaris2-x86". * emulparams/elf_x86_64_sol2.sh: Likewise. * emultempl/elf-x86.em: New file. * emultempl/solaris2-x86.em: Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't set link_info.call_nop_byte.
2019-04-06 16:25:10 +02:00
2019-04-06 H.J. Lu <hongjiu.lu@intel.com>
* elf-linker-x86.h: New file.
* elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params
to get x86-specific linker options.
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
(elf_x86_64_check_relocs): Likewise.
(elf_x86_64_relocate_section): Likewise.
(elf_x86_64_link_setup_gnu_properties): Likewise.
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise.
(_bfd_x86_elf_link_setup_gnu_properties): Likewise.
(_bfd_elf_linker_x86_set_options): New function.
* elfxx-x86.h: Include "elf-linker-x86.h".
(elf_x86_link_hash_table): Add params.
2019-04-03 Alan Modra <amodra@gmail.com>
* coff-i386.c, * coff-x86_64.c, * coffgen.c, * dwarf2.c,
* elf-m10200.c, * elf.c, * elf32-arm.c, * elf32-bfin.c,
* elf32-csky.c, * elf32-m32r.c, * elf32-microblaze.c, * elf32-pru.c,
* elf32-rx.c, * elf32-xgate.c, * elf64-sparc.c, * elfnn-ia64.c,
* elfxx-riscv.c, * elfxx-sparc.c, * linker.c, * mach-o.c,
* pe-x86_64.c, * pei-x86_64.c, * plugin.c: Whitespace fixes.
2019-04-02 Jim Wilson <jimw@sifive.com>
PR 24389
* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Move read of
ELF header flags to after check for ELF object file. Loop through
sections looking for code sections, if none, then skip ABI checks.
2019-03-30 Andrew Waterman <andrew@sifive.com>
* elfnn-riscv.c (_bfd_riscv_relax_call): Only check ARCH_SIZE for
rd == X_RA case.
2019-03-29 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (shrink_dynamic_reloc_sections): Add
info->export_dynamic to the conditional.
2019-03-28 Alan Modra <amodra@gmail.com>
PR 24392
* configure.ac: Invoke AC_CHECK_SIZEOF(int).
* configure: Regenerate.
* coffgen.c (coff_get_reloc_upper_bound): Replace gcc diagnostic
workaround with SIZEOF_LONG vs. SIZEOF_INT check.
* elf.c (_bfd_elf_get_reloc_upper_bound): Likewise.
* elf64-sparc.c (elf64_sparc_get_reloc_upper_bound): Likewise.
* mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
2019-03-21 Jim Wilson <jimw@sifive.com>
PR 24365
* elfnn-riscv.c (riscv_elf_relocate_section): For STT_SECTION check,
verify sym non-NULL before using. Add identical check using h.
[BFD, AArch64, x86] Improve warning for --force-bti The AArch64 linker option to turn on BTI (--force-bti) warns in case there are input objects which have a missing GNU NOTE section for BTI. This patch is trying to improve the warnings that come out. In order to do so, I propose adding a new argument to elf_merge_gnu_properties and the backend function merge_gnu_properties. This new argument makes sure that we now pass both the objects along with the properties to which they belong to. The x86 backend function has also been updated to match this change. *** bfd/ChangeLog *** 2019-03-21 Sudakshina Das <sudi.das@arm.com> * elf-bfd.h (struct elf_backend_data): Add argument to merge_gnu_properties. * elf-properties.c (elf_merge_gnu_properties): Add argument to itself and while calling bed->merge_gnu_properties. (elf_merge_gnu_property_list): Update the calls for elf_merge_gnu_properties. * elfnn-aarch64.c (elfNN_aarch64_merge_gnu_properties): Update handling of --force-bti warning and add argument. * elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Add warning. * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Add argument. * elfxx-x86.h (_bfd_x86_elf_merge_gnu_properties): Likewise in declaration. *** ld/ChangeLog *** 2019-03-21 Sudakshina Das <sudi.das@arm.com> * testsuite/ld-aarch64/aarch64-elf.exp: Add new test. * testsuite/ld-aarch64/bti-plt-1.s: Add .ifdef for PAC note section. * testsuite/ld-aarch64/bti-plt-6.d: Update warning. * testsuite/ld-aarch64/bti-plt-7.d: Likewise. * testsuite/ld-aarch64/bti-warn.d: New test.
2019-03-21 17:20:21 +01:00
2019-03-21 Sudakshina Das <sudi.das@arm.com>
* elf-bfd.h (struct elf_backend_data): Add argument to
merge_gnu_properties.
* elf-properties.c (elf_merge_gnu_properties): Add argument to
itself and while calling bed->merge_gnu_properties.
(elf_merge_gnu_property_list): Update the calls for
elf_merge_gnu_properties.
* elfnn-aarch64.c (elfNN_aarch64_merge_gnu_properties): Update handling
of --force-bti warning and add argument.
* elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Add
warning.
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Add argument.
* elfxx-x86.h (_bfd_x86_elf_merge_gnu_properties): Likewise in
declaration.
2019-03-20 Sudakshina Das <sudi.das@arm.com>
* elfxx-aarch64.c (_bfd_aarch64_elf_link_fixup_gnu_properties): Define.
* elfxx-aarch64.h (_bfd_aarch64_elf_link_fixup_gnu_properties): Declare.
(elf_backend_fixup_gnu_properties): Define for AArch64.
2019-03-18 Alan Modra <amodra@gmail.com>
PR 24355
* elf32-ppc.c (ppc_finish_symbols): Don't call write_glink_stub
for local iplt syms with ent->plt.offset == -1. Remove ineffective
attempt at writing glink stubs only once.
2019-03-16 Alan Modra <amodra@gmail.com>
PR 24337
* elf.c (_bfd_elf_rela_local_sym): Revert last change.
(_bfd_elf_rel_local_sym): Likewise.
* elflink.c (elf_link_input_bfd): Use bfd_und_section for
section of symbols with unrecognized shndx.
2019-03-15 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24267
* coffgen.c (_bfd_coff_section_already_linked): Skip discarded
section.
* cofflink.c (coff_link_add_symbols): Check for symbols defined
in discarded section.
2019-03-15 Alan Modra <amodra@gmail.com>
PR 24339
* elflink.c (elf_link_add_object_symbols): Bail out on a local
symbol after globals if elf_bad_symtab is not set.
2019-03-15 Alan Modra <amodra@gmail.com>
PR 24337
* elf.c (_bfd_elf_rela_local_sym): Don't segfault on NULL sec.
(_bfd_elf_rel_local_sym): Likewise.
2019-03-15 Alan Modra <amodra@gmail.com>
PR 24336
* elflink.c (elf_link_read_relocs_from_section): Handle fuzzed
object files with sh_size not a multiple of sh_entsize.
2019-03-15 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24338
* elf64-x86-64.c (elf_x86_64_relocate_section): Check for corrupt
input with bad relocation.
22019-03-15 H.J. Lu <hongjiu.lu@intel.com>
* elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
2019-03-14 Nick Clifton <nickc@redhat.com>
PR 24334
* dwarf2.c (struct dwarf2_debug): Add sec_vma_count field.
(save_section_vma): Initialise field to the number of entries in
the sec_vma table.
(section_vma_same): Check that the number of entries in the
sec_vma table matches the number of sections in the bfd.
2019-03-14 Nick Clifton <nickc@redhat.com>
PR 24333
* elflink.c (_bfd_elf_add_default_symbol): Add a check for a NULL
section owner pointer when adding the default symbol.
2019-03-14 Nick Clifton <nickc@redhat.com>
PR 24332
* elflink.c (elf_link_add_object_symbols): Add new local variable
extversym_end. Initialise it to point to the end of the version
symbol table, if present. Check it when initialising and updating
the ever pointer.
[BFD, LD, AArch64, 3/3] Add --pac-plt to enable PLTs protected with PAC. This is part of the patch series to add support for BTI and PAC in AArch64 linker. 1) This patch adds new definitions of PAC enabled PLTs and both BTI and PAC enabled PLTs. 2) It also defines the new dynamic tag DT_AARCH64_PAC_PLT for the PAC enabled PLTs. 3) This patch adds a new ld command line option: --pac-plt. In the presence of this option, the linker uses the PAC enabled PLTs and marks with DT_AARCH64_PAC_PLT. 4) In case both BTI and PAC are enabled the linker should pick PLTs enabled with both and also use dynamic tags for both. All these are made according to the new AArch64 ELF ABI https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4 *** bfd/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> * elfnn-aarch64.c (PLT_PAC_ENTRY_SIZE, PLT_PAC_SMALL_ENTRY_SIZE): New. (PLT_BTI_PAC_ENTRY_SIZE, PLT_BTI_PAC_SMALL_ENTRY_SIZE): New. (setup_plt_values): Account for PAC or PAC and BTI enabled PLTs. (elfNN_aarch64_size_dynamic_sections): Add checks for PLT_BTI_PAC and PLT_PAC_PLT. (elfNN_aarch64_finish_dynamic_sections): Account for PLT_BTI_PAC. (get_plt_type): Add case for DT_AARCH64_PAC_PLT. (elfNN_aarch64_plt_sym_val): Add cases for PLT_BTI_PAC and PLT_PAC. *** binutils/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> * readelf.c (get_aarch64_dynamic_type): Add case for DT_AARCH64_PAC_PLT. (dynamic_section_aarch64_val): Likewise. *** include/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> * elf/aarch64.h (DT_AARCH64_PAC_PLT): New. *** ld/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> * NEWS: Document --pac-plt. * emultempl/aarch64elf.em (OPTION_PAC_PLT): New. (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add pac-plt. (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_PAC_PLT. * testsuite/ld-aarch64/aarch64-elf.exp: Add the following tests. * testsuite/ld-aarch64/bti-pac-plt-1.d: New test. * testsuite/ld-aarch64/bti-pac-plt-2.d: New test. * testsuite/ld-aarch64/pac-plt-1.d: New test. * testsuite/ld-aarch64/pac-plt-2.d: New test. * testsuite/ld-aarch64/bti-plt-1.s: Add .ifndef directive.
2019-03-13 12:09:10 +01:00
2019-03-13 Sudakshina Das <sudi.das@arm.com>
* elfnn-aarch64.c (PLT_PAC_ENTRY_SIZE, PLT_PAC_SMALL_ENTRY_SIZE): New.
(PLT_BTI_PAC_ENTRY_SIZE, PLT_BTI_PAC_SMALL_ENTRY_SIZE): New.
(setup_plt_values): Account for PAC or PAC and BTI enabled PLTs.
(elfNN_aarch64_size_dynamic_sections): Add checks for PLT_BTI_PAC
and PLT_PAC_PLT.
(elfNN_aarch64_finish_dynamic_sections): Account for PLT_BTI_PAC.
(get_plt_type): Add case for DT_AARCH64_PAC_PLT.
(elfNN_aarch64_plt_sym_val): Add cases for PLT_BTI_PAC and PLT_PAC.
[BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs This is part of the patch series to add support for BTI and PAC in AArch64 linker. 1) This patch adds a new ld command line option: --force-bti. In the presence of this option, the linker enables BTI with the GNU_PROPERTY_AARCH64_FEATURE_1_BTI feature. This gives out warning in case of missing gnu notes for BTI in inputs. 2) It also defines a new set of BTI enabled PLTs. These are used either when all the inputs are marked with GNU_PROPERTY_AARCH64_FEATURE_1_BTI or when the new --force-bti option is used. This required adding new fields in elf_aarch64_link_hash_table so that we could make the PLT related information more generic. 3) It also defines a dynamic tag DT_AARCH64_BTI_PLT. The linker uses this whenever it picks BTI enabled PLTs. All these are made according to the new AArch64 ELF ABI https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4 *** bfd/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> Szabolcs Nagy <szabolcs.nagy@arm.com> * bfd-in.h (aarch64_plt_type, aarch64_enable_bti_type): New. (aarch64_bti_pac_info): New. (bfd_elf64_aarch64_set_options): Add aarch64_bti_pac_info argument. (bfd_elf32_aarch64_set_options): Likewise. * bfd-in2.h: Regenerate * elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): New. (PLT_BTI_SMALL_ENTRY_SIZE, PLT_BTI_TLSDESC_ENTRY_SIZE): New. (elfNN_aarch64_small_plt0_bti_entry): New. (elfNN_aarch64_small_plt_bti_entry): New. (elfNN_aarch64_tlsdesc_small_plt_bti_entry): New. (elf_aarch64_obj_tdata): Add no_bti_warn and plt_type fields. (elf_aarch64_link_hash_table): Add plt0_entry, plt_entry and tlsdesc_plt_entry_size fields. (elfNN_aarch64_link_hash_table_create): Initialise the new fields. (setup_plt_values): New helper function. (bfd_elfNN_aarch64_set_options): Use new bp_info to set plt sizes and bti enable type. (elfNN_aarch64_allocate_dynrelocs): Use new size members instead of fixed macros. (elfNN_aarch64_size_dynamic_sections): Likewise and add checks. (elfNN_aarch64_create_small_pltn_entry): Use new generic pointers to plt stubs instead of fixed ones and update filling them according to the need for bti. (elfNN_aarch64_init_small_plt0_entry): Likewise. (elfNN_aarch64_finish_dynamic_sections): Likewise. (get_plt_type, elfNN_aarch64_get_synthetic_symtab): New. (elfNN_aarch64_plt_sym_val): Update size accordingly. (elfNN_aarch64_link_setup_gnu_properties): Set up plts if BTI GNU NOTE is set. (bfd_elfNN_get_synthetic_symtab): Define. (elfNN_aarch64_merge_gnu_properties): Give out warning with --force-bti and mising BTI NOTE SECTION. *** binutils/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> Szabolcs Nagy <szabolcs.nagy@arm.com> * readelf.c (get_aarch64_dynamic_type): New. (get_dynamic_type): Use above for EM_AARCH64. (dynamic_section_aarch64_val): New. (process_dynamic_section): Use above for EM_AARCH64. *** include/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> Szabolcs Nagy <szabolcs.nagy@arm.com> * elf/aarch64.h (DT_AARCH64_BTI_PLT): New. *** ld/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> Szabolcs Nagy <szabolcs.nagy@arm.com> * NEWS: Document --force-bti. * emultempl/aarch64elf.em (plt_type, bti_type, OPTION_FORCE_BTI): New. (PARSE_AND_LIST_SHORTOPTS, PARSE_AND_LIST_OPTIONS): Add force-bti. (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_FORCE_BTI. * testsuite/ld-aarch64/aarch64-elf.exp: Add all the tests below. * testsuite/ld-aarch64/bti-plt-1.d: New test. * testsuite/ld-aarch64/bti-plt-1.s: New test. * testsuite/ld-aarch64/bti-plt-2.s: New test. * testsuite/ld-aarch64/bti-plt-2.d: New test. * testsuite/ld-aarch64/bti-plt-3.d: New test. * testsuite/ld-aarch64/bti-plt-4.d: New test. * testsuite/ld-aarch64/bti-plt-5.d: New test. * testsuite/ld-aarch64/bti-plt-6.d: New test. * testsuite/ld-aarch64/bti-plt-7.d: New test. * testsuite/ld-aarch64/bti-plt-so.s: New test. * testsuite/ld-aarch64/bti-plt.ld: New test.
2019-03-13 11:54:30 +01:00
2019-03-13 Sudakshina Das <sudi.das@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* bfd-in.h (aarch64_plt_type, aarch64_enable_bti_type): New.
(aarch64_bti_pac_info): New.
(bfd_elf64_aarch64_set_options): Add aarch64_bti_pac_info argument.
(bfd_elf32_aarch64_set_options): Likewise.
* bfd-in2.h: Regenerate
* elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): New.
(PLT_BTI_SMALL_ENTRY_SIZE, PLT_BTI_TLSDESC_ENTRY_SIZE): New.
(elfNN_aarch64_small_plt0_bti_entry): New.
(elfNN_aarch64_small_plt_bti_entry): New.
(elfNN_aarch64_tlsdesc_small_plt_bti_entry): New.
(elf_aarch64_obj_tdata): Add no_bti_warn and plt_type fields.
(elf_aarch64_link_hash_table): Add plt0_entry, plt_entry and
tlsdesc_plt_entry_size fields.
(elfNN_aarch64_link_hash_table_create): Initialise the new fields.
(setup_plt_values): New helper function.
(bfd_elfNN_aarch64_set_options): Use new bp_info to set plt sizes and
bti enable type.
(elfNN_aarch64_allocate_dynrelocs): Use new size members instead of
fixed macros.
(elfNN_aarch64_size_dynamic_sections): Likewise and add checks.
(elfNN_aarch64_create_small_pltn_entry): Use new generic pointers
to plt stubs instead of fixed ones and update filling them according
to the need for bti.
(elfNN_aarch64_init_small_plt0_entry): Likewise.
(elfNN_aarch64_finish_dynamic_sections): Likewise.
(get_plt_type, elfNN_aarch64_get_synthetic_symtab): New.
(elfNN_aarch64_plt_sym_val): Update size accordingly.
(elfNN_aarch64_link_setup_gnu_properties): Set up plts if BTI GNU NOTE
is set.
(bfd_elfNN_get_synthetic_symtab): Define.
(elfNN_aarch64_merge_gnu_properties): Give out warning with --force-bti
and mising BTI NOTE SECTION.
[BFD, LD, AArch64, 1/3] Add support for GNU PROPERTIES in AArch64 for BTI and PAC This is part of the patch series to add support for BTI and PAC in AArch64 linker. This patch implements the following: 1) This extends in the gnu property support in the linker for AArch64 by defining backend hooks for elf_backend_setup_gnu_properties, elf_backend_merge_gnu_properties and elf_backend_parse_gnu_properties. 2) It defines AArch64 specific GNU property GNU_PROPERTY_AARCH64_FEATURE_1_AND and 2 bit for BTI and PAC in it. 3) It also adds support in readelf.c to read and print these new GNU properties in AArch64. All these are made according to the new AArch64 ELF ABI https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4 *** bfd/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Exclude linker created inputs from merge. * elfnn-aarch64.c (struct elf_aarch64_obj_tdata): Add field for GNU_PROPERTY_AARCH64_FEATURE_1_AND properties. (elfNN_aarch64_link_setup_gnu_properties): New. (elfNN_aarch64_merge_gnu_properties): New. (elf_backend_setup_gnu_properties): Define for AArch64. (elf_backend_merge_gnu_properties): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Define. (_bfd_aarch64_elf_parse_gnu_properties): Define. (_bfd_aarch64_elf_merge_gnu_properties): Define. * elfxx-aarch64.h (_bfd_aarch64_elf_link_setup_gnu_properties): Declare. (_bfd_aarch64_elf_parse_gnu_properties): Declare. (_bfd_aarch64_elf_merge_gnu_properties): Declare. (elf_backend_parse_gnu_properties): Define for AArch64. *** binutils/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> * readelf.c (decode_aarch64_feature_1_and): New. (print_gnu_property_note): Add case for AArch64 gnu notes. *** include/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> * elf/common.h (GNU_PROPERTY_AARCH64_FEATURE_1_AND): New. (GNU_PROPERTY_AARCH64_FEATURE_1_BTI): New. (GNU_PROPERTY_AARCH64_FEATURE_1_PAC): New. *** ld/ChangeLog *** 2019-03-13 Sudakshina Das <sudi.das@arm.com> * NEWS: Document GNU_PROPERTY_AARCH64_FEATURE_1_BTI and GNU_PROPERTY_AARCH64_FEATURE_1_PAC. * testsuite/ld-aarch64/aarch64-elf.exp: Add run commands for new tests. * testsuite/ld-aarch64/property-bti-pac1.d: New test. * testsuite/ld-aarch64/property-bti-pac1.s: New test. * testsuite/ld-aarch64/property-bti-pac2.d: New test. * testsuite/ld-aarch64/property-bti-pac2.s: New test. * testsuite/ld-aarch64/property-bti-pac3.d: New test.
2019-03-13 11:42:27 +01:00
2019-03-13 Sudakshina Das <sudi.das@arm.com>
* elf-properties.c (_bfd_elf_link_setup_gnu_properties): Exclude
linker created inputs from merge.
* elfnn-aarch64.c (struct elf_aarch64_obj_tdata): Add field for
GNU_PROPERTY_AARCH64_FEATURE_1_AND properties.
(elfNN_aarch64_link_setup_gnu_properties): New.
(elfNN_aarch64_merge_gnu_properties): New.
(elf_backend_setup_gnu_properties): Define for AArch64.
(elf_backend_merge_gnu_properties): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Define.
(_bfd_aarch64_elf_parse_gnu_properties): Define.
(_bfd_aarch64_elf_merge_gnu_properties): Define.
* elfxx-aarch64.h (_bfd_aarch64_elf_link_setup_gnu_properties): Declare.
(_bfd_aarch64_elf_parse_gnu_properties): Declare.
(_bfd_aarch64_elf_merge_gnu_properties): Declare.
(elf_backend_parse_gnu_properties): Define for AArch64.
2019-03-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24322
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Properly
merge GNU_PROPERTY_X86_FEATURE_1_[IBT|SHSTK].
Don't use bfd_get_file_size in objdump Compressed debug sections can have uncompressed sizes that exceed the original file size, so we can't use bfd_get_file_size. objdump also used bfd_get_file_size to limit reloc section size, but I believe the underlying bug causing the PR22508 out of bounds buffer access was that we had an integer overflow when calculating the reloc buffer size. I've fixed that instead in most of the backends, som and vms-alpha being the exceptions. SOM and vmd-alpha have rather more serious bugs in their slurp_relocs routines that would need fixing first if we want to fuss about making them safe against fuzzed object files. The patch also fixes a number of other potential overflows by using the bfd_alloc2/malloc2/zalloc2 memory allocation functions. bfd/ * coffcode.h (buy_and_read): Delete unnecessary forward decl. Add nmemb parameter. Use bfd_alloc2. (coff_slurp_line_table): Use bfd_alloc2. Update buy_and_read calls. Delete assertion. (coff_slurp_symbol_table): Use bfd_alloc2 and bfd_zalloc2. (coff_slurp_reloc_table): Use bfd_alloc2. Update buy_and_read calls. * coffgen.c (coff_get_reloc_upper_bound): Ensure size calculation doesn't overflow. * elf.c (bfd_section_from_shdr): Use bfd_zalloc2. Style fix. (assign_section_numbers): Style fix. (swap_out_syms): Use bfd_malloc2. (_bfd_elf_get_reloc_upper_bound): Ensure size calculation doesn't overflow. (_bfd_elf_make_empty_symbol): Style fix. (elfobj_grok_stapsdt_note_1): Formatting. * elfcode.h (elf_object_p): Use bfd_alloc2. (elf_write_relocs, elf_write_shdrs_and_ehdr): Likewise. (elf_slurp_symbol_table): Use bfd_zalloc2. (elf_slurp_reloc_table): Use bfd_alloc2. (_bfd_elf_bfd_from_remote_memory): Use bfd_malloc2. * elf64-sparc (elf64_sparc_get_reloc_upper_bound): Ensure size calculation doesn't overflow. (elf64_sparc_get_dynamic_reloc_upper_bound): Likewise. * mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise. * pdp11.c (get_reloc_upper_bound): Copy aoutx.h version. binutils/ * objdump.c (load_specific_debug_section): Don't compare section size against file size. (dump_relocs_in_section): Don't compare reloc size against file size. Print "failed to read relocs" on bfd_get_reloc_upper_bound error.
2019-03-12 06:49:25 +01:00
2019-03-12 Alan Modra <amodra@gmail.com>
* coffcode.h (buy_and_read): Delete unnecessary forward decl. Add
nmemb parameter. Use bfd_alloc2.
(coff_slurp_line_table): Use bfd_alloc2. Update buy_and_read calls.
Delete assertion.
(coff_slurp_symbol_table): Use bfd_alloc2 and bfd_zalloc2.
(coff_slurp_reloc_table): Use bfd_alloc2. Update buy_and_read calls.
* coffgen.c (coff_get_reloc_upper_bound): Ensure size calculation
doesn't overflow.
* elf.c (bfd_section_from_shdr): Use bfd_zalloc2. Style fix.
(assign_section_numbers): Style fix.
(swap_out_syms): Use bfd_malloc2.
(_bfd_elf_get_reloc_upper_bound): Ensure size calculation doesn't
overflow.
(_bfd_elf_make_empty_symbol): Style fix.
(elfobj_grok_stapsdt_note_1): Formatting.
* elfcode.h (elf_object_p): Use bfd_alloc2.
(elf_write_relocs, elf_write_shdrs_and_ehdr): Likewise.
(elf_slurp_symbol_table): Use bfd_zalloc2.
(elf_slurp_reloc_table): Use bfd_alloc2.
(_bfd_elf_bfd_from_remote_memory): Use bfd_malloc2.
* elf64-sparc (elf64_sparc_get_reloc_upper_bound): Ensure
size calculation doesn't overflow.
(elf64_sparc_get_dynamic_reloc_upper_bound): Likewise.
* mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
* pdp11.c (get_reloc_upper_bound): Copy aoutx.h version.
2019-03-08 Alan Modra <amodra@gmail.com>
PR 24311
* merge.c (merge_strings): Return secinfo. Don't pad section
to alignment here.
(_bfd_merge_sections): Pad section to alignment here, if input
sections contributing to merged output all pad to alignment.
Formatting.
2019-03-06 Nick Clifton <nickc@redhat.com>
* dwarf2.c (_bfd_dwarf2_find_symbol_bias): Check for a NULL symbol
table pointer.
* coffgen.c (coff_find_nearest_line_with_names): Do not call
_bfd_dwarf2_find_symbol_bias if there is no symbol table available.
2019-03-01 Andreas Krebbel <krebbel@linux.ibm.com>
This reverts commit 5a12586d44fa8d5dfc74cbca4f2f36a273a16335.
2019-01-14 Maamoun Tarsha <maamountk@hotmail.com>
PR 20113
* elf32-s390.c (allocate_dynrelocs): Update comment.
2019-02-28 Tamar Christina <tamar.christina@arm.com>
* elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Correct CIE parse.
2019-02-28 Nick Clifton <nickc@redhat.com>
PR 24273
* elf.c (bfd_elf_string_from_elf_section): Check for a string
section that is not NUL terminated.
2019-02-27 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24276
* elf64-x86-64.c (elf_x86_64_check_relocs): Skip symbol defined
by linker when checking copy reloc on protected symbol.
2019-02-24 Alan Modra <amodra@gmail.com>
PR 24144
* pdp11.c (set_section_contents): Revert 2015-02-24 change.
2019-02-20 Eric Tsai <erictsai@cadence.com>
* elf32-xtensa.c (is_resolvable_asm_expansion): Scan output
sections between the call site and call destination and adjust
call distance by the largest alignment.
2019-02-20 Alan Hayward <alan.hayward@arm.com>
* elf-bfd.h (elfcore_write_aarch_pauth): Add declaration.
* elf.c (elfcore_grok_aarch_pauth): New function.
(elfcore_grok_note): Check for NT_ARM_PAC_MASK.
(elfcore_write_aarch_pauth): New function.
(elfcore_write_register_note): Check for AArch64 pauth section.
2019-02-20 Alan Modra <amodra@gmail.com>
PR 24225
* elf32-nios2.c (nios2_elf32_relocate_section): Check asprintf
return value.
2019-02-20 Michael Roitzsch <reactorcontrol@icloud.com>
* configure.ac (SHARED_LIBADD): Add -liberty -lintl for all
Darwin hosts, not just or1k.
* configure: Regenerate.
2019-02-20 Alan Modra <amodra@gmail.com>
PR 24236
* archive64.c (_bfd_archive_64_bit_slurp_armap): Move code adding
sentinel NUL to string buffer nearer to loop where it is used.
Don't go past sentinel when scanning strings, and don't write
NUL again.
* archive.c (do_slurp_coff_armap): Simplify string handling to
archive64.c style.
2019-02-19 Alan Modra <amodra@gmail.com>
PR 24235
* pei-x86_64.c (pex64_bfd_print_pdata_section): Correct checks
attempting to prevent read past end of section.
2019-02-18 Alan Modra <amodra@gmail.com>
PR 24225
* elf32-nios2.c (nios2_elf32_relocate_section): Use asprintf and
PRIx64 to generate warning messages. Print local sym names too.
2019-02-09 Vineet Gupta <vgupta@synopsys.com>
* elf32-arc (INIT_SYM_STRING): Delete.
(FINI_SYM_STRING): Likewise.
(init_str): Likewise.
(fini_str): Likewise.
2019-02-08 Alan Modra <amodra@gmail.com>
* elf32-ppc.c (ppc_elf_relocate_section): Add %X to "unsupported
for bss-plt" warning to make it an error.
2019-02-07 Eric Botcazou <ebotcazou@adacore.com>
PR ld/18841
* elf32-sparc.c (elf32_sparc_reloc_type_class): Return
reloc_class_ifunc for ifunc symbols.
* elf64-sparc.c (elf64_sparc_reloc_type_class): Likewise.
2019-02-07 Eric Botcazou <ebotcazou@adacore.com>
* elf32-visium.c (visium_elf_howto_parity_reloc): Minor tweak.
<R_VISIUM_PC16>: Use explicit range test to detect an overflow.
2019-02-07 Nick Clifton <nickc@redhat.com>
* config.bfd: Move the powerpc-lynxos and powerpc-windiss targets
into the definitely obsolete list.
2019-02-05 H.J. Lu <hongjiu.lu@intel.com>
PR ld/24151
* elf64-x86-64.c (elf_x86_64_need_pic): Check
SYMBOL_DEFINED_NON_SHARED_P instead of def_regular.
(elf_x86_64_relocate_section): Move PIC check for PC-relative
relocations to ...
(elf_x86_64_check_relocs): Here.
(elf_x86_64_finish_dynamic_symbol): Use SYMBOL_DEFINED_NON_SHARED_P
to check if a symbol is defined in a non-shared object.
* elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): New.
2019-01-21 Sergio Durigan Junior <sergiodj@redhat.com>
* elf32-arm.c (elf32_arm_final_link_relocate): Use 'llabs' instead
of 'labs' (and fix GCC warning).
2019-01-25 Nick Clifton <nickc@redhat.com>
* po/ru.po: Updated Russian translation.
2019-01-23 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation.
2019-01-21 Nick Clifton <nickc@redhat.com>
* po/pt.po: Updated Portuguese translation.
* po/uk.po: Updated Ukranian translation.
2019-01-21 Yuri Chornoivan <yurchor@ukr.net>
PR 24108
* elf32-nds32.c (nds32_relocate_section): Add space between words
in error message.
* elfnn-riscv.c (riscv_version_mismatch): Fix spelling mistake in
error message.
(riscv_i_or_e_p): Likewise.
(riscv_merge_arch_attr_info): Likewise.
2019-01-19 Nick Clifton <nickc@redhat.com>
* version.m4: Reset to 2.32.51
* configure: Regenerate.
* po/bfd.pot: Regenerate.
2018-06-24 Nick Clifton <nickc@redhat.com>
2.32 branch created.
2019-01-16 Kito Cheng <kito@andestech.com>
* elf-attrs.c (vendor_obj_attr_size): Return 0 if size is 0 even
for OBJ_ATTR_PROC.
RISC-V: Support ELF attribute for gas and readelf. 2019-01-16 Kito Cheng <kito@andestech.com> Nelson Chu <nelson@andestech.com> bfd/ * elfnn-riscv.c (riscv_elf_obj_attrs_arg_type): New. (elf_backend_obj_attrs_vendor): Define. (elf_backend_obj_attrs_section_type): Likewise. (elf_backend_obj_attrs_section): Likewise. (elf_backend_obj_attrs_arg_type): Define as riscv_elf_obj_attrs_arg_type. * elfxx-riscv.c (riscv_estimate_digit): New. (riscv_estimate_arch_strlen1): Likewise. (riscv_estimate_arch_strlen): Likewise. (riscv_arch_str1): Likewise. (riscv_arch_str): Likewise. * elfxx-riscv.h (riscv_arch_str): Declare. binutils/ * readelf.c (get_riscv_section_type_name): New function. (get_section_type_name): Add handler for RISC-V. (riscv_attr_tag_t): Declare. (riscv_attr_tag): New. (display_riscv_attribute): New function. (process_attributes): Add handler for RISC-V. * testsuite/binutils-all/strip-3.d: Remove .riscv.attribute section. gas/ * config/tc-riscv.c (DEFAULT_RISCV_ATTR): Define to 0 if not defined. (riscv_set_options): Add `arch_attr` field. (riscv_opts): Set default value for arch_attr. (riscv_write_out_arch_attr): New. (riscv_set_public_attributes): Likewise. (riscv_md_end): Likewise. (riscv_convert_symbolic_attribute): Likewise. (s_riscv_attribute): Likewise. (explicit_arch_attr): Likewise. (riscv_pseudo_table): Add .attribute to the table. (options): Add OPTION_ARCH_ATTR and OPTION_NO_ARCH_ATTR enumeration constants. (md_longopts): Add `march-attr' and `mno-arch-attr' options. (md_parse_option): Handle the new options. (md_show_usage): Document the `march-attr' option. * config/tc-riscv.h (md_end): Define as riscv_md_end (riscv_md_end): Declare. (CONVERT_SYMBOLIC_ATTRIBUTE): Define as riscv_convert_symbolic_attribute. (riscv_convert_symbolic_attribute): Declare. (start_assemble): Declare. * testsuite/gas/elf/elf.exp: Adjust test case for section2.e. * testsuite/gas/elf/section2.e-riscv: New. * testsuite/gas/riscv/attribute-01.d: New test * testsuite/gas/riscv/attribute-02.d: Likewise. * testsuite/gas/riscv/attribute-03.d: Likewise. * testsuite/gas/riscv/attribute-04.d: Likewise. * testsuite/gas/riscv/attribute-04.s: Likewise. * testsuite/gas/riscv/attribute-05.d: Likewise. * testsuite/gas/riscv/attribute-05.s: Likewise. * testsuite/gas/riscv/attribute-06.d: Likewise. * testsuite/gas/riscv/attribute-06.s: Likewise. * testsuite/gas/riscv/attribute-07.d: Likewise. * testsuite/gas/riscv/attribute-07.s: Likewise. * testsuite/gas/riscv/attribute-08.d: Likewise. * testsuite/gas/riscv/attribute-08.s: Likewise. * testsuite/gas/riscv/attribute-unknown.d: Likewise. * testsuite/gas/riscv/attribute-unknown.s: Likewise. * testsuite/gas/riscv/empty.l: Likewise. * doc/c-riscv.texi (.attribute): Add documentation. * configure.ac (--enable-default-riscv-attribute): New options. * configure: Re-generate. * config.in: Re-generate. include/ * elf/riscv.h (SHT_RISCV_ATTRIBUTES): Define. (Tag_RISCV_arch): Likewise. (Tag_RISCV_priv_spec): Likewise. (Tag_RISCV_priv_spec_minor): Likewise. (Tag_RISCV_priv_spec_revision): Likewise. (Tag_RISCV_unaligned_access): Likewise. (Tag_RISCV_stack_align): Likewise.
2019-01-16 22:14:59 +01:00
2019-01-16 Kito Cheng <kito@andestech.com>
Nelson Chu <nelson@andestech.com>
RISC-V: Merge ELF attribute for ld. 2019-01-16 Kito Cheng <kito@andestech.com> Nelson Chu <nelson@andestech.com> bfd/ * elfnn-riscv.c (in_subsets): New. (out_subsets): Likewise. (merged_subsets): Likewise. (riscv_std_ext_p): Likewise. (riscv_non_std_ext_p): Likewise. (riscv_std_sv_ext_p): Likewise. (riscv_non_std_sv_ext_p): Likewise. (riscv_version_mismatch): Likewise. (riscv_i_or_e_p): Likewise. (riscv_merge_std_ext): Likewise. (riscv_merge_non_std_and_sv_ext): Likewise. (riscv_merge_arch_attr_info): Likewise. (riscv_merge_attributes): Likewise. (_bfd_riscv_elf_merge_private_bfd_data): Merge attribute. ld/ * testsuite/ld-elf/orphan-region.d: XFAIL for RISC-V, because add new section. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Add new tests. * testsuite/ld-riscv-elf/attr-merge-arch-01.d: New test. * testsuite/ld-riscv-elf/attr-merge-arch-01a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-01b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-02a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-02b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-03a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-03b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-failed-a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-failed-b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-failed.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-01.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-01a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-01b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-02.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-02a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-02b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-03.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-03a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-03b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-04.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-04a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-04b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-05.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-05a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-05b.s: Likewise.
2019-01-16 22:28:35 +01:00
* elfnn-riscv.c (in_subsets): New.
(out_subsets): Likewise.
(merged_subsets): Likewise.
(riscv_std_ext_p): Likewise.
(riscv_non_std_ext_p): Likewise.
(riscv_std_sv_ext_p): Likewise.
(riscv_non_std_sv_ext_p): Likewise.
(riscv_version_mismatch): Likewise.
(riscv_i_or_e_p): Likewise.
(riscv_merge_std_ext): Likewise.
(riscv_merge_non_std_and_sv_ext): Likewise.
(riscv_merge_arch_attr_info): Likewise.
(riscv_merge_attributes): Likewise.
(_bfd_riscv_elf_merge_private_bfd_data): Merge attribute.
RISC-V: Support ELF attribute for gas and readelf. 2019-01-16 Kito Cheng <kito@andestech.com> Nelson Chu <nelson@andestech.com> bfd/ * elfnn-riscv.c (riscv_elf_obj_attrs_arg_type): New. (elf_backend_obj_attrs_vendor): Define. (elf_backend_obj_attrs_section_type): Likewise. (elf_backend_obj_attrs_section): Likewise. (elf_backend_obj_attrs_arg_type): Define as riscv_elf_obj_attrs_arg_type. * elfxx-riscv.c (riscv_estimate_digit): New. (riscv_estimate_arch_strlen1): Likewise. (riscv_estimate_arch_strlen): Likewise. (riscv_arch_str1): Likewise. (riscv_arch_str): Likewise. * elfxx-riscv.h (riscv_arch_str): Declare. binutils/ * readelf.c (get_riscv_section_type_name): New function. (get_section_type_name): Add handler for RISC-V. (riscv_attr_tag_t): Declare. (riscv_attr_tag): New. (display_riscv_attribute): New function. (process_attributes): Add handler for RISC-V. * testsuite/binutils-all/strip-3.d: Remove .riscv.attribute section. gas/ * config/tc-riscv.c (DEFAULT_RISCV_ATTR): Define to 0 if not defined. (riscv_set_options): Add `arch_attr` field. (riscv_opts): Set default value for arch_attr. (riscv_write_out_arch_attr): New. (riscv_set_public_attributes): Likewise. (riscv_md_end): Likewise. (riscv_convert_symbolic_attribute): Likewise. (s_riscv_attribute): Likewise. (explicit_arch_attr): Likewise. (riscv_pseudo_table): Add .attribute to the table. (options): Add OPTION_ARCH_ATTR and OPTION_NO_ARCH_ATTR enumeration constants. (md_longopts): Add `march-attr' and `mno-arch-attr' options. (md_parse_option): Handle the new options. (md_show_usage): Document the `march-attr' option. * config/tc-riscv.h (md_end): Define as riscv_md_end (riscv_md_end): Declare. (CONVERT_SYMBOLIC_ATTRIBUTE): Define as riscv_convert_symbolic_attribute. (riscv_convert_symbolic_attribute): Declare. (start_assemble): Declare. * testsuite/gas/elf/elf.exp: Adjust test case for section2.e. * testsuite/gas/elf/section2.e-riscv: New. * testsuite/gas/riscv/attribute-01.d: New test * testsuite/gas/riscv/attribute-02.d: Likewise. * testsuite/gas/riscv/attribute-03.d: Likewise. * testsuite/gas/riscv/attribute-04.d: Likewise. * testsuite/gas/riscv/attribute-04.s: Likewise. * testsuite/gas/riscv/attribute-05.d: Likewise. * testsuite/gas/riscv/attribute-05.s: Likewise. * testsuite/gas/riscv/attribute-06.d: Likewise. * testsuite/gas/riscv/attribute-06.s: Likewise. * testsuite/gas/riscv/attribute-07.d: Likewise. * testsuite/gas/riscv/attribute-07.s: Likewise. * testsuite/gas/riscv/attribute-08.d: Likewise. * testsuite/gas/riscv/attribute-08.s: Likewise. * testsuite/gas/riscv/attribute-unknown.d: Likewise. * testsuite/gas/riscv/attribute-unknown.s: Likewise. * testsuite/gas/riscv/empty.l: Likewise. * doc/c-riscv.texi (.attribute): Add documentation. * configure.ac (--enable-default-riscv-attribute): New options. * configure: Re-generate. * config.in: Re-generate. include/ * elf/riscv.h (SHT_RISCV_ATTRIBUTES): Define. (Tag_RISCV_arch): Likewise. (Tag_RISCV_priv_spec): Likewise. (Tag_RISCV_priv_spec_minor): Likewise. (Tag_RISCV_priv_spec_revision): Likewise. (Tag_RISCV_unaligned_access): Likewise. (Tag_RISCV_stack_align): Likewise.
2019-01-16 22:14:59 +01:00
* elfnn-riscv.c (riscv_elf_obj_attrs_arg_type): New.
(elf_backend_obj_attrs_vendor): Define.
(elf_backend_obj_attrs_section_type): Likewise.
(elf_backend_obj_attrs_section): Likewise.
(elf_backend_obj_attrs_arg_type): Define as
riscv_elf_obj_attrs_arg_type.
* elfxx-riscv.c (riscv_estimate_digit): New.
(riscv_estimate_arch_strlen1): Likewise.
(riscv_estimate_arch_strlen): Likewise.
(riscv_arch_str1): Likewise.
(riscv_arch_str): Likewise.
* elfxx-riscv.h (riscv_arch_str): Declare.
2019-01-14 John Darrington <john@darrington.wattle.id.au>
* bfd-in2.h [BFD_RELOC_S12Z_OPR]: New reloc.
* libbfd.h: regen.
* elf32-s12z.c (eld_s12z_howto_table): R_S12Z_OPR takes non zero
source field. (md_apply_fix): Apply final fix
to BFD_RELOC_S12Z_OPR.
* reloc.c[BFD_RELOC_S12Z_OPR]: New reloc.
2019-01-14 Maamoun Tarsha <maamountk@hotmail.com>
2019-01-14 17:04:18 +01:00
PR 20113
* elf32-s390.c (allocate_dynrelocs): Update comment.
2019-01-09 Andrew Paprocki <andrew@ishiboo.com>
* warning.m4: Adjust egrep pattern for non-GNU compilers.
* configure: Regenerate.
2019-01-08 Alan Modra <amodra@gmail.com>
PR 23699
PR 24065
* ihex.c (ihex_write_object_contents): Properly check 32-bit
address range.
2019-01-05 Yoshinori Sato <ysato@users.sourceforge.jp>
* bfd/archures.c: Add bfd_mach_rx_v2 and bfd_mach_rx_v3.
* bfd/bfd-in2.h: Regenerate.
* bfd/cpu-rx.c (arch_info_struct): Add RXv2 and RXv3 entry.
* bfd/elf32-rx.c (elf32_rx_machine): Add RXv2 and RXv3 support.
2019-01-04 Lifang Xia <lifang_xia@c-sky.com>
* config.bfd (csky-*-elf* | csky-*-linux*): Modify the csky
default target, little endian target is more suitable.
2019-01-04 Alan Modra <amodra@gmail.com>
PR 24061
PR 21786
* coff-rs6000.c (GET_VALUE_IN_FIELD): Add base parameter and
adjust all callers.
(EQ_VALUE_IN_FIELD): Likewise.
* coff64-rs6000.c (GET_VALUE_IN_FIELD): Likewise.
2019-01-01 Alan Modra <amodra@gmail.com>
Update year range in copyright notice of all files.
2019-01-01 11:53:15 +01:00
For older changes see ChangeLog-2018
2019-01-01 11:53:15 +01:00
Copyright (C) 2019 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
Local Variables:
mode: change-log
left-margin: 8
fill-column: 74
version-control: never
End: