aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2022-04-04Automatic date update in version.inGDB Administrator1-1/+1
2022-04-03Move microblaze relax info to target specific dataAlan Modra3-75/+85
Target specific data shouldn't be put in struct bfd_section. * section.c (struct bfd_section): Delete relax and relax_count. (BFD_FAKE_SECTION): Adjust to suit. (struct relax_table): Move to.. * elf32-microblaze.c (struct relax_table): ..here. (struct _microblaze_elf_section_data): New. (microblaze_elf_section_data): Define. (microblaze_elf_new_section_hook): New function. (bfd_elf32_new_section_hook): Define. (calc_fixup): Return a size_t. Adjust to suit new location of relax and relax_count. (microblaze_elf_relax_section): Adjust to suit new location of relax and relax_count. Make some variables size_t. * bfd-in2.h: Regenerate.
2022-04-03Revert commit 240d6706c6a2Alan Modra1-62/+22
PR 28592 PR 15994 PR 15935 * dwarf2.c (lookup_address_in_line_info_table): Return bool rather than a range. (comp_unit_find_nearest_line): Likewise. Return true if function info found without line info. (_bfd_dwarf2_find_nearest_line): Revert range handling code.
2022-04-03Regen bfd po/SRC-POTFILES.inAlan Modra1-2/+0
2022-04-03Automatic date update in version.inGDB Administrator1-1/+1
2022-04-02Automatic date update in version.inGDB Administrator1-1/+1
2022-04-01Use pseudosections for NT_FREEBSD_X86_SEGBASES core dump notes.John Baldwin3-0/+25
This includes adding pseudosections when reading a core dump as well as support for writing out a core dump note from a pseudosection. bfd/ChangeLog: * elf-bfd.h (elfcore_write_x86_segbases): New. * elf.c (elfcore_grok_freebsd_note): Add pseudosections for NT_FREEBSD_X86_SEGBASES register notes. (elfcore_write_x86_segbases): New. (elfcore_write_register_note): Write NT_FREEBSD_X86_SEGBASES register notes.
2022-04-01elfcore_grok_freebsd_note: Remove checks of note->namesz.John Baldwin2-8/+6
This function is only called if the note name is "FreeBSD", so checking the name size is unnecessary. bfd/ChangeLog: * elf.c (elfcore_grok_freebsd_note): Remove checks for namesz.
2022-03-31x86: Remove bfd_arch_l1om and bfd_arch_k1omH.J. Lu11-239/+15
Remove bfd_arch_l1om and bfd_arch_k1om since L1OM/K1OM support has been removed from gas, ld and opcodes. bfd/ * Makefile.am (ALL_MACHINES): Remove cpu-l1om.lo and cpu-k1om.lo. (ALL_MACHINES_CFILES): Remove cpu-l1om.c and cpu-k1om.c. * archures.c (bfd_mach_l1om): Removed. (bfd_mach_l1om_intel_syntax): Likewise. (bfd_mach_k1om): Likewise. (bfd_mach_k1om_intel_syntax): Likewise. (bfd_k1om_arch): Likewise. (bfd_l1om_arch): Likewise. (bfd_archures_list): Remove bfd_k1om_arch and bfd_l1om_arch references. * config.bfd (targ_selvecs): Remove l1om_elf64_vec. l1om_elf64_fbsd_vec, k1om_elf64_vec and k1om_elf64_fbsd_vec. (targ_archs): Remove bfd_l1om_arch and bfd_k1om_arch. * configure.ac (k1om_elf64_vec): Removed. (k1om_elf64_fbsd_vec): Likewise. (l1om_elf64_vec): Likewise. (l1om_elf64_fbsd_vec): Likewise. * cpu-k1om.c: Removed. * cpu-l1om.c: Likewise. * elf64-x86-64.c (elf64_l1om_elf_object_p): Removed. (elf64_k1om_elf_object_p): Likewise. (l1om_elf64_vec): Removed. (l1om_elf64_fbsd_vec): Likewise. (k1om_elf64_vec): Likewise. (k1om_elf64_fbsd_vec): Likewise. (ELF_TARGET_OS): Undefine. * targets.c (_bfd_target_vector): Remove k1om_elf64_vec, k1om_elf64_fbsd_vec, l1om_elf64_vec and l1om_elf64_fbsd_vec. * Makefile.in: Regenerate. * bfd-in2.h: Likewise. * configure: Likewise. opcodes/ * configure.ac: Remove bfd_arch_l1om/bfd_arch_k1om references. * disassemble.c (disassembler): Likewise. * configure: Regenerate.
2022-04-01Automatic date update in version.inGDB Administrator1-1/+1
2022-03-31Automatic date update in version.inGDB Administrator1-1/+1
2022-03-30Automatic date update in version.inGDB Administrator1-1/+1
2022-03-29bfd/Dwarf2: gas doesn't mangle namesJan Beulich1-0/+1
Include the language identifier emitted by gas in the set of ones where no mangled names are expected. Even if there could be "hand-mangled" names, gas doesn't emit DW_AT_linkage_name in the first place.
2022-03-29bfd/Dwarf2: make find-nearest-line returned function name consistentJan Beulich1-2/+3
Prior to entering the enclosing "else if()" the earlier associated if() checks function->is_linkage and, if set, uses function->name. The comment in patch context precedes (and explains) the setting function->is_linkage. Yet with the flag set, we should then also return the function name, just like said earlier if() would do when we came here a 2nd time for the same "addr". And indeed passing the same address twice on addr2line's command line would resolve the function for the 2nd instance, but not for the 1st (if this code path is taken). (This, obviously, is particularly relevant when there's no ELF symbol table in the first place, like would be the case - naturally - in PE/COFF binaries, for example.)
2022-03-29Automatic date update in version.inGDB Administrator1-1/+1
2022-03-28Automatic date update in version.inGDB Administrator1-1/+1
2022-03-27Automatic date update in version.inGDB Administrator1-1/+1
2022-03-26Automatic date update in version.inGDB Administrator1-1/+1
2022-03-25libtool.m4: fix the NM="/nm/over/here -B/option/with/path" caseNick Alcock1-7/+13
My previous nm patch handled all cases but one -- if the user set NM in the environment to a path which contained an option, libtool's nm detection tries to run nm against a copy of nm with the options in it: e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle". This is unlikely to be desirable: in this case we should run "/usr/bin/nm --blargle /usr/bin/nm". Furthermore, as part of this nm has to detect when the passed-in $NM contains a path, and in that case avoid doing a path search itself. This too was thrown off if an option contained something that looked like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run "nm -B../prev-gcc nm" which rarely works well (and indeed it looks to see whether that nm exists, finds it doesn't, and wrongly concludes that nm -p or whatever does not work). Fix all of these by clipping all options (defined as everything including and after the first " -") before deciding whether nm contains a path (but not using the clipped value for anything else), and then removing all options from the path-modified nm before looking to see whether that nm existed. NM=my-nm now does a path search and runs e.g. /usr/bin/my-nm -B /usr/bin/my-nm NM=/usr/bin/my-nm now avoids a path search and runs e.g. /usr/bin/my-nm -B /usr/bin/my-nm NM="my-nm -p../wombat" now does a path search and runs e.g. /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search: ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm This seems to be all combinations, including those used by GCC bootstrap (which, before this commit, fails to bootstrap when configured --with-build-config=bootstrap-lto, because the lto plugin is now using --export-symbols-regex, which requires libtool to find a working nm, while also using -B../prev-gcc to point at the lto plugin associated with the GCC just built.) Regenerate all affected configure scripts. * libtool.m4 (LT_PATH_NM): Handle user-specified NM with options, including options containing paths.
2022-03-25Automatic date update in version.inGDB Administrator1-1/+1
2022-03-24Automatic date update in version.inGDB Administrator1-1/+1
2022-03-23ELF32: don't silently truncate relocation addendsJan Beulich1-0/+13
At least x86-64's x32 sub-mode and RISC-V's 32-bit mode calculate addends as 64-bit values, but store them in signed 32-bit fields when generating the file without encountering any earlier error. When the relocated field is a 64-bit one, the value resulting after processing the relocation record when linking (or the latest when loading) may thus be wrong due to the truncation. With the code change in place, one x32 testcase actually triggers the new diagnostic. That one case of too large a (negative) addend is being adjusted alongside the addition of a new testcase to actually trigger the new error. (Note that due to internal BFD behavior the relocation in .data doesn't get processed anymore after the errors in .text.) Note that in principle it is possible to express 64-bit relocations in ELF32, but this would require .rel relocations, i.e. with the addend stored in the 64-bit field being relocated. But I guess it would be a lot of effort for little gain to actually support this.
2022-03-23Automatic date update in version.inGDB Administrator1-1/+1
2022-03-22Fix return code in _bfd_dwarf2_find_nearest_line().Steiner H Gunderson2-1/+10
* dwarf2.c (_bfd_dwarf2_find_nearest_line): if a function name is found, but no line number info, then return a result of 2.
2022-03-22Automatic date update in version.inGDB Administrator1-1/+1
2022-03-21Reduce O(n2) performance overhead when parsing DWARF unit information.Steiner H Gunderson2-33/+67
PR 28978 * dwarf2.c (scan_unit_for_symbols): When performing second pass, check to see if the function or variable being processed is the same as the previous one.
2022-03-21Automatic date update in version.inGDB Administrator1-1/+1
2022-03-20LoongArch: Fix LD check fails.liuzhensong2-62/+287
Some test cases about ifunc. bfd/ * elfnn-loongarch.c * elfxx-loongarch.h === ld Summary === of expected passes 1430 of expected failures 11 of untested testcases 1 of unsupported tests 154
2022-03-20LoongArch: Update ABI eflag in elf header.liuzhensong1-1/+1
Update LoongArch ABI eflag in elf header. ilp32s 0x5 ilp32f 0x6 ilp32d 0x7 lp64s 0x1 lp64f 0x2 lp64d 0x3 bfd/ * elfnn-loongarch.c Check object flags while ld. gas/ * tc-loongarch.c Write eflag to elf header. include/elf * loongarch.h Define ABI number.
2022-03-20LoongArch: Use functions instead of magic numbers.liuzhensong3-516/+691
Replace the magic numbers in gas(tc-loongarch.c) and bfd(elfnn-loongarch.c) with the functions defined in the howto table(elfxx-loongarch.c). gas/ * config/tc-loongarch.c: use functions. bfd/ * elfnn-loongarch.c: use functions. * elfxx-loongarch.c: define functions. * elfxx-loongarch.h
2022-03-20Automatic date update in version.inGDB Administrator1-1/+1
2022-03-19Automatic date update in version.inGDB Administrator1-1/+1
2022-03-18Fix ld-arm bug in encoding of blx calls jumping from thumb to arm instructionsViorel Preoteasa2-3/+21
PR 28924 * elf32-arm.c (THM_MAX_FWD_BRANCH_OFFSET): Fix definition. (THM2_MAX_FWD_BRANCH_OFFSET): Likewise.
2022-03-18RISC-V: Cache management instructionsTsukasa OI1-0/+6
This commit adds 'Zicbom' / 'Zicboz' instructions. bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add handling for new instruction classes. include/ChangeLog: * opcode/riscv-opc.h (MATCH_CBO_CLEAN, MASK_CBO_CLEAN, MATCH_CBO_FLUSH, MASK_CBO_FLUSH, MATCH_CBO_INVAL, MASK_CBO_INVAL, MATCH_CBO_ZERO, MASK_CBO_ZERO): New macros. * opcode/riscv.h (enum riscv_insn_class): Add new instruction classes INSN_CLASS_ZICBOM and INSN_CLASS_ZICBOZ. opcodes/ChangeLog: * riscv-opc.c (riscv_opcodes): Add cache-block management instructions.
2022-03-18RISC-V: Prefetch hint instructions and operand setTsukasa OI1-0/+3
This commit adds 'Zicbop' hint instructions. bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add handling for new instruction class. gas/ChangeLog: * config/tc-riscv.c (riscv_ip): Add handling for new operand type 'f' (32-byte aligned pseudo S-type immediate for prefetch hints). (validate_riscv_insn): Likewise. include/ChangeLog: * opcode/riscv-opc.h (MATCH_PREFETCH_I, MASK_PREFETCH_I, MATCH_PREFETCH_R, MASK_PREFETCH_R, MATCH_PREFETCH_W, MASK_PREFETCH_W): New macros. * opcode/riscv.h (enum riscv_insn_class): Add new instruction class INSN_CLASS_ZICBOP. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Add handling for new operand type. * riscv-opc.c (riscv_opcodes): Add prefetch hint instructions.
2022-03-18Automatic date update in version.inGDB Administrator1-1/+1
2022-03-17ubsan: Null dereference in parse_moduleAlan Modra1-0/+8
* vms-alpha.c (parse_module): Sanity check that DST__K_RTNBEG has set module->func_table for DST__K_RTNEND. Check return of bfd_zalloc.
2022-03-17asan: Buffer overflow in evax_bfd_print_dstAlan Modra1-12/+12
With "name" a char*, the length at name[0] might be negative, escaping buffer limit checks. * vms-alpha.c (evax_bfd_print_dst): Make name an unsigned char*. (evax_bfd_print_emh): Likewise.
2022-03-17asan: Buffer overflow in som_set_reloc_infoAlan Modra1-4/+6
* som.c (som_set_reloc_info): Add symcount parameter. Don't access symbols past symcount. Don't access fixup past end_fixups. (som_slurp_reloc_table): Adjust som_set_reloc_info calls.
2022-03-17Re: asan: buffer overflow in peXXigen.cAlan Modra1-44/+52
In the process of fixing a buffer overflow in commit fe69d4fcf0194a, I managed to introduce a fairly obvious NULL pointer dereference.. * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Don't segfault on not finding section. Wrap overlong lines.
2022-03-17Re: bfd: add AMDGCN architectureAlan Modra1-0/+2
* po/SRC-POTFILES.in: Regenerate.
2022-03-17Automatic date update in version.inGDB Administrator1-1/+1
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.