aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2022-03-16bfd: add AMDGCN architectureSimon Marchi12-0/+211
Add support for the AMDGCN architecture to BFD. This is the bare minimum to get $ ./configure --target=amdgcn-hsa-amdhsa --disable-gas $ make all-binutils working later in this series. The specific AMDGCN models added here are a bit arbitrary, based on what we intend to initially support in GDB. This list will need to be updated in the future anyway. The complete up-to-date list of existing AMDGPU models can be found here: https://llvm.org/docs/AMDGPUUsage.html#processors The ELF format for this architecture is documented here: https://llvm.org/docs/AMDGPUUsage.html#elf-code-object The flags for the "HSA" OS ABI are properly versioned and documented on that page. But the NONE, PAL and MESA3D OS ABIs are not well documented nor versioned. Taking a peek at the LLVM source code, we see that they encode their flags the same way as HSA v3. For example, for PAL: https://github.com/llvm/llvm-project/blob/c8b614cd74a92d85936aed5ac7c642af75ffdc29/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp#L601 So at least, we know that all AMDGPU objects (of which AMDGCN objects are a subset of) at the time of writing encode the specific GPU model in the EF_AMDGPU_MACH field of e_flags. bfd/ChangeLog: * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES): Add cpu-amdgcn.c. (BFD64_BACKENDS): Add elf64-amdgcn.lo. (BFD64_BACKENDS_CFILES): Add elf64-amdgcn.c. * Makefile.in: Re-generate. * cpu-amdgcn.c: New. * elf64-amdgcn.c: New. * archures.c (bfd_architecture): Add bfd_arch_amdgcn and related mach defines. (bfd_amdgcn_arch): New. (bfd_archures_list): Add bfd_amdgcn_arch. * bfd-in2.h: Re-generate. * config.bfd: Handle amdgcn* target. * configure.ac: Handle amdgcn_elf64_le_vec. * configure: Re-generate. * elf-bfd.h (elf_target_id): Add AMDGCN_ELF_DATA. * targets.c (amdgcn_elf64_le_vec): New. (_bfd_target_vector): Add amdgcn_elf64_le_vec. include/ChangeLog: * elf/amdgpu.h: New. * elf/common.h (ELFOSABI_AMDGPU_HSA): Add. Change-Id: I969f7b14960797e88891c308749a6e341eece5b2
2022-03-16Automatic date update in version.inGDB Administrator1-1/+1
2022-03-15Automatic date update in version.inGDB Administrator1-1/+1
2022-03-14Automatic date update in version.inGDB Administrator1-1/+1
2022-03-13Automatic date update in version.inGDB Administrator1-1/+1
2022-03-12Automatic date update in version.inGDB Administrator1-1/+1
2022-03-11Automatic date update in version.inGDB Administrator1-1/+1
2022-03-09ld: Add a before_plugin_all_symbols_read hookH.J. Lu2-1/+9
Add a before_plugin_all_symbols_read hook to load symbol references from DT_NEEDED entries, included from --copy-dt-needed-entries, before reading plugin symbols to properly resolve plugin symbol references. bfd/ PR ld/28849 * elf-bfd.h (elf_link_hash_table): Add handling_dt_needed. * elflink.c (_bfd_elf_merge_symbol): Don't set non_ir_ref_dynamic before plugin 'all symbols read' hook is called. ld/ PR ld/28849 * ldelf.c (ldelf_handle_dt_needed): New function. (ldelf_before_plugin_all_symbols_read): Likewise. (ldelf_after_open): Call ldelf_handle_dt_needed. * ldelf.h (ldelf_before_plugin_all_symbols_read): New. * ldemul.c (ldemul_before_plugin_all_symbols_read): Likewise. * ldemul.h (ldemul_before_plugin_all_symbols_read): Likewise. (ld_emulation_xfer_struct): Add before_plugin_all_symbols_read. * ldlang.c (lang_process): Call ldemul_before_plugin_all_symbols_read before calling plugin_call_all_symbols_read. * emultempl/elf.em (gld${EMULATION_NAME}_before_plugin_all_symbols_read): New. (LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ): New. * emultempl/emulation.em (ld_${EMULATION_NAME}_emulation): Initialize the before_plugin_all_symbols_read field. * testsuite/ld-plugin/lto.exp: Run PR ld/28849 tests. * testsuite/ld-plugin/pr28849.d: New file. * testsuite/ld-plugin/pr28849a.c: Likewise. * testsuite/ld-plugin/pr28849b.c: Likewise.
2022-03-10Automatic date update in version.inGDB Administrator1-1/+1
2022-03-09Automatic date update in version.inGDB Administrator1-1/+1
2022-03-08Automatic date update in version.inGDB Administrator1-1/+1
2022-03-07Automatic date update in version.inGDB Administrator1-1/+1
2022-03-06Automatic date update in version.inGDB Administrator1-1/+1
2022-03-05Automatic date update in version.inGDB Administrator1-1/+1
2022-03-04Automatic date update in version.inGDB Administrator1-1/+1
2022-03-03comment typo fixAlan Modra1-1/+1
2022-03-03PowerPC64 DT_RELR relative reloc addressesAlan Modra1-49/+76
Section addresses can change between ppc64_elf_size_stubs and ppc64_elf_build_stubs due to .eh_frame editing. The idea of stashing r_offset final addresses calculated in ppc64_elf_size_stubs for use by ppc64_elf_build_stubs was never a good idea. Instead, we need to keep section/offset pairs. * elf64-ppc.c (struct ppc_link_hash_table): Delete relr_addr. Add relr section/offset array. (append_relr_off): Rewrite. Update all callers. (sort_relr): New function. (ppc64_elf_size_stubs): Adjust to suit new relative reloc stash. (ppc64_elf_build_stubs): Likewise.
2022-03-03Automatic date update in version.inGDB Administrator1-1/+1
2022-03-02Automatic date update in version.inGDB Administrator1-1/+1
2022-03-01Fix a typo in the previous delta to bfdio.c.Nick Clifton2-21/+30
PR 25713 * bfdio.c (_bfd_real_fopen): Fix typo.
2022-03-01Revert "Check thin archive element file size against archive header"Alan Modra1-11/+1
This reverts commit 48e3e6aec8a4f37d00ea6c0da3ab45e76490e3db. PR 28929 * archive.c (_bfd_get_elt_at_filepos): Don't check thin archive element file size.
2022-03-01Prevent an assertion from being triggered when linking an ARM object file ↵Nick Clifton2-0/+15
with incorrectly set build attributes. PR 28848 PR 28859 * elf32-arm.c (elf32_arm_merge_eabi_attributes): If the first input bfd has a Tag_ABI_HardFP_use set to 3 but does not also have TAG_FP_arch set then reset the TAG_ABI_HardFP_use.
2022-03-01Automatic date update in version.inGDB Administrator1-1/+1
2022-02-28Further correct the handling of long pathnames on Windows hosts.Torbj?rn Svensson2-39/+45
PR 25713 * bfdio.c (_bfd_real_fopen): Fix handling of parhs longer than 260 characters on Windows hosts.
2022-02-28Clarify the wording of the error message when an obsolete configuration is ↵Nick Clifton2-2/+7
encountered. PR 28886 * config.bfd: Update error message for obsolete configurations.
2022-02-28Automatic date update in version.inGDB Administrator1-1/+1
2022-02-27Automatic date update in version.inGDB Administrator1-1/+1
2022-02-26Automatic date update in version.inGDB Administrator1-1/+1
2022-02-25RISC-V: Remove a loop in the ISA parserTsukasa OI1-7/+4
Since commit e601909a3287bf541c6a7d82214bb387d2c76d82 ("RISC-V: Support to parse the multi-letter prefix in the architecture string.") changed so that all prefixed extensions are parsed in single riscv_parse_prefixed_ext call, a "while" loop on riscv_parse_subset is no longer required. bfd/ChangeLog: * elfxx-riscv.c (riscv_parse_subset): Remove unnecessary loop.
2022-02-25Automatic date update in version.inGDB Administrator1-1/+1
2022-02-24Automatic date update in version.inGDB Administrator1-1/+1
2022-02-23RISC-V: PR28733, add missing extension info to 'unrecognized opcode' errorPatrick O'Neill2-0/+97
Currently we report errors as "unrecognized opcode `fence.i'" when the opcode isn't part of the selected extensions. This patch expands that error message to include the missing extension information. For example, now the error message would be "unrecognized opcode `fence.i', extension `zifencei' required". If the opcode is not a part of any extension, the error message reverts to "unrecognized opcode `<op statement>'". Signed-off-by: Patrick O'Neill <patrick@rivosinc.com> bfd/ pr 28733 * elfxx-riscv.c (riscv_multi_subset_supports_ext): New function, used to return the extension string for each INSN_CLASS_*. * elfxx-riscv.h: Added extern riscv_multi_subset_supports_ext. gas/ pr 28733 * config/tc-riscv.c (struct riscv_ip_error): New structure, contains information about errors that occur within the riscv_ip. (riscv_ip): Use struct riscv_ip_error to report more detailed errors. * testsuite/gas/riscv/c-fld-fsd-fail.l: Updated. * testsuite/gas/riscv/march-imply-i2p1-01.: Likewise.
2022-02-23Automatic date update in version.inGDB Administrator1-1/+1
2022-02-22RISC-V: Maintain a string to hold the canonical orderKito Cheng1-17/+5
Using dummy entry in riscv_supported_std_ext cause confusing and wrongly support `b` and `k` extensions. bfd/ * elfxx-riscv.c (riscv_supported_std_ext): Drop unsupported extensions. (riscv_ext_canonical_order): New. (riscv_init_ext_order): Use riscv_ext_canonical_order rather than riscv_supported_std_ext to compute canonical order. V2 Changes: - Use `*ext` rather than `*ext != NULL` for checking is reach end of string.
2022-02-22Automatic date update in version.inGDB Administrator1-1/+1
2022-02-22Re: ld: Support customized output section typeAlan Modra2-9/+16
"DO NOT EDIT!" says the comment at the top of bfd-in2.h. Move the new type field where it belongs. PR ld/28841 * section.c (struct bfd_section): Add type. Formatting. (BFD_FAKE_SECTION): Formatting. * bfd-in2.h: Regenerate.
2022-02-21Automatic date update in version.inGDB Administrator1-1/+1
2022-02-20Automatic date update in version.inGDB Administrator1-1/+1
2022-02-19Automatic date update in version.inGDB Administrator1-1/+1
2022-02-18Automatic date update in version.inGDB Administrator1-1/+1
2022-02-17Updated Serbian translations for the bfd, gold, ld and opcodes directoriesNick Clifton2-1487/+1640
2022-02-17Automatic date update in version.inGDB Administrator1-1/+1
2022-02-16ld: Support customized output section typeFangrui Song4-5/+20
bfd/ PR ld/28841 * bfd-in2.h (struct bfd_section): Add type. (discarded_section): Add field. * elf.c (elf_fake_sections): Handle bfd_section::type. * section.c (BFD_FAKE_SECTION): Add field. * mri.c (mri_draw_tree): Update function call. ld/ PR ld/28841 * ld.texi: Document new output section type. * ldlex.l: Add new token TYPE. * ldgram.y: Handle TYPE=exp. * ldlang.h: Add type_section to list of section types. * ldlang.c (lang_add_section): Handle type_section. (map_input_to_output_sections): Handle type_section. * testsuite/ld-scripts/output-section-types.t: Add tests. * testsuite/ld-scripts/output-section-types.d: Update.
2022-02-16pe_ILF_make_a_symbol_reloc segfaultAlan Modra1-1/+1
pei-aarch64-little apparently lacks support for BFD_RELOC_RVA. * peicode.h (pe_ILF_make_a_symbol_reloc): Don't segfault on NULL howto.
2022-02-16What to do when sh_addralign isn't a power of twoAlan Modra1-6/+7
BFD generally doesn't handle anything but a power of two section alignment, and ELF sh_addralign is required to be an integral power of two (or zero) by the ELF spec. Of course this is ignored by fuzzers, and because bfd_log2 rounds up, we can end up with alignment_power being 32 on a 32-bit object or 64 on a 64-bit object. That then triggers ubsan warnings in places like bfd_update_compression_header where we want to convert from alignment_power back to an alignment. I suppose we could reject object files that have non-compliant sh_addralign, but I think it's also reasonable to use the greatest power of two divisor of sh_addralign, ie. the rightmost 1 bit. * elf.c (_bfd_elf_make_section_from_shdr): Use greatest power of two divisor of sh_addralign. (_bfd_elf_assign_file_position_for_section): Likewise. (assign_file_positions_for_non_load_sections): Likewise.
2022-02-16asan: buffer overflow in vms-alpha.cAlan Modra1-1/+3
* vms-alpha.c (evax_bfd_print_dst): Sanity check another place printing strings.
2022-02-16asan: buffer overflow in peXXigen.cAlan Modra1-4/+10
* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Properly sanity check DataDirectory[PE_DEBUG_DATA].Size.
2022-02-16Automatic date update in version.inGDB Administrator1-1/+1
2022-02-15i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTRELH.J. Lu1-0/+1
Update I386_NEED_DYNAMIC_RELOC_TYPE_P to allow R_386_TLS_IE for relocation in read-only section. bfd/ PR ld/28894 * elfxx-x86.h (I386_NEED_DYNAMIC_RELOC_TYPE_P): Allow R_386_TLS_IE. ld/ PR ld/28894 * testsuite/ld-i386/i386.exp: Run pr28894. * testsuite/ld-i386/pr28894.d: New file. * testsuite/ld-i386/pr28894.s: Likewise.
2022-02-15Automatic date update in version.inGDB Administrator1-1/+1