aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2020-05-14RISC-V: Add elfNN_riscv_mkobject to initialize RISC-V tdata.Nelson Chu2-0/+14
For now we only have one char pointer in RISC-V tdata, so it should be fine. But once we need more elements in tdata, then we may get some uninitialize or unexpected values. I do meet the same problem when extending the RISC-V tdata. bfd/ elfnn-riscv.c (elfNN_riscv_mkobject): New function. We need this to initialize RISC-V tdata.
2020-05-14Automatic date update in version.inGDB Administrator1-1/+1
2020-05-13Automatic date update in version.inGDB Administrator1-1/+1
2020-05-12 [PATCH] bfd: Fix 64-bit relocation handling for a.outGunther Nikl2-4/+21
* aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported relocation size.
2020-05-12Automatic date update in version.inGDB Administrator1-1/+1
2020-05-11Power10 VSX 32-byte storage accessAlan Modra2-0/+13
bfd/ * elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp. opcodes/ * ppc-opc.c (insert_xtp, extract_xtp): New functions. (XTP, DQXP, DQXP_MASK): Define. (powerpc_opcodes): Add lxvp, stxvp, lxvpx, stxvpx. (prefix_opcodes): Add plxvp and pstxvp. gas/ * testsuite/gas/ppc/vsx_32byte.d, * testsuite/gas/ppc/vsx_32byte.s: New test. * testsuite/gas/ppc/ppc.exp: Run it. ld/ * testsuite/ld-powerpc/pcrelopt.s: Add lxvp and stxvp. * testsuite/ld-powerpc/pcrelopt.d: Update.
2020-05-11PowerPC Rename powerxx to power10Alan Modra2-26/+30
Now that ISA3.1 is out we can finish with the powerxx silliness. bfd/ * elf64-ppc.c: Rename powerxx to power10 throughout. gas/ * config/tc-ppc.c (md_assemble): Update for PPC_OPCODE_POWER10 renaming. * testsuite/gas/ppc/prefix-align.d: Use -mpower10/-Mpower10 in place of -mfuture/-Mfuture. * testsuite/gas/ppc/prefix-pcrel.d: Likewise. * testsuite/gas/ppc/prefix-reloc.d: Likewise. gold/ * powerpc.cc: Rename powerxx to power10 throughout. include/ * elf/ppc64.h: Update comment. * opcode/ppc.h (PPC_OPCODE_POWER10): Rename from PPC_OPCODE_POWERXX. ld/ * testsuite/ld-powerpc/callstub-1.d: Use -mpower10/-Mpower10 in place of -mfuture/-Mfuture. * testsuite/ld-powerpc/notoc2.d: Likewise. * testsuite/ld-powerpc/powerpc.exp: Likewise. * testsuite/ld-powerpc/tlsgd.d: Likewise. * testsuite/ld-powerpc/tlsie.d: Likewise. * testsuite/ld-powerpc/tlsld.d: Likewise. opcodes/ * ppc-dis.c (ppc_opts): Add "power10" entry. (print_insn_powerpc): Update for PPC_OPCODE_POWER10 renaming. * ppc-opc.c (POWER10): Rename from POWERXX. Update all uses.
2020-05-11PR25961, buffer overflow in coff_swap_aux_inAlan Modra3-8/+16
PR 25961 * coffgen.c (coff_get_normalized_symtab): Check that buffer contains required number of auxents before processing any auxent. * coffswap.h (coff_swap_aux_in <C_FILE>): Only swap in extended file name from auxents for PE.
2020-05-11Automatic date update in version.inGDB Administrator1-1/+1
2020-05-10Automatic date update in version.inGDB Administrator1-1/+1
2020-05-09Automatic date update in version.inGDB Administrator1-1/+1
2020-05-08Automatic date update in version.inGDB Administrator1-1/+1
2020-05-07Automatic date update in version.inGDB Administrator1-1/+1
2020-05-06Automatic date update in version.inGDB Administrator1-1/+1
2020-05-05Automatic date update in version.inGDB Administrator1-1/+1
2020-05-04[PATCH] bfd: tweak SET_ARCH_MACH of aout-cris.cGunther Nikl2-11/+18
* aout-cris.c (DEFAULT_ARCH): Delete define. (MY_set_arch_mach): Likewise. (SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture of bfd_arch_cris. (swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits of r_type before the shift.
2020-05-04[binutils-gdb][ld][AArch64] Fix group_sections algorithmWilco Dijkstra2-27/+62
PR ld/25665 * bfd/elfnn-aarch64.c (group_sections): Copy implementation from elf32-arm.c. * testsuite/ld-aarch64/aarch64-elf.exp: Add new test. * testsuite/ld-aarch64/farcall-group.s: New large group test. * testsuite/ld-aarch64/farcall-group.d: Likewise.
2020-05-04Automatic date update in version.inGDB Administrator1-1/+1
2020-05-03Automatic date update in version.inGDB Administrator1-1/+1
2020-05-02Automatic date update in version.inGDB Administrator1-1/+1
2020-05-01PR25900, RISC-V: null pointer dereferenceAlan Modra2-5/+13
PR 25900 * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before accessing root.u.def of symbols. Also check root.u.def.section is non-NULL. Reverse tests so as to make the logic positive.
2020-05-01PR25882, .gnu.attributes are not checked for shared librariesAlan Modra2-0/+9
This allows backend merge_private_bfd_data to examine shared library e_flags and/or .gnu.attributes. ARM and PowerPC have done so when using ld.gold for a long time. (The tic6x change below is dead code due to the earlier FIXME, but this is probably one of the changes needed there.) PR 25882 bfd/ * elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output. ld/ * ldlang.c (lang_check): Call bfd_merge_private_bfd_data for shared libraries.
2020-05-01FIXME for merging of e_flags and .gnu.attributesAlan Modra11-0/+51
Code in the linker, present before the addition of .gnu.attributes support, results in shared libraries not being considered by BFD when merging e_flags and .gnu.attributes from input files to the output. That doesn't seem correct to me, but I don't know enough about all the various ABIs to change the behaviour with any confidence. So this patch merely punts on dynamic objects in merge_private_bfd_data target functions, with a FIXME for maintainer attention. I haven't excluded shared libraries from being considered where the target merge_private_bfd_data (a) already has code dealing with shared libraries, or (b) where that function just sets the output to the most constraining arch/mach combination and other fairly trivial merges, or (c) when the target has no shared library linker support. In (a) are: arc, arm, aarch64, riscv, sparc. In (b) are: bpf, cris, csky, m32r, m68k, mn10300, nios2, tilegx, tilepro, vax, visium, xtensa. In (c) are: bpf, cr16, h8300, iq2000, m32c, m68hc11, m68hc12, mcore, mep, msp430, mt, rl78, rx, v850. PR 25882 * elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME. * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise. * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise. * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise. * elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise. * elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_merge_private_data): Likewise. * elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise. * elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise. * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
2020-05-01ppc32 merging of e_flags from dynamic objectsAlan Modra2-0/+9
EF_PPC_RELOCATABLE and similar flags, if present in an input shared library, don't have any relevance as far as the output file is concerned. Currently, dynamic objects aren't seen in merge_private_bfd_data. This patch is in preparation for a change to that. PR 25882 * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Ignore e_flags from shared libraries.
2020-05-01Automatic date update in version.inGDB Administrator1-1/+1
2020-04-29xtensa: fix XTENSA_NDIFF handling for PR ld/25861Max Filippov2-11/+22
Fields marked with XTENSA_NDIFF relocations are not negated, they only have sign bits removed. Don't negate their values when relaxation is performed. Don't add sign bits when the value is zero. Report overflow when the result has negative sign but all significant bits are zero. 2020-04-29 Max Filippov <jcmvbkbc@gmail.com> bfd/ * elf32-xtensa.c (relax_section): Don't negate diff_value for XTENSA_NDIFF relocations. Don't add sign bits whe diff_value equals 0. Report overflow when the result has negative sign but all significant bits are zero. ld/ * testsuite/ld-xtensa/relax-diff1.d: New test definition. * testsuite/ld-xtensa/relax-diff1.s: New test source. * testsuite/ld-xtensa/relax-ndiff.d: New test definition. * testsuite/ld-xtensa/relax-ndiff.s: New test source. * testsuite/ld-xtensa/xtensa.exp: (relax-diff1) (relax-ndiff): New tests.
2020-04-30Automatic date update in version.inGDB Administrator1-1/+1
2020-04-29bfd: Fix 64-bit relocation handling for a.outGunther Nikl2-3/+16
* aoutx.h (swap_std_reloc_out): Special case 64 bit relocations. (aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
2020-04-29Automatic date update in version.inGDB Administrator1-1/+1
2020-04-28Automatic date update in version.inGDB Administrator1-1/+1
2020-04-28alpha-vms: divide by zeroAlan Modra2-1/+9
The zero check was on the wrong operand. And, yes, the second operand popped is supposed to be divided by the first operand popped. * vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check. Emit warning message.
2020-04-27x86: Add i386 PE big-object supportTamar Christina9-70/+176
The 64-bit version of binutils got support for the PE COFF BIG OBJ format a couple of years ago. The BIG OBJ format is a slightly different COFF format which extends the size of the number of section field in the header from a uint16_t to a uint32_t and so greatly increases the number of sections allowed. However the 32-bit version of bfd never got support for this. The GHC Haskell compiler generates a great deal of symbols due to it's use of -ffunction-sections and -fdata-sections. This meant that we could not build the 32-bit version of the GHC Compiler for many releases now as binutils didn't have this support. This patch adds the support to the 32-bit port of binutils as well and also does come cleanup in the code. bfd/ChangeLog: * coff-i386.c (COFF_WITH_PE_BIGOBJ): New. * coff-x86_64.c (COFF_WITH_PE_BIGOBJ): New. * config.bfd (targ_selvecs): Rename x86_64_pe_be_vec to x86_64_pe_big_vec as it not a big-endian format. (vec i386_pe_big_vec): New. * configure.ac: Likewise. * targets.c: Likewise. * configure: Regenerate. * pe-i386.c (TARGET_SYM_BIG, TARGET_NAME_BIG, COFF_WITH_PE_BIGOBJ): New. * pe-x86_64.c (TARGET_SYM_BIG, TARGET_NAME_BIG): New. (x86_64_pe_be_vec): Moved. gas/ChangeLog: * NEWS: Add news entry for big-obj. * config/tc-i386.c (i386_target_format): Support new format. * doc/c-i386.texi: Add i386 support. * testsuite/gas/pe/big-obj.d: Rename test to not be x64 specific. * testsuite/gas/pe/pe.exp (big-obj): Make test run on i386 as well. ld/ChangeLog: * pe-dll.c (pe_detail_list): Add pe-bigobj-i386.
2020-04-27Automatic date update in version.inGDB Administrator1-1/+1
2020-04-26Automatic date update in version.inGDB Administrator1-1/+1
2020-04-25Automatic date update in version.inGDB Administrator1-1/+1
2020-04-24Automatic date update in version.inGDB Administrator1-1/+1
2020-04-23arc: Add support for ARC HS extra registers in core filesAnton Kolesov3-0/+39
When a coredump is generated, there are a few registers in ARC HS that are put under a special section, namely ".reg-v2". It is for backward compatibility reasons with older tools that we have decided not to extend the generic ".reg" section. This patch makes it possible to display the information better regarding that section. Compare the output of "readelf" without and with these changes: $ readelf -n core # without the patch ... LINUX 0x0000000c Unknown note type: (0x00000600) description data: 78 08 00 00 2f 6c 64 2d 75 43 6c 69 $ readelf -n core # with the patch ... LINUX 0x0000000c NT_ARC_V2 (ARC HS accumulator/extra registers) description data: 78 08 00 00 2f 6c 64 2d 75 43 6c 69 In another commit (soon to be submitted), GDB will makes use of these changes to parse the extra section and its registers. bfd/ChangeLog 2020-03-26 Anton Kolesov <anton.kolesov@synopsys.com> * elf-bfd.h (elfcore_write_arc_v2): Add prototype. * elf.c (elfcore_grok_arc_v2): New function. (elfcore_grok_note): Call the new function to handle the corresponding note. (elfcore_write_arc_v2): New function. (elfcore_write_register_note): Call the new function to handle the corresponding pseudo-sections. binutils/ChangeLog 2020-03-26 Anton Kolesov <anton.kolesov@synopsys.com> * readelf.c (get_note_type): Handle NT_ARC_V2. include/elf/ChangeLog 2020-03-26 Anton Kolesov <anton.kolesov@synopsys.com> * common.h (NT_ARC_V2): New macro definitions.
2020-04-22xtensa: fix PR ld/25861Max Filippov5-2/+152
Introduce new relaxations XTENSA_PDIFF{8,16,32} for positive differences (subtracted symbol precedes diminished symbol) and XTENSA_NDIFF{8,16,32} for negative differences (subtracted symbol follows diminished symbol). Don't generate XTENSA_DIFF relocations in the assembler, generate XTENSA_PDIFF or XTENSA_NDIFF based on relative symbol position. Handle XTENSA_DIFF in BFD for compatibility with old object files. Handle XTENSA_PDIFF and XTENSA_NDIFF in BFD, treating difference value as unsigned. 2020-04-22 Max Filippov <jcmvbkbc@gmail.com> bfd/ * bfd-in2.h: Regenerated. * elf32-xtensa.c (elf_howto_table): New entries for R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}. (elf_xtensa_reloc_type_lookup, elf_xtensa_do_reloc) (relax_section): Add cases for R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}. * libbfd.h (bfd_reloc_code_real_names): Add names for BFD_RELOC_XTENSA_PDIFF{8,16,32} and BFD_RELOC_XTENSA_NDIFF{8,16,32}. * reloc.c: Add documentation for BFD_RELOC_XTENSA_PDIFF{8,16,32} and BFD_RELOC_XTENSA_NDIFF{8,16,32}. binutils/ * readelf.c (is_none_reloc): Recognize BFD_RELOC_XTENSA_PDIFF{8,16,32} and BFD_RELOC_XTENSA_NDIFF{8,16,32}. gas/ * config/tc-xtensa.c (md_apply_fix): Replace BFD_RELOC_XTENSA_DIFF{8,16,32} generation with BFD_RELOC_XTENSA_PDIFF{8,16,32} and BFD_RELOC_XTENSA_NDIFF{8,16,32} generation. * testsuite/gas/xtensa/loc.d: Replace BFD_RELOC_XTENSA_DIFF16 with BFD_RELOC_XTENSA_PDIFF16 in the expected output. include/ * elf/xtensa.h (elf_xtensa_reloc_type): New entries for R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}. ld/ * testsuite/ld-xtensa/relax-loc.d: New test definition. * testsuite/ld-xtensa/relax-loc.s: New test source. * testsuite/ld-xtensa/xtensa.exp (relax-loc): New test.
2020-04-23Automatic date update in version.inGDB Administrator1-1/+1
2020-04-22Automatic date update in version.inGDB Administrator1-1/+1
2020-04-21BFD: Exclude sections with no content from compress check.Tamar Christina2-0/+9
The check in bfd_get_full_section_contents is trying to check that we don't allocate more space for a section than the size of the section is on disk. Previously we excluded linker created sections since they didn't have a size on disk. However we also need to exclude sections with no content as well such as the BSS section. Space for these would not have been allocated by the assembler and so the check would incorrectly fail. bfd/ChangeLog: PR binutils/24753 * compress.c (bfd_get_full_section_contents): Exclude sections with no content. gas/ChangeLog: PR binutils/24753 * testsuite/gas/arm/pr24753.d: New test. * testsuite/gas/arm/pr24753.s: New test.
2020-04-21elf: Strip zero-sized dynamic sectionsH.J. Lu5-0/+127
ELF size_dynamic_sections is called by the ELF backend linker after all the linker input files have been seen but before the section sizes have been set. After the sections sizes have been set, target-specific, global optimizations may make some dynamic sections zero-sized if they are no longer needed. Add ELF strip_zero_sized_dynamic_sections so that ELF backend linker can strip zero-sized dynamic sections after the sections sizes have been set. bfd/ PR ld/25849 * elf-bfd.h (elf_backend_data): Add elf_backend_strip_zero_sized_dynamic_sections. (_bfd_elf_strip_zero_sized_dynamic_sections): New prototype. * elf64-alpha.c (elf_backend_strip_zero_sized_dynamic_sections): New macro. * elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): New function. * elfxx-target.h (elf_backend_strip_zero_sized_dynamic_sections): New macro. (elfNN_bed): Add elf_backend_strip_zero_sized_dynamic_sections. ld/ PR ld/25849 * ldelfgen.c (ldelf_map_segments): Call elf_backend_strip_zero_sized_dynamic_sections. * testsuite/ld-alpha/tlsbinr.rd: Updated.
2020-04-21alpha: Warn DT_TEXTREL with -MH.J. Lu2-9/+30
This fixes: FAIL: DT_TEXTREL map file warning * elf64-alpha.c (alpha_elf_reloc_entry): Replace reltext with sec. (elf64_alpha_check_relocs): Set sec instead of reltext. Warn DT_TEXTREL with -M. (elf64_alpha_calc_dynrel_sizes): Warn DT_TEXTREL with -M.
2020-04-21Updated Serbian translation for the BFD directory.Nick Clifton2-3156/+5653
2020-04-21Remove SH-5 remnantsAlan Modra2-16/+7
git commit 211dc24b87 removed most sh5 and sh64 SuperH support, after they were obsoleted by git commit 2b213129c5. This patch removes a few remaining pieces that should have gone with 211dc24b87. include/ * elf/sh.h (STO_SH5_ISA32, SHF_SH5_ISA32, SHF_SH5_ISA32_MIXED), (SHT_SH5_CR_SORTED, STT_DATALABEL): Delete. bfd/ * elf32-sh.c (sh_elf_relocate_section): Remove STO_SH5_ISA32 processing.
2020-04-21Automatic date update in version.inGDB Administrator1-1/+1
2020-04-20When bfd/pdp11.c was copied from bfd/aoutx.h, the #defines for external ↵Stephen Casner2-1/+10
symbol types N_TEXT etc. were #undef'd and then #define'd with new values. But N_STAB was not changed even though the new value for N_EXT overlapped with it. This caused aout_link_write_symbols() to treat global symbols referenced in the source but defined in a linker script as undefined. Separately, in translate_symbol_table() the 16-bit symbol values were sign extended to unsigned long (e.g., 64 bits) when they really should be treated as unsigned so the value remains 16 bits. PR 25828 * pdp11.c (N_STAB): Modify value to avoid conflict with N_EXT causing globals from linker script to be treated as debug symbols. (translate_symbol_table): Don't sign-extend symbol values from 16 to 64 bits in nm output.
2020-04-20Automatic date update in version.inGDB Administrator1-1/+1
2020-04-20PowerPC64: remove empty .rela.dyn (.rela.branch_lt)Alan Modra2-0/+6
Stripping .rela.branch_lt is easy enough but messes with the testsuite due to stub symbols (that use section id) changing. Tests that run on more than one target variant can be tricky to fix, this renaming happened to work. bfd/ * elf64-ppc.c (ppc64_elf_size_stubs): Strip relbrlt too. ld/ * testsuite/ld-powerpc/tlsopt5.s: Rename foo to aaaaa. * testsuite/ld-powerpc/tlsopt5.d: Adjust to suit. * testsuite/ld-powerpc/tlsopt6.d: Likewise.
2020-04-19Automatic date update in version.inGDB Administrator1-1/+1