summaryrefslogtreecommitdiff
path: root/bfd
Commit message (Collapse)AuthorAgeFilesLines
* Re: Add section caches to coff_data_typeHEADmasterAlan Modra2023-05-184-84/+57
| | | | | | | | | | | | | | | | | | | | | | | Commit 0e759f232b6d regressed these tests: rs6000-aix7.2 +FAIL: Garbage collection test 1 (32-bit) rs6000-aix7.2 +FAIL: Garbage collection test 1 (64-bit) rs6000-aix7.2 +FAIL: Glink test 1 (32-bit) rs6000-aix7.2 +FAIL: Glink test 1 (64-bit) Investigation showed segfaults in coff_section_from_bfd_index called by xcoff_write_global_symbol due to the hash table pointer being NULL. Well, yes, the hash table isn't initialised for the output bfd. mkobject_hook is the wrong place to do that. * coffcode.h: Revert 0e759f232b6d changes. * peicode.h: Likewise. * coff-x86_64.c (htab_hash_section_index, htab_eq_section_index): Moved here from coffcode.h. (coff_amd64_rtype_to_howto): Create section_by_index htab. * coffgen.c (htab_hash_section_target_index), (htab_eq_section_target_index): Moved here from coffcode.h. (coff_section_from_bfd_index): Create section_by_target_index htab. Stash newly created sections in htab.
* Automatic date update in version.inGDB Administrator2023-05-181-1/+1
|
* Decorated symbols in import libs (BUG 30421)Luca Bacci2023-05-174-1/+66
| | | | | | | | | | | PR 30421 * cofflink.c (_decoration_hash_newfunc): New function. (_bfd_coff_link_hash_table_init): Call it. * libcoff-in.h (struct coff_link_hash_table): Add decoration_hash field. (struct decoration_hash_entry): Declare. (_decoration_hash_newfunc): Prototype. * libcoff.h: Regenerate. * emultempl/pe.em (set_decoration): New function. (pe_fixup_stdcalls): Call the new function. * emultempl/pep.em (set_decoration): New function. (pep_fixup_stdcalls): Call the new function. * pe-dll.c (make_one): Check for decoated symbols.
* gcc-4.5 build fixesAlan Modra2023-05-172-51/+50
| | | | | | | | | | | | | | | | | | | | Trying to build binutils with an older gcc currently fails. Working around these gcc bugs is not onerous so let's fix them. bfd/ * elf32-csky.c (csky_elf_size_dynamic_sections): Don't type-pun pointer. * elf32-rl78.c (rl78_compute_complex_reloc): Rename "stat" variable to "status". gas/ * compress-debug.c (compress_finish): Supply all fields in ZSTD_inBuffer initialisation. include/ * xtensa-dynconfig.h (xtensa_isa_internal): Delete unnecessary forward declaration. opcodes/ * loongarch-opc.c: Supply all fields of zero struct initialisation in various opcode tables.
* Automatic date update in version.inGDB Administrator2023-05-171-1/+1
|
* Add section caches to coff_data_typeOleg Tolmatcev2023-05-167-11/+171
| | | | | | | | | * libcoff-in.h (struct coff_tdata): Add section_by_index and section_by_target_index hash tables. * libcoff.h: Regenerate. * coffcode.h (htab_hash_section_index): New function. (htab_eq_section_index): New function. (htab_hash_section_target_index): New function. (htab_eq_section_target_index): New function. (coff_mkobject_hool): Create the hash tables. * peicode.h: Add the same new functions. (pe_mkobject_hook): Create the hash tables. * coff-x86_64.c (coff_amd64_rtype_to_howto): Use the new tables to speed up lookups. * coffgen.c (coff_section_from_bfd_index): Likewise. (_bfd_coff_close_and_cleanup): Delete the hash tables.
* Automatic date update in version.inGDB Administrator2023-05-161-1/+1
|
* LoongArch: Fix PLT entry generate bugmengqinggang2023-05-151-3/+1
| | | | | | | | | | | | | | If a function symbol only get its address by la.global, without directly called by bl instruction, the PLT entry is not required. bfd/ChangeLog: * elfnn-loongarch.c (loongarch_elf_adjust_dynamic_symbol): Fix PLT entry generate bug. ld/ChangeLog: * testsuite/ld-elf/shared.exp: Clear xfail for LoongArch.
* Automatic date update in version.inGDB Administrator2023-05-151-1/+1
|
* Automatic date update in version.inGDB Administrator2023-05-141-1/+1
|
* Automatic date update in version.inGDB Administrator2023-05-131-1/+1
|
* Automatic date update in version.inGDB Administrator2023-05-121-1/+1
|
* Add LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook [GCC PR109128]Joseph Myers2023-05-112-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is one part of the fix for GCC PR109128, along with a corresponding GCC change. Without this patch, what happens in the linker, when an unused object in a .a file has offload data, is that elf_link_is_defined_archive_symbol calls bfd_link_plugin_object_p, which ends up calling the plugin's claim_file_handler, which then records the object as one with offload data. That is, the linker never decides to use the object in the first place, but use of this _p interface (called as part of trying to decide whether to use the object) results in the plugin deciding to use its offload data (and a consequent mismatch in the offload data present at runtime). The new hook allows the linker plugin to distinguish calls to claim_file_handler that know the object is being used by the linker (from ldmain.c:add_archive_element), from calls that don't know it's being used by the linker (from elf_link_is_defined_archive_symbol); in the latter case, the plugin should avoid recording the object as one with offload data. bfd/ * plugin.c (struct plugin_list_entry): Add claim_file_v2. (register_claim_file_v2): New. (try_load_plugin): Use LDPT_REGISTER_CLAIM_FILE_HOOK_V2. (ld_plugin_object_p): Take second argument. (bfd_link_plugin_object_p): Update call to ld_plugin_object_p. (register_ld_plugin_object_p): Update argument prototype. (bfd_plugin_object_p): Update call to ld_plugin_object_p. * plugin.h (register_ld_plugin_object_p): Update argument prototype. include/ * plugin.api.h (ld_plugin_claim_file_handler_v2) (ld_plugin_register_claim_file_v2) (LDPT_REGISTER_CLAIM_FILE_HOOK_V2): New. (struct ld_plugin_tv): Add tv_register_claim_file_v2. ld/ * plugin.c (struct plugin): Add claim_file_handler_v2. (LDPT_REGISTER_CLAIM_FILE_HOOK_V2): New. (plugin_object_p): Add second argument. Update call to plugin_call_claim_file. (register_claim_file_v2): New. (set_tv_header): Handle LDPT_REGISTER_CLAIM_FILE_HOOK_V2. (plugin_call_claim_file): Add argument known_used. (plugin_maybe_claim): Update call to plugin_object_p. * testplug.c, testplug2.c, testplug3.c, testplug4.c: Handle LDPT_REGISTER_CLAIM_FILE_HOOK_V2. * testsuite/ld-plugin/plugin-1.d, testsuite/ld-plugin/plugin-10.d, testsuite/ld-plugin/plugin-11.d, testsuite/ld-plugin/plugin-13.d, testsuite/ld-plugin/plugin-14.d, testsuite/ld-plugin/plugin-15.d, testsuite/ld-plugin/plugin-16.d, testsuite/ld-plugin/plugin-17.d, testsuite/ld-plugin/plugin-18.d, testsuite/ld-plugin/plugin-19.d, testsuite/ld-plugin/plugin-2.d, testsuite/ld-plugin/plugin-26.d, testsuite/ld-plugin/plugin-3.d, testsuite/ld-plugin/plugin-30.d, testsuite/ld-plugin/plugin-4.d, testsuite/ld-plugin/plugin-5.d, testsuite/ld-plugin/plugin-6.d, testsuite/ld-plugin/plugin-7.d, testsuite/ld-plugin/plugin-8.d, testsuite/ld-plugin/plugin-9.d: Update test expectations.
* Automatic date update in version.inGDB Administrator2023-05-111-1/+1
|
* or1k relocation truncated to fit: R_OR1K_GOT16 even when using -mcmodel=largeLuca Bonissi2023-05-102-3/+18
| | | | | PR 30422 * elf32-or1k.c (or1k_elf_relocate_section): Prescan for R_OR1K_GOT_AHI16 relocs as they may occur after R_OR1K_GOT16 relocs.
* Automatic date update in version.inGDB Administrator2023-05-101-1/+1
|
* alpha-vms reloc sanity checkAlan Modra2023-05-091-2/+22
| | | | | | Stops fuzzed files triggering reads past the end of the reloc buffer. * vms-alpha.c (alpha_vms_slurp_relocs): Sanity check reloc records.
* Automatic date update in version.inGDB Administrator2023-05-091-1/+1
|
* Automatic date update in version.inGDB Administrator2023-05-081-1/+1
|
* Automatic date update in version.inGDB Administrator2023-05-071-1/+1
|
* Automatic date update in version.inGDB Administrator2023-05-061-1/+1
|
* Debug info is lost for functions only called from functions marked with ↵Nick Clifton2023-05-052-3/+21
| | | | | | | cmse_nonsecure_entr PR 30354 * elf32-arm.c (elf32_arm_gc_mark_extra_sections): If any debug sections are marked then rerun the extra marking in order to pick up any dependencies.
* Automatic date update in version.inGDB Administrator2023-05-051-1/+1
|
* MIPS: revert "default r6 if vendor is img"YunQiang Su2023-05-041-1/+1
| | | | | | | | In commit: 9171de358f230b64646bbb525a74e5f8e3dbe0dc, The default output is set to r6 if the vendor is img, It is ugly and should not be in upstream. Let's revert it.
* Automatic date update in version.inGDB Administrator2023-05-041-1/+1
|
* Make ar fasterOleg Tolmatcev2023-05-032-5/+21
| | | | * archive.c (_bfd_write_archive_contents): Use a larger buffer in order to improve efficiency.
* Improve the speed of computing checksums for COFF binaries.Oleg Tolmatcev2023-05-032-6/+67
| | | | | | * coffcode.h (coff_read_word_from_buffer): New function. * coffcode.h (COFF_CHECKSUM_BUFFER_SIZE): New constant. * coffcode.h (coff_compute_checksum): Improve speed by reducing the number of seeks and reads used.
* Remove unused args from bfd_make_debug_symbolAlan Modra2023-05-038-18/+13
| | | | | The ptr and size args are unused. Make the function look the same as bfd_make_empty_symbol.
* Generated docs and include filesAlan Modra2023-05-0329-2219/+2456
| | | | | | | | | | | | | bfd/doc/chew.c extracts documentation from source code comments annotated with keywords, and generates much of bfd.h and libbfd.h from those same comments. The docs have suffered from people (me too) adding things like CODE_FRAGMENT to the source to put code into bfd.h without realising that CODE_FRAGMENT also puts @example around said code into the docs. So we have random senseless things in the docs. This patch fixes that problem (well, the senseless things from CODE_FRAGMENT), moves most of the code out of bfd-in.h, and improves a few chew.c features. libbfd.h now automatically gets ATTRIBUTE_HIDDEN prototypes, and indentation in bfd.h and libbfd.h is better.
* Move bfd_alloc, bfd_zalloc and bfd_release to libbfd.cAlan Modra2023-05-035-85/+88
| | | | | | | | | | | These functions don't belong in opncls.c. * libbfd-in.h (bfd_release): Delete prototype. * opncls.c (bfd_alloc, bfd_zalloc, bfd_release): Move to.. * libbfd.c: ..here. Include objalloc.c and provide bfd_release with a FUNCTION comment. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
* Move bfd_elf_bfd_from_remote_memory to opncls.cAlan Modra2023-05-034-69/+50
| | | | | | | | | | | | | bfd_elf_bfd_from_remote_memory is just a wrapper, and the function could be implemented for other formats. Move it to opncls.c because it acts a little like some of the other bfd_open* routines. Also give it the usual FUNCTION etc. comment so prototypes and docs are handled automatically. * elf.c (bfd_elf_bfd_from_remote_memory): Move to.. * opncls.c: ..here, add FUNCTION comment. * bfd-in.h (bfd_elf_bfd_from_remote_memory): Delete prototype. * bfd-in2.h: Regenerate.
* hash.c: replace some unsigned long with unsigned intAlan Modra2023-05-033-42/+41
| | | | | | | | | * hash.c (higher_prime_number): Use uint32_t param, return value, tables and variables. (bfd_default_hash_table_size): Make it an unsigned int. (bfd_hash_set_default_size): Use unsigned int param and return. * bfd-in.h (bfd_hash_set_default_size): Update prototype. * bfd-in2.h: Regenerate.
* libbfc.c: Use stdint types for unsigned char and unsigned longAlan Modra2023-05-032-37/+37
| | | | | | | | | | * libbfd.c (bfd_put_8): Use bfd_byte rather than unsigned char. (bfd_get_8, bfd_get_signed_8): Likewise. (_bfd_read_unsigned_leb128, _bfd_safe_read_leb128): Likewise. (_bfd_read_signed_leb128): Likewise. (bfd_getb24, bfd_getl24): Replace unsigned long with uint32_t. (bfd_getb32, bfd_getl32): Likewise. (bfd_getb_signed_32, bfd_getl_signed_32): Likewise.
* Change signature of bfd crc functionsAlan Modra2023-05-032-20/+20
| | | | | | | | | | | | | | | | | | The crc calculated is 32 bits. Replace uses of unsigned long with uint32_t. Also use bfd_byte* for buffers. bfd/ * opncls.c (bfd_calc_gnu_debuglink_crc32): Use stdint types. (bfd_get_debug_link_info_1, bfd_get_debug_link_info): Likewise. (separate_debug_file_exists, bfd_follow_gnu_debuglink): Likewise. (bfd_fill_in_gnu_debuglink_section): Likewise. * bfd-in2.h: Regenerate. gdb/ * auto-load.c (auto_load_objfile_script): Update type of bfd_get_debug_link_info argument. * symfile.c (find_separate_debug_file_by_debuglink): Likewise. * gdb_bfd.c (get_file_crc): Update type of bfd_calc_gnu_debuglink_crc32 argument.
* _bfd_mips_elf_lo16_reloc vallo commentAlan Modra2023-05-031-4/+16
| | | | | | | | | | | This explains exactly why the high reloc adjustment is as it is, replacing the rather nebulous existing comment. I've also changed the expression from (lo+0x8000)&0xffff to (lo&0xffff)^0x8000 which better matches part of the standard 16-bit sign extension (resulting in exactly the same value), and hoisted the calculation out of the loop. * elfxx-mips.c (_bfd_mips_elf_lo16_reloc): Expand vallo comment. Hoist calculation out of loop.
* Automatic date update in version.inGDB Administrator2023-05-021-1/+1
|
* Automatic date update in version.inGDB Administrator2023-05-011-1/+1
|
* Automatic date update in version.inGDB Administrator2023-04-301-1/+1
|
* Automatic date update in version.inGDB Administrator2023-04-291-1/+1
|
* RISC-V: Enable x0 base relaxation for relax_pc even if --no-relax-gp.Nelson Chu2023-04-281-2/+6
| | | | | | | | | | | | | | Let --no-relax-gp only disable the gp relaxation for lui and pcrel relaxations, since x0 base and gp relaxations are different optimizations in fact, but just use the same function to handle. bfd/ * elfnn-riscv.c (_bfd_riscv_relax_pc): Like _bfd_riscv_relax_lui, set gp to zero when --no-relax-gp, then we should still keep the x0 base relaxation. (_bfd_riscv_relax_section): Enable _bfd_riscv_relax_pc when --no-relax-gp, we will disable the gp relaxation in the _bfd_riscv_relax_pc.
* RISC-V: Relax R_RISCV_[PCREL_]LO12_I/S to R_RISCV_GPREL_I/S for undefined weak.Nelson Chu2023-04-281-49/+6
| | | | | | | | bfd/ *elfnn-riscv.c (_bfd_riscv_relax_lui): For undefined weak symbol, just relax the R_RISCV_LO12_I/S to R_RISCV_GPREL_I/S, and then don't update the rs1 to zero until relocate_section. (_bfd_riscv_relax_pc): Likewise, but for R_RISCV_PCREL_LO12_I/S.
* Re: Keeping track of rs6000-coff archive element pointersAlan Modra2023-04-283-11/+28
| | | | | | | | | | | | | | | | | | | | | | | | Commit de7b90610e9e left a hole in the element checking, explained by the comment added to _bfd_xcoff_openr_next_archived_file. While fixing this, tidy some types used to hold unsigned values so that casts are not needed to avoid signed/unsigned comparison warnings. Also tidy a few things in xcoff.h. bfd/ * coff-rs6000.c (_bfd_xcoff_openr_next_archived_file): Check that we aren't pointing back at the last element. Make filestart a ufile_ptr. Update for xcoff_artdata change. (_bfd_strntol, _bfd_strntoll): Return unsigned values. (_bfd_xcoff_slurp_armap): Make off a ufile_ptr. (add_ranges): Update for xcoff_artdata change. * libbfd-in.h (struct artdata): Make first_file_filepos a ufile_ptr. * libbfd.h: Regenerate. include/ * coff/xcoff.h (struct xcoff_artdata): Replace min_elt with ar_hdr_size. (xcoff_big_format_p): In the !SMALL_ARCHIVE case return true for anything but a small archive.
* Remove deprecated bfd_readAlan Modra2023-04-283-64/+0
| | | | | | | | | 20+ years is long enough to warn. * bfd-in.h (bfd_read, bfd_write): Don't define (_bfd_warn_deprecated): Don't declare. * bfd-in2.h: Regenerate. * libbfd.c (_bfd_warn_deprecated): Delete.
* Make bfd_byte an int8_t, flagword a uint32_tAlan Modra2023-04-282-12/+12
| | | | | | | | * bfd-in.h (bfd_byte): Typedef as int8_t. (flagword): Typedef as uint32_t. (bfd_vma, bfd_signed_vma, bfd_size_type, symvalue): Use stdint types in !BFD64 case. * bfd-in2.h: Regenerate.
* Automatic date update in version.inGDB Administrator2023-04-281-1/+1
|
* Automatic date update in version.inGDB Administrator2023-04-271-1/+1
|
* RISC-V: Support XVentanaCondOps extensionPhilipp Tomsich2023-04-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ventana Micro has published the specification for their XVentanaCondOps ("conditional ops") extension at https://github.com/ventanamicro/ventana-custom-extensions/releases/download/v1.0.0/ventana-custom-extensions-v1.0.0.pdf which contains two new instructions - vt.maskc - vt.maskcn that can be used in constructing branchless sequences for various conditional-arithmetic, conditional-logical, and conditional-select operations. To support such vendor-defined instructions in the mainline binutils, this change also adds a riscv_supported_vendor_x_ext secondary dispatch table (but also keeps the behaviour of allowing any unknow X-extension to be specified in addition to the known ones from this table). As discussed, this change already includes the planned/agreed future requirements for X-extensions (which are likely to be captured in the riscv-toolchain-conventions repository): - a public specification document is available (see above) and is referenced from the gas-documentation - the naming follows chapter 27 of the RISC-V ISA specification - instructions are prefixed by a vendor-prefix (vt for Ventana) to ensure that they neither conflict with future standard extensions nor clash with other vendors bfd/ChangeLog: * elfxx-riscv.c (riscv_get_default_ext_version): Add riscv_supported_vendor_x_ext. (riscv_multi_subset_supports): Recognize INSN_CLASS_XVENTANACONDOPS. gas/ChangeLog: * doc/c-riscv.texi: Add section to list custom extensions and their documentation URLs. * testsuite/gas/riscv/x-ventana-condops.d: New test. * testsuite/gas/riscv/x-ventana-condops.s: New test. include/ChangeLog: * opcode/riscv-opc.h Add vt.maskc and vt.maskcn. * opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_XVENTANACONDOPS. opcodes/ChangeLog: * riscv-opc.c: Add vt.maskc and vt.maskcn. Series-version: 1 Series-to: binutils@sourceware.org Series-cc: Kito Cheng <kito.cheng@sifive.com> Series-cc: Nelson Chu <nelson.chu@sifive.com> Series-cc: Greg Favor <gfavor@ventanamicro.com> Series-cc: Christoph Muellner <cmuellner@gcc.gnu.org>
* Automatic date update in version.inGDB Administrator2023-04-261-1/+1
|
* Automatic date update in version.inGDB Administrator2023-04-251-1/+1
|
* New georgian translation for the bfd sub-directoryNick Clifton2023-04-242-0/+9352
|