3 * cofflink.c (_bfd_coff_write_global_sym): Range-check symbol
9 * elf.c (bfd_elf_generic_reloc): Make references between debug
10 sections use section relative values.
14 * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Diagnose out of range RVA.
20 * bfd.c (_bfd_get_link_info): New function.
21 * elf-bfd.h (output_elf_obj_tdata): Add link_info.
23 * libbfd-in.h (_bfd_get_link_info): New prototype.
24 * coff-x86_64.c (coff_amd64_reloc): Also subtract __ImageBase for
25 R_AMD64_IMAGEBASE when generating x86-64 ELF executable.
26 * pe-x86_64.c: Include "coff/internal.h" and "libcoff.h".
27 (pex64_link_add_symbols): New function.
28 (coff_bfd_link_add_symbols): New macro.
29 * libbfd.h: Regenerated.
34 * elf-bfd.h (elfcore_write_riscv_csr): Declare.
35 * elf.c (elfcore_grok_riscv_csr): New function.
36 (elfcore_grok_note): Handle NT_RISCV_CSR.
37 (elfcore_write_riscv_csr): New function.
38 (elfcore_write_register_note): Handle '.reg-riscv-csr'.
43 * elfnn-riscv.c (PRPSINFO_PR_FNAME_LENGTH): Define.
44 (PRPSINFO_PR_PSARGS_LENGTH): Define.
45 (riscv_write_core_note): New function.
46 (riscv_elf_grok_psinfo): Make use of two new length defines.
47 (elf_backend_write_core_note): Define.
52 * elf-bfd.h (elfcore_write_gdb_tdesc): Declare new function.
53 * elf.c (elfcore_grok_gdb_tdesc): New function.
54 (elfcore_grok_note): Handle NT_GDB_TDESC.
55 (elfcore_write_gdb_tdesc): New function.
56 (elfcore_write_register_note): Handle NT_GDB_TDESC.
61 * dwarf2.c (is_str_attr): Add DW_FORM_strx* forms.
62 (read_indexed_string): Placeholder function.
63 (read_attribute_value): Handle DW_FORM_strx* and DW_FORM_addrx*
68 * reloc.c (bfd_perform_relocation): Revert 2021-01-12 and
70 * coff-x86_64.c (coff_amd64_reloc): Do more or less the same
71 adjustments here instead. Separate pc-relative adjustments
72 from symbol related adjustments. Tidy comments and formatting.
76 * coffcode.h (sec_to_styp_flags): Don't set IMAGE_SCN_LNK_* in
81 * rs6000-core.c (rs6000coff_core_p): Correct prototype.
86 * elflink.c (_bfd_elf_gc_mark_rsec): Do special start/stop
87 processing not when start/stop symbol section is unmarked but
88 on first time a start/stop symbol is processed.
92 * reloc.c: Include x86_64.h rather than internal.h.
97 * dwarf2.c (scan_unit_for_symbols): Scan twice, once to accumulate
98 function and variable tags and a second time to resolve their
103 * elf-strtab.c (_bfd_elf_strtab_str): Skip strings with zero refcount.
108 * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Ignore synthesized
109 linker defined start/stop symbols when start_stop_gc.
113 * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimise got
114 indirect to pc-relative or toc-relative for undefined symbols.
119 * elflink.c (_bfd_elf_gc_mark_rsec): Ignore synthesized linker
120 defined start/stop symbols when start_stop_gc.
121 (bfd_elf_gc_mark_dynamic_ref_symbol): Likewise.
122 (bfd_elf_define_start_stop): Don't modify ldscript_def syms.
123 * linker.c (bfd_generic_define_start_stop): Likewise.
128 * elf-bfd.h (struct elf_link_hash_entry): Add ref_ir_nonweak.
129 * elflink.c (elf_link_add_object_symbols): Set ref_ir_nonweak and
130 use when deciding an as-needed library should be loaded instead
131 of using the binding of the library definition.
136 * coff-stgo32.c (go32exe_check_format): Sanity check size of
137 header to avoid a buffer overflow.
141 * coff-rs6000.c (_bfd_xcoff_reloc_type_lookup): Remove BFD_RELOC_16.
142 * coff64-rs6000.c (xcoff64_reloc_type_lookup): Likewise.
147 * elfnn-riscv.c (perform_relocation): Updated encoding macros.
148 (_bfd_riscv_relax_call): Likewise.
149 (_bfd_riscv_relax_lui): Likewise.
150 * elfxx-riscv.c (howto_table): Likewise.
154 * Makefile.am: Added cpu-riscv.h.
155 * Makefile.in: Regenerated.
156 * po/SRC-POTFILES.in: Regenerated.
157 * cpu-riscv.h: Added to support spec versions controlling.
158 Also added extern arrays and functions for cpu-riscv.c.
159 (enum riscv_spec_class): Define all spec classes here uniformly.
160 (struct riscv_spec): Added for all specs.
161 (RISCV_GET_SPEC_CLASS): Added to reduce repeated code.
162 (RISCV_GET_SPEC_NAME): Likewise.
163 (RISCV_GET_ISA_SPEC_CLASS): Added to get ISA spec class.
164 (RISCV_GET_PRIV_SPEC_CLASS): Added to get privileged spec class.
165 (RISCV_GET_PRIV_SPEC_NAME): Added to get privileged spec name.
166 * cpu-riscv.c (struct priv_spec_t): Replaced with struct riscv_spec.
167 (riscv_get_priv_spec_class): Replaced with RISCV_GET_PRIV_SPEC_CLASS.
168 (riscv_get_priv_spec_name): Replaced with RISCV_GET_PRIV_SPEC_NAME.
169 (riscv_priv_specs): Moved below.
170 (riscv_get_priv_spec_class_from_numbers): Likewise, updated.
171 (riscv_isa_specs): Moved from include/opcode/riscv.h.
172 * elfnn-riscv.c: Included cpu-riscv.h.
173 (riscv_merge_attributes): Initialize in_priv_spec and out_priv_spec.
174 * elfxx-riscv.c: Included cpu-riscv.h and opcode/riscv.h.
175 (RISCV_UNKNOWN_VERSION): Moved from include/opcode/riscv.h.
176 * elfxx-riscv.h: Removed extern functions to cpu-riscv.h.
180 * wasm-module.c: Guard include of limits.h.
181 (CHAR_BIT): Provide backup define.
182 (wasm_read_leb128): Use CHAR_BIT to size "result" in bits.
183 Correct signed overflow checking.
188 * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Delay
189 copying the elf flags from input BFD to output BFD, until we have
190 checked if the input BFD has no code section or not. Also fix the
191 problem that we only check the first section rather than the entire
192 sections for input BFD.
196 * libbfd.c (_bfd_read_unsigned_leb128): Avoid excessive shift.
197 (_bfd_safe_read_leb128, _bfd_read_signed_leb128): Likewise.
201 * doc/Makefile.am: Replace "cp -p" by "$(LN_S)".
202 * doc/Makefile.in: Re-generate.
206 * elf32-nds32.c (nds32_get_section_contents): Replace
207 bfd_malloc_and_get_section with bfd_get_full_section_contents.
208 (nds32_elf_relax_delete_blanks): Init contents.
209 (nds32_elf_relax_section, nds32_relax_fp_as_gp): Likewise.
213 * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Use
214 bfd_get_full_section_contents.
218 * elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents): Apply
219 all fixes to bfd_generic_get_relocated_section_contents since this
220 function was split out.
224 * config.bfd: Remove ia64 from obsolete list.
229 * elfnn-ia64.c: Revert 2017-10-14 git commit db41f6eb5234.
234 * elf32-avr.c (avr_elf32_load_records_from_section): Use
235 bfd_malloc_and_get_section. Use bfd_byte* vars and remove then
241 * section.c (bfd_get_section_contents): Avoid possible overflow
242 when range checking offset and count.
243 (bfd_set_section_contents): Likewise.
247 * configure.ac (SHARED_LIBADD): Remove explicit -lintl population in
249 * configure: Regenerated.
253 * config.bfd (arm*-*-symbianelf*): Move from obsolete to removed.
254 * configure.ac: Delete symbian entries.
255 * elf-bfd.h (enum elf_target_os): Delete is_symbian.
256 * elf32-arm.c: Remove symbian support. Formatting.
257 * targets.c: Delete symbian entries.
258 * configure: Regenerate.
263 * elf64-x86-64.c (elf_x86_64_relocate_section): Provide more
264 info when failed to convert GOTPCREL relocation.
268 * elfxx-riscv.c (riscv_parse_prefixed_ext): Removed zb*.
273 * elflink.c (elf_link_add_object_symbols): Don't pull in as-needed
274 libraries for IR references on pass over libraries after LTO
280 * elflink.c (_bfd_elf_add_default_symbol): Revert last two changes.
281 (elf_link_add_object_symbols): Here too. Don't pull in as-needed
282 libraries when H is an indirect symbol after calling
283 _bfd_elf_add_default_symbol.
288 * elflink.c (_bfd_elf_add_default_symbol): Clear override when
289 undecorated symbol will have a different version.
294 * elflink.c (_bfd_elf_add_default_symbol): Add override parameter.
295 Use when handling default versioned symbol. Rename existing
296 override variable to nondef_override and use for non-default
298 (elf_link_add_object_symbols): Adjust call to suit. Don't
299 pull in as-needed libraries when override is set.
303 * config.bfd: Add *-*-genode* as a target for AArch64 and x86.
308 * elf32-rl78.c (rl78_elf_relocate_section): Fix calculation of
309 offset for the R_RL78_RH_SADDR relocation.
314 * elflink.c (bfd_elf_link_record_dynamic_symbol): Don't segfault
315 on symbols defined in absolute or other special sections.
320 * elflink.c (_bfd_elf_gc_mark_extra_sections): Use linker_mark to
321 prevent endless looping of linked-to sections.
325 * bfd-elf.h (elfcore_write_file_note): New function.
326 * elf.c (elfcore_write_file_note): New function.
330 * elf32-ft32.c (ft32_reloc_type_lookup): Don't miss ft32_reloc_map[0].
335 * dwarf2.c (read_rnglists): Ignore empty range when parsing line
341 * dwarf2.c (read_rnglists): Advance rngs_ptr after
342 _bfd_safe_read_leb128 when parsing DW_RLE_offset_pair.
346 * elf32-ppc.c: Delete outdated comment.
347 (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Define.
348 * elf64-ppc.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Define.
352 * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't assume
353 section symbols are present.
357 * elf64-ppc.c (elf_hash_entry): New inline function. Use
358 throughout to replace casts.
359 (branch_reloc_hash_match): Remove const from params.
360 (use_local_plt): New function.
361 (allocate_dynrelocs, ppc_build_one_stub, ppc_size_one_stub),
362 (build_global_entry_stubs_and_plt, ppc64_elf_relocate_section):
364 * elf32-ppc.c (use_local_plt): New function.
365 (allocate_dynrelocs, ppc_elf_relocate_section),
366 (write_global_sym_plt): Use use_local_plt.
371 * elflink.c (elf_create_symbuf): Also ignore section symbols.
376 * elfxx-x86.c (_bfd_x86_elf_link_fixup_ifunc_symbol): Don't
377 check pointer_equality_needed.
381 * elf-linker-x86.h (elf_linker_x86_params): Add
382 report_relative_reloc.
383 * elf32-i386.c (elf_i386_relocate_section): Call
384 _bfd_x86_elf_link_report_relative_reloc to report relative
385 relocations for -z report-relative-reloc.
386 (elf_i386_finish_dynamic_symbol): Likewse.
387 * elf64-x86-64.c (elf_x86_64_relocate_section): Likewse.
388 (elf_x86_64_finish_dynamic_symbol): Likewse.
389 * elfxx-x86.c (_bfd_x86_elf_link_report_relative_reloc): New
391 * elfxx-x86.h (_bfd_x86_elf_link_report_relative_reloc): New
396 * compress.c (decompress_contents): Tidy inflateEnd result test.
401 * elflink.c (elf_link_output_extsym): Use version 1 in
402 .gnu.version for undefined unversioned symbols.
406 * elfnn-riscv.c (riscv_relax_delete_bytes): Fixed the indent that
407 caused the by previous commit accidentally.
411 * elfnn-riscv.c: Indent, labels and GNU coding standards tidy,
412 also aligned the code.
416 * elfnn-riscv.c (riscv_merge_attributes): Fix typos of messages.
420 * elfnn-riscv.c: Comments tidy and improvement.
421 * elfxx-riscv.c: Likewise.
422 * elfxx-riscv.h: Likewise.
427 * elf32-bfin.c (bfinfdpic_relocate_section): Skip non SEC_ALLOC
428 section for R_BFIN_FUNCDESC.
432 * elf.c (elfcore_grok_win32pstatus): Check for a note type of 0.
436 * Makefile.in: Regenerate.
437 * doc/Makefile.in: Regenerate.
442 * section.c (struct bfd_section): Remove pattern field.
443 (BFD_FAKE_SECTION): Adjust to suit.
444 * bfd-in2.h: Regenerate.
445 * elflink.c (compare_link_order, elf_fixup_link_order): Delete.
446 (bfd_elf_final_link): Don't call elf_fixup_link_order.
451 * configure.ac: Use GNU_MAKE_JOBSERVER.
452 * aclocal.m4: Regenerated.
453 * configure: Likewise.
458 * reloc.c (bfd_perform_relocation): Adjust R_AMD64_DIR64 and
459 R_AMD64_DIR32 relocations for PE/x86-64 inputs.
464 * configure: Regenerated.
468 * po/fr.po: Updated French translation.
469 * po/pt.po: Updated Portuguese translation.
470 * po/sr.po: Updated Serbian translation.
471 * po/uk.po: Updated Ukranian translation.
475 * configure: Regenerated.
480 * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Handle
481 -z lam-u48 and -z lam-u57.
485 * version.m4: Change to 2.36.50.
486 * configure: Regenerate.
487 * po/bfd.pot: Regenerate.
491 * 2.36 release branch crated.
495 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Also set
496 LAM_U57 when setting LAM_U48.
502 * elflink.c (elf_fixup_link_order): Verify that fixing up
503 SHF_LINK_ORDER doesn't increase the output section size.
507 * configure: Regenerate.
511 * configure: Regenerate.
516 * aix386-core.c (core_aix386_vec): Initialize
517 keep_unused_section_symbol to TARGET_KEEP_UNUSED_SECTION_SYMBOLS.
518 * aout-target.h (MY (vec)): Likewise.
519 * binary.c (binary_vec): Likewise.
520 * cisco-core.c (core_cisco_be_vec): Likewise.
521 (core_cisco_le_vec): Likewise.
522 * coff-alpha.c (alpha_ecoff_le_vec): Likewise.
523 * coff-i386.c (TARGET_SYM): Likewise.
524 (TARGET_SYM_BIG): Likewise.
525 * coff-ia64.c (TARGET_SYM): Likewise.
526 * coff-mips.c (mips_ecoff_le_vec): Likewise.
527 (mips_ecoff_be_vec): Likewise.
528 (mips_ecoff_bele_vec): Likewise.
529 * coff-rs6000.c (rs6000_xcoff_vec): Likewise.
530 (powerpc_xcoff_vec): Likewise.
531 * coff-sh.c (sh_coff_small_vec): Likewise.
532 (sh_coff_small_le_vec): Likewise.
533 * coff-tic30.c (tic30_coff_vec): Likewise.
534 * coff-tic54x.c (tic54x_coff0_vec): Likewise.
535 (tic54x_coff0_beh_vec): Likewise.
536 (tic54x_coff1_vec): Likewise.
537 (tic54x_coff1_beh_vec): Likewise.
538 (tic54x_coff2_vec): Likewise.
539 (tic54x_coff2_beh_vec): Likewise.
540 * coff-x86_64.c (TARGET_SYM): Likewise.
541 (TARGET_SYM_BIG): Likewise.
542 * coff64-rs6000.c (rs6000_xcoff64_vec): Likewise.
543 (rs6000_xcoff64_aix_vec): Likewise.
544 * coffcode.h (CREATE_BIG_COFF_TARGET_VEC): Likewise.
545 (CREATE_BIGHDR_COFF_TARGET_VEC): Likewise.
546 (CREATE_LITTLE_COFF_TARGET_VEC): Likewise.
547 * elfxx-target.h (TARGET_BIG_SYM): Likewise.
548 (TARGET_LITTLE_SYM): Likewise.
549 * hppabsd-core.c (core_hppabsd_vec): Likewise.
550 * hpux-core.c (core_hpux_vec): Likewise.
551 * i386msdos.c (i386_msdos_vec): Likewise.
552 * ihex.c (ihex_vec): Likewise.
553 * irix-core.c (core_irix_vec): Likewise.
554 * mach-o-target.c (TARGET_NAME): Likewise.
555 * mmo.c (mmix_mmo_vec): Likewise.
556 * netbsd-core.c (core_netbsd_vec): Likewise.
557 * osf-core.c (core_osf_vec): Likewise.
558 * pdp11.c (MY (vec)): Likewise.
559 * pef.c (pef_vec): Likewise.
560 (pef_xlib_vec): Likewise.
561 * plugin.c (plugin_vec): Likewise.
562 * ppcboot.c (powerpc_boot_vec): Likewise.
563 * ptrace-core.c (core_ptrace_vec): Likewise.
564 * sco5-core.c (core_sco5_vec): Likewise.
565 * som.c (hppa_som_vec): Likewise.
566 * srec.c (srec_vec): Likewise.
567 (symbolsrec_vec): Likewise.
568 * tekhex.c (tekhex_vec): Likewise.
569 * trad-core.c (core_trad_vec): Likewise.
570 * verilog.c (verilog_vec): Likewise.
571 * vms-alpha.c (alpha_vms_vec): Likewise.
572 * vms-lib.c (alpha_vms_lib_txt_vec): Likewise.
573 * wasm-module.c (wasm_vec): Likewise.
574 * xsym.c (sym_vec): Likewise.
575 * elf.c (ignore_section_sym): Return TRUE if BSF_SECTION_SYM_USED
577 (elf_map_symbols): Don't include ignored section symbols.
578 * elfcode.h (elf_slurp_symbol_table): Also set
579 BSF_SECTION_SYM_USED on STT_SECTION symbols.
580 * elflink.c (bfd_elf_final_link): Generated section symbols only
581 when emitting relocations or reqired.
582 * elfxx-x86.h (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): New.
583 * syms.c (BSF_SECTION_SYM_USED): New.
584 * targets.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): New.
585 (bfd_target): Add keep_unused_section_symbols.
586 (bfd_keep_unused_section_symbols): New.
587 * bfd-in2.h: Regenerated.
592 * bfdio.c (_bfd_real_fopen): For Win32 convert relative paths to
593 absolute paths and check to see if they are longer than MAX_PATH.
597 * elfxx-riscv.c (riscv_std_z_ext_strtab): Added zihintpause.
606 * elfxx-riscv.c (riscv_std_z_ext_strtab): Added zba, zbb and zbc.
610 * elf32-bfin.c (bfin_check_relocs): Check bfd_link_hash_indirect.
611 (bfinfdpic_check_relocs): Likewise.
615 * elf32-score.c (s3_bfd_score_info_to_howto): Report an error
617 * elf32-score7.c (s7_bfd_score_info_to_howto): Likewise.
621 * config.bfd (sparc-*-solaris2*): Add sparc_elf32_vec.
622 (sparc64-*-solaris2*): Add sparc_elf64_vec and
627 * config.bfd: Added targets riscv64be*-*-*, riscv32be*-*-* and
628 riscvbe*-*-*. Also added riscv_elf[32|64]_be_vec.
629 * configure.ac: Handle riscv_elf[32|64]_be_vec.
630 * configure: Regenerate.
631 * elfnn-riscv.c: Include <limits.h> and define CHAR_BIT for
633 (riscv_get_insn): RISC-V instructions are always little endian, but
634 bfd_get may be used for big-endian, so add new riscv_get_insn to handle
636 (riscv_put_insn): Likewsie.
637 (riscv_is_insn_reloc): Check if we are relocaing an instruction.
638 (perform_relocation): Call riscv_is_insn_reloc to decide if we should
639 use riscv_[get|put]_insn or bfd_[get|put].
640 (riscv_zero_pcrel_hi_reloc): Use riscv_[get|put]_insn, bfd_[get|put]l32
641 or bfd_[get|put]l16 for code.
642 (riscv_elf_relocate_section): Likewise.
643 (riscv_elf_finish_dynamic_symbol): Likewise.
644 (riscv_elf_finish_dynamic_sections): Likewise.
645 (_bfd_riscv_relax_call): Likewise.
646 (_bfd_riscv_relax_lui): Likewise.
647 (_bfd_riscv_relax_align): Likewise.
648 (_bfd_riscv_relax_pc): Likewise.
649 (riscv_elf_object_p): Handled for big endian.
650 (TARGET_BIG_SYM, TARGET_BIG_NAME): Defined.
651 * targets.c: Add riscv_elf[32|64]_be_vec.
652 (_bfd_target_vector): Likewise.
656 * elflink.c (bfd_elf_link_record_dynamic_symbol): Handle no_export
657 for relocatable executable.
661 * vms-alpha.c (_bfd_vms_slurp_egsd): Read flags after size check.
665 * elfnn-riscv.c (allocate_dynrelocs): When we are generating pde,
666 make sure gp symbol is output as a dynamic symbol.
671 * elflink.c (compare_link_order): Place unordered sections before
673 (elf_fixup_link_order): Add a link info argument. Allow mixed
674 ordered and unordered input sections for non-relocatable link.
675 Sort the consecutive bfd_indirect_link_order sections with the
676 same pattern. Change the offsets of the bfd_indirect_link_order
678 (bfd_elf_final_link): Pass info to elf_fixup_link_order.
679 * section.c (bfd_section): Add pattern.
680 (BFD_FAKE_SECTION): Initialize pattern to NULL.
681 * bfd-in2.h: Regenerated.
685 * elf32-arm.c (elf32_arm_print_private_bfd_data): Prefix hex value
686 of private flags with 0x.
687 * elfnn-aarch64.c (elfNN_aarch64_print_private_bfd_data): Likewise.
692 * elflink.c (elf_link_input_bfd): Use the file base name in
693 linker generated STT_FILE symbols.
697 * elfxx-riscv.c (riscv_compare_subsets): Removed static.
698 * elfxx-riscv.h: Add declaration.
699 * elfnn-riscv.c (riscv_merge_multi_letter_ext): Use
700 riscv_compare_subsets to check the orders.
701 (riscv_skip_prefix): Removed.
702 (riscv_prefix_cmp): Removed.
707 * elfxx-riscv.c (riscv_parse_prefixed_ext): Free subset after
708 calculating subset version length.
712 * xcofflink.c: Correct spelling in comments.
716 Update year range in copyright notice of all files.
718 For older changes see ChangeLog-2020
720 Copyright (C) 2021 Free Software Foundation, Inc.
722 Copying and distribution of this file, with or without modification,
723 are permitted in any medium without royalty provided the copyright
724 notice and this notice are preserved.
730 version-control: never