aboutsummaryrefslogtreecommitdiff
path: root/bfd
Commit message (Collapse)AuthorAgeFilesLines
* LoongArch: bfd: Correct the name of R_LARCH_SOP_POP_32_U in howto_tableJinyang He2024-02-261-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-261-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-251-1/+1
|
* xtensa: move xtensa_make_property_section from bfd to gasAlan Modra2024-02-241-33/+1
| | | | | | | | | | | | | | | | This function is only used by gas, so move it there. Necessary for gas to keep track of group sections as they are created. PR 25333 bfd/ * elf32-xtensa.c (xtensa_make_property_section): Delete. (xtensa_property_section_name): Make public. include/ * elf/xtensa.h (xtensa_make_property_section): Delete. (xtensa_property_section_name): Declare gas/ * config/tc-xtensa.c (xtensa_make_property_section): New, moved from elf32-xtensa.c.
* Make is_relocatable_executable only affect dynamic section symsAlan Modra2024-02-241-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I believe the only elflink.c specialties for is_relocatable_executable needed by tic6x are those directly related to dynamic section symbols. I might be wrong, the code in record_dynamic_symbol and record_link_assignment predated the tic6x port, but I think these were symbian specific hacks. The shlib-app-1* testsuite changes aren't needed for this patch. I started making them when trying to remove is_relocatable_executable completely, but figure it is worth keeping the more permissive address matching for some future generic linker change. The static-app-1* changes also adjust to the fact that an unneeded "c" no longer appears in the dynamic symbol table. bfd/ * elflink.c (bfd_elf_link_record_dynamic_symbol): Don't do anything special for is_relocatable_executable. (bfd_elf_record_link_assignment): Likewise. ld/ * testsuite/ld-tic6x/shlib-app-1.rd: Make some address matching more permissive. * testsuite/ld-tic6x/shlib-app-1b.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1r.rd: Likewise. * testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise. * testsuite/ld-tic6x/static-app-1.rd: Likewise, and adjust expected dynamic symbol table. * testsuite/ld-tic6x/static-app-1b.rd: Likewise. * testsuite/ld-tic6x/static-app-1r.rd: Likewise. * testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
* Automatic date update in version.inGDB Administrator2024-02-241-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-231-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-221-1/+1
|
* Re: PR29785, memory bloat after b43771b045fbAlan Modra2024-02-211-4/+6
| | | | | | | | | | | | | Commit 7bd1e04a3532 introduced "dwarf2.c:2152:29: runtime error: shift exponent 64 is too large". This is on the bucket_high_pc calculation which was moved to the top of insert_arange_in_trie where previously it was later, at a point where the overflow could not occur. Move it back and arrange for a duplicate calculation of bucket_high_pc which is also protected from overflow. PR 29785 * dwarf2.c (insert_arange_in_trie): Split bucket_high_pc. Move trie_pc_bits < VMA_BITS into splitting_leaf_will_help.
* Remove is_relocatable_executable from backend codeAlan Modra2024-02-215-46/+14
| | | | | | | | | | | | | | | | With the removal of symbian support, most targets no longer or never did set is_relocatable_executable. Remove the backend support that is no longer relevant. * elf32-arm.c (record_arm_to_thumb_glue, elf32_arm_create_thumb_stub), (elf32_arm_final_link_relocate, elf32_arm_check_relocs), (elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs_for_symbol), (elf32_arm_output_arch_local_syms): Remove is_relocatable_executable code and comments. * elf32-csky.c (csky_elf_adjust_dynamic_symbol): Likewise. * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise. * elfnn-kvx.c (elfNN_kvx_final_link_relocate): Likewise. * elfxx-mips.c (count_section_dynsyms): Likewise.
* RISC-V: Fix local GOT and reloc size calculation for TLS.Tatsuyuki Ishi2024-02-211-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous code did not account correctly for two cases: * A TLS symbol can be referenced with multiple TLS types (although rare), in which case it only allocated the maximum slot size among the types, instead of the sum. * TLS relocations are only needed for DLLs, unlike normal symbols which requires relocations for all PIE code. Modify the logic to account for the two cases, so this fixes the redundant dynamic R_RISCV_NONE in .rela.dyn when using --no-pie for TLS GD and IE. Passed the gcc/binutils regressions of riscv-gnu-toolchain. bfd/ * elfnn-riscv.c (riscv_elf_size_dynamic_sections): Handle relocation sizing for TLS and non-TLS symbols differently, with the former requiring relocs on DLL while the latter requiring on PIE. Allocate GOT slots and relocation slots for each TLS type separately, accounting for the possibility of a TLS variable getting referenced by multiple symbols. ld/ * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated. * testsuite/ld-riscv-elf/tls*: New testcase for TLS GD and IE, with symbols referred by both types and global and local symbols.
* Automatic date update in version.inGDB Administrator2024-02-211-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-201-1/+1
|
* aarch64: Add new relocations and limit COFF AArch64 relocation offsetsZac Walker2024-02-191-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | The patch adds support for the IMAGE_REL_ARM64_REL32 coff relocation type. This is needed for 32-bit relative address. It also adds a check for relocation offsets over 21 bits. Offsets inside coff files are stored in instruction code. In the case of ADRP the actual value is stored, not a downshifted page offset. This means values over 21 bits would otherwise be truncated. Finally it adds a mapping for BFD_RELOC_AARCH64_ADR_GOT_PAGE and BFD_RELOC_AARCH64_LD64_GOT_LO12_NC that were previously skipped. ChangeLog: * bfd/coff-aarch64.c (coff_aarch64_reloc_type_lookup): Add BFD_RELOC_AARCH64_ADR_GOT_PAGE, BFD_RELOC_AARCH64_LD64_GOT_LO12_NC and IMAGE_REL_ARM64_REL32 relocations. (coff_pe_aarch64_relocate_section): Likewise. * gas/write.c (adjust_reloc_syms): COFF AArch64 relocation offsets need to be limited to 21bits (defined): Likewise.
* Automatic date update in version.inGDB Administrator2024-02-191-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-181-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-171-1/+1
|
* PR27597, nios: assertion fail in nios2_elf32_install_imm16Alan Modra2024-02-161-16/+24
| | | | | | | | | | | | | | | | The assertion in nios2_elf32_install_imm16 triggers when the PLT is twice the maximum allowable size for a branch from PLTn to reach .PLTresolve, and on no other call to nios2_elf32_install_imm16. That makes the assertion completely useless. We can handle a PIC PLT exceeding 0x8000 in size by bouncing branches that won't reach through previous branches. PR 27597 * elf32-nios2.c (nios2_elf32_install_imm16): Delete BFD_ASSERT. (nios2_build_one_stub): Don't bother masking value passed to nios2_elf32_install_imm16. (nios2_elf32_finish_dynamic_symbol): Likewise. Handle overflow of PLTn branch to .PLTresolve by bouncing through prior branches.
* Automatic date update in version.inGDB Administrator2024-02-161-1/+1
|
* S/390: 32-bit PIE undef weak failuresAlan Modra2024-02-161-7/+6
| | | | | | | | | | | Like 10e7c0457cb7 but for elf32-s390.c * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC. (allocate_dynrelocs): Likewise. (elf_s390_relocate_section): Check resolved_to_zero. (elf_s390_finish_dynamic_symbol): Don't generate runtime reloc if UNDEFWEAK_NO_DYNAMIC_RELOC.
* Re: elf_backend_finish_dynamic_symbol returning falseAlan Modra2024-02-155-5/+10
| | | | | | | | I didn't examine ld testsuite logs properly after cf95b909e2c2. Replacing one of the "return false" with BFD_ASSERT in finish_dynamic_symbol was wrong as it causes segmentation faults on testcases expected to fail. Revert those changes and instead make a bfd_final_link failure noisy.
* PR29785, memory bloat after b43771b045fbSteinar H. Gunderson2024-02-151-5/+25
| | | | | | | | | | Pathological cases of dwarf info with overlapping duplicate memory ranges can cause splitting of trie leaf nodes, which in the worst case will cause memory to increase without bounds. PR 29785 * dwarf2.c (insert_arange_in_trie): Don't split leaf nodes unless that reduces number of elements in at least one node.
* elf_backend_finish_dynamic_symbol returning falseAlan Modra2024-02-1524-51/+29
| | | | | | | | | | | | | | Returning false from elf_backend_finish_dynamic_symbol will not result in an error being printed unless bfd_error is set but will result in the linker exiting with a non-zero status. If just bfd_error is set then a generic "final link failed" will result, which doesn't help a user much. So elf_backend_finish_dynamic_symbol should print its own error message whenever returning false, or use BFD_ASSERT or abort to print assertion failures for conditions that shouldn't occur. This patch does that, and removes unnecessary "htab != NULL" tests in elf_backend_finish_dynamic_symbol. Such tests aren't needed in a function only called via elf_backend_data.
* Automatic date update in version.inGDB Administrator2024-02-151-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-141-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-131-1/+1
|
* Introduce bfd_print_error functionTom Tromey2024-02-122-12/+40
| | | | | | | | | | | | | | | | | | | | | gdb likes to control its own output; for example, this is important for gdb's pager, and for logging. While BFD provides a way to intercept error output, via bfd_set_error_handler, it turns out to be difficult for this function to truly generate the desired output in a gdb-friendly way -- the error handler is expected to implement some BFD printf format extensions. This patch introduces a new function that an error handler can use to format the text. This way, gdb can set the error handler and arrange for the output to be displayed as it likes. * bfd.c (bfd_print_callback): Rename from print_func. Move into comment. (_bfd_doprnt): Update. (bfd_print_error): New function. (error_handler_fprintf, error_handler_sprintf): Use bfd_print_error. * bfd-in2.h: Rebuild.
* Do not call fputc from _bfd_doprntTom Tromey2024-02-121-1/+1
| | | | | | | | I noticed that _bfd_doprnt can unconditionally call fputc. However, when called from error_handler_sprintf, this will likely result in a crash, as the stream argument does not actually point to a FILE. * bfd.c (_bfd_doprnt): Do not call fputc.
* Automatic date update in version.inGDB Administrator2024-02-121-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-111-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-101-1/+1
|
* PR 14962 testcase xcoff failureAlan Modra2024-02-091-1/+7
| | | | | | | | | Like https://sourceware.org/pipermail/binutils/2002-August/021279.html but for symbols defined in an xcoff object but then made absolute by a linker script. * xcofflink.c (xcoff_link_input_bfd): Set n_scnum correctly for symbols made absolute by a linker script.
* Automatic date update in version.inGDB Administrator2024-02-091-1/+1
|
* PR31208, strip can break ELF alignment requirementsAlan Modra2024-02-091-1/+1
| | | | | | | | | | | | | In https://sourceware.org/pipermail/binutils/2007-August/053261.html (git commit 3dea8fca8b86) I disabled a then new linker feature that removed empty PT_LOAD headers in cases where a user specified program headers, and for objcopy. This can be a problem for objcopy/strip and since objcopy operates on sections, any part of a PT_LOAD loading file contents not covered by a section will be omitted anyway. PR 31208 * elf.c (_bfd_elf_map_sections_to_segments): Pass remove_empty_load as true to elf_modify_segment_map for objcopy/strip.
* x86-64: Add R_X86_64_CODE_6_GOTTPOFFH.J. Lu2024-02-084-1/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For add %reg1, name@gottpoff(%rip), %reg2 and add name@gottpoff(%rip), %reg1, %reg2 add #define R_X86_64_CODE_6_GOTTPOFF 50 if the instruction starts at 6 bytes before the relocation offset. They are similar to R_X86_64_GOTTPOFF. Linker can covert GOTTPOFF to add $name@tpoff, %reg1, %reg2 Rewrite fx_tcbit, fx_tcbit2 and fx_tcbit3 usage to generate R_X86_64_GOTPCRELX, R_X86_64_REX_GOTPCRELX, R_X86_64_CODE_4_GOTPCRELX, R_X86_64_CODE_4_GOTTPOFF, R_X86_64_CODE_4_GOTPC32_TLSDESC and R_X86_64_CODE_6_GOTTPOFF. NB: There is no need to check BFD_RELOC_X86_64_CODE_4_GOTTPOFF in md_assemble since there is only BFD_RELOC_X86_64_GOTTPOFF at this stage, which will be converted to BFD_RELOC_X86_64_CODE_4_GOTTPOFF or BFD_RELOC_X86_64_CODE_6_GOTTPOFF in i386_validate_fix. 5 relocations: #define R_X86_64_CODE_5_GOTPCRELX 46 #define R_X86_64_CODE_5_GOTTPOFF 47 #define R_X86_64_CODE_5_GOTPC32_TLSDESC 48 #define R_X86_64_CODE_6_GOTPCRELX 49 #define R_X86_64_CODE_6_GOTPC32_TLSDESC 51 are added for completeness and they are unused. bfd/ * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. (R_X86_64_standard): Updated. (x86_64_reloc_map): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. (elf_x86_64_check_tls_transition): Handle R_X86_64_CODE_6_GOTTPOFF. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_scan_relocs): Handle R_X86_64_CODE_6_GOTTPOFF. Issue an error for R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX and R_X86_64_CODE_6_GOTPC32_TLSDESC. (elf_x86_64_relocate_section): Handle R_X86_64_CODE_6_GOTTPOFF. * reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_CODE_5_GOTPCRELX, BFD_RELOC_X86_64_CODE_5_GOTTPOFF, BFD_RELOC_X86_64_CODE_5_GOTPC32_TLSDESC, BFD_RELOC_X86_64_CODE_6_GOTPCRELX, BFD_RELOC_X86_64_CODE_6_GOTTPOFF and BFD_RELOC_X86_64_CODE_6_GOTPC32_TLSDESC. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. elfcpp/ * x86_64.h (R_X86_64_CODE_5_GOTPCRELX): New. (R_X86_64_CODE_5_GOTTPOFF): Likewise. (R_X86_64_CODE_5_GOTPC32_TLSDESC): Likewise. (R_X86_64_CODE_6_GOTPCRELX): Likewise. (R_X86_64_CODE_6_GOTTPOFF): Likewise. (R_X86_64_CODE_6_GOTPC32_TLSDESC): Likewise. gas/ * config/tc-i386.c (tc_i386_fix_adjustable): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. (md_assemble): Don't check BFD_RELOC_X86_64_CODE_4_GOTTPOFF. Allow "add %reg1, foo@gottpoff(%rip), %reg2". (output_disp): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. Rewrite setting fx_tcbitX bits for BFD_RELOC_X86_64_GOTTPOFF, BFD_RELOC_X86_64_GOTPC32_TLSDESC and BFD_RELOC_32_PCREL. (md_apply_fix): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. (i386_validate_fix): Rewrite fx_tcbitX bit checking for BFD_RELOC_X86_64_GOTTPOFF, BFD_RELOC_X86_64_GOTPC32_TLSDESC and BFD_RELOC_32_PCREL. (tc_gen_reloc): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. * testsuite/gas/i386/x86-64-gottpoff.d: Updated. * testsuite/gas/i386/x86-64-gottpoff.s: Add tests for "add %reg1, foo@gottpoff(%rip), %reg2" and "add foo@gottpoff(%rip), %reg, %reg2". gold/ * x86_64.cc (Target_x86_64::optimize_tls_reloc): Handle R_X86_64_CODE_6_GOTTPOFF. (Target_x86_64::Scan::get_reference_flags): Likewise. (Target_x86_64::Scan::local): Likewise. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. (Target_x86_64::Relocate::relocate_tls): Likewise. (Target_x86_64::Relocate::tls_ie_to_le): Handle. R_X86_64_CODE_6_GOTTPOFF. * testsuite/x86_64_ie_to_le.s: Add tests for "add %reg1, foo@gottpoff(%rip), %reg2" and "add foo@gottpoff(%rip), %reg, %reg2". * testsuite/x86_64_ie_to_le.sh: Updated. include/ * elf/x86-64.h (elf_x86_64_reloc_type): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. ld/ * testsuite/ld-x86-64/tlsbindesc.s: Add R_X86_64_CODE_6_GOTTPOFF tests. * testsuite/ld-x86-64/tlsbindesc.d: Updated. * testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
* Automatic date update in version.inGDB Administrator2024-02-081-1/+1
|
* asan: NULL dereference in _bfd_mips_final_write_processingAlan Modra2024-02-071-20/+19
| | | | | | | | | | | | | Fuzzed object files can easily have unexpected section names. We don't want to segfault on objcopy of any file accepted by the mips object_p functions. For objcopy, an assertion that "sec" is non-NULL followed by deferencing "sec" is wrong. So too is asserting that the section name string starts with a particular prefix, and then blithely accessing past the assumed prefix. * elfxx-mips.c (_bfd_mips_final_write_processing): Replace assertions with conditionals. Don't bother testing for name non-NULL.
* Automatic date update in version.inGDB Administrator2024-02-071-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-061-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-051-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-041-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-031-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-021-1/+1
|
* Automatic date update in version.inGDB Administrator2024-02-011-1/+1
|
* Automatic date update in version.inGDB Administrator2024-01-311-1/+1
|
* Automatic date update in version.inGDB Administrator2024-01-301-1/+1
|
* PR31314, chew crashing on use of uninitialized valueAlan Modra2024-01-302-2/+1
| | | | | | | | | The "drop" call in wrap_comment already increments pc. Defining DOCDD in proto.str is a warning fix. PR 31314 * chew.c (wrap_comment): Don't increment pc. * proto.str (DOCDD): Define.
* bfd: restore Threading menu entry in bfd.texiJose E. Marchesi2024-01-291-0/+1
| | | | | | I mistakenly vandalized bfd.texi in the commit 0c45feb159a14ca4cb50cfbf45eacaf5a6cecf2b by removing an entry in the manual menu. This commit reverts that thunk.
* bpf: there is no ldinddw nor ldabsdw instructionsJose E. Marchesi2024-01-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no legacy ldind nor ldabs BPF instructions with BPF_SIZE_DW. For some reason we were (incorrectly) supporting these. This patch updates the opcodes so the instructions get removed and modifies the GAS manual and testsuite accordingly. See discussion at https://lore.kernel.org/bpf/110aad7a-f8a3-46ed-9fda-2f8ee54dcb89@linux.dev Tested in bpf-uknonwn-none target, x86-64-linux-gnu host. include/ChangeLog: 2024-01-29 Jose E. Marchesi <jose.marchesi@oracle.com> * opcode/bpf.h (enum bpf_insn_id): Remove BPF_INSN_LDINDDW and BPF_INSN_LDABSDW instructions. opcodes/ChangeLog: 2024-01-29 Jose E. Marchesi <jose.marchesi@oracle.com> * bpf-opc.c (bpf_opcodes): Remove BPF_INSN_LDINDDW and BPF_INSN_LDABSDW instructions. gas/ChangeLog: 2024-01-29 Jose E. Marchesi <jose.marchesi@oracle.com> * doc/c-bpf.texi (BPF Instructions): There is no indirect 64-bit load instruction. (BPF Instructions): There is no absolute 64-bit load instruction. * testsuite/gas/bpf/mem.s: Update test accordingly. * testsuite/gas/bpf/mem-be-pseudoc.d: Likewise. * testsuite/gas/bpf/mem-be.d: Likewise. * testsuite/gas/bpf/mem-pseudoc.d: Likewise. * testsuite/gas/bpf/mem-pseudoc.s: Likewise. * testsuite/gas/bpf/mem.d: Likewise. * testsuite/gas/bpf/mem.s: Likewise.
* Remove support for the beos file formatNick Clifton2024-01-291-1/+1
|