1. Feb 09, 2022
    • Nick Clifton's avatar
      This is the 2.38 GNU Binutils release · 20756b0f
      Nick Clifton authored
      20756b0f
    • GDB Administrator's avatar
      Automatic date update in version.in · c6b2100b
      GDB Administrator authored
      c6b2100b
    • Palmer Dabbelt's avatar
      RISC-V: Stop reporting warnings for mismatched extension versions · 1379b6ec
      Palmer Dabbelt authored
      
      
      The extension version checking logic is really just too complicated to
      encode into the linker, trying to do so causes more harm than good.
      This removes the checks and the associated tests, leaving the logic to
      keep the largest version of each extension linked into the target.
      
      bfd/
      
      	* elfnn-riscv.c (riscv_version_mismatch): Rename to
      	riscv_update_subset_version, and stop reporting warnings on
      	version mismatches.
      	(riscv_merge_std_ext): Adjust calls to riscv_version_mismatch.
      	(riscv_merge_multi_letter_ext): Likewise.
      
      ld/
      	* testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Remove
      	* testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise
      	* testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise
      	* testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d: Likewise
      	* testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s: Likewise
      	* testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s: Likewise
      	* testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s: Likewise
      	* testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s: Likewise
      	* testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: New test.
      	* testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i21_m2p0.s:
      	Likewise.
      	* testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i21_m2p1.s:
      	Likewise.
      	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Remove obselete
      	attr-merge-arch-failed-{01,02}, replace with
      	attr-merge-user-ext-01.
      
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      1379b6ec
  2. Feb 08, 2022
    • H.J. Lu's avatar
      i386: Allow GOT32 relocations against ABS symbols · 3cb97931
      H.J. Lu authored
      GOT32 relocations are allowed since absolute value + addend is stored in
      the GOT slot.
      
      Tested on glibc 2.35 build with GCC 11.2 and -Os.
      
      bfd/
      
      	PR ld/28870
      	* elfxx-x86.c (_bfd_elf_x86_valid_reloc_p): Also allow GOT32
      	relocations.
      
      ld/
      
      	PR ld/28870
      	* testsuite/ld-i386/i386.exp: Run pr28870.
      	* testsuite/ld-i386/pr28870.d: New file.
      	* testsuite/ld-i386/pr28870.s: Likewise.
      
      (cherry picked from commit 30a954525f4e53a9cd50a1a8a6f201c7cf6595c7)
      3cb97931
    • GDB Administrator's avatar
      Automatic date update in version.in · d9aa137f
      GDB Administrator authored
      d9aa137f
  3. Feb 07, 2022
    • Alan Modra's avatar
      Revert "elf: Remove the 1-page gap before the RELRO segment" · 7e4cfa21
      Alan Modra authored
      This reverts commit 2f83249c.
      
      	PR ld/28743
      	* ldlang.c (lang_size_relro_segment_1): Revert 2022-01-10 changes.
      	* testsuite/ld-i386/pr20830.d: Likewise.
      	* testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
      	* testsuite/ld-x86-64/pr14207.d: Likewise.
      	* testsuite/ld-x86-64/pr18176.d: Likewise.
      	* testsuite/ld-x86-64/pr20830a-now.d: Likewise.
      	* testsuite/ld-x86-64/pr20830a.d: Likewise.
      	* testsuite/ld-x86-64/pr20830b-now.d: Likewise.
      	* testsuite/ld-x86-64/pr20830b.d: Likewise.
      	* testsuite/ld-x86-64/pr21038a-now.d: Likewise.
      	* testsuite/ld-x86-64/pr21038a.d: Likewise.
      	* testsuite/ld-x86-64/pr21038b-now.d: Likewise.
      	* testsuite/ld-x86-64/pr21038c-now.d: Likewise.
      	* testsuite/ld-x86-64/pr21038c.d: Likewise.
      7e4cfa21
    • Alan Modra's avatar
      Revert "ld: Rewrite lang_size_relro_segment_1" · fb42d68c
      Alan Modra authored
      This reverts commit 8b7c6a1f.
      
      	PR ld/28743
      	PR ld/28819
      	* ldlang.c (lang_size_relro_segment_1): Revert 2022-01-14 change.
      	testsuite/ld-x86-64/pr28743-1.d: Likewise.
      	testsuite/ld-x86-64/pr28743-1.s: Likewise.
      	testsuite/ld-x86-64/x86-64.exp: Likewise.
      fb42d68c
    • GDB Administrator's avatar
      Automatic date update in version.in · 14a9ad41
      GDB Administrator authored
      14a9ad41
  4. Feb 06, 2022
  5. Feb 05, 2022
    • H.J. Lu's avatar
      x86: Skip undefined symbol when finishing DT_RELR · 3b61c8f7
      H.J. Lu authored
      Don't abort for undefined symbol when finishing DT_RELR.  Instead, skip
      undefined symbol.  Undefined symbol will be reported by relocate_section.
      
      	* elfxx-x86.c (elf_x86_size_or_finish_relative_reloc): Skip
      	undefined symbol in finishing phase.
      
      (cherry picked from commit a9e61227c09c03d5cb54f9c88520baffc1d86c86)
      3b61c8f7
    • Alan Modra's avatar
      PR28827 testcase · 0e24f6bd
      Alan Modra authored
      This testcase triggers a stub sizing error with the patches applied
      for PR28743 (commit 2f83249c and c804c6f98d34).
      
      	PR 28827
      	* testsuite/ld-powerpc/pr28827-1.s,
      	* testsuite/ld-powerpc/pr28827-1.d: New test.
      	* testsuite/ld-powerpc/powerpc.exp: Run it.
      
      (cherry picked from commit 9810db10f726f47c8e878ca4b0b4b4f5e9c16a5d)
      (cherry picked from commit 0acf434a23768449cbb4b3732355f3f2febecaee)
      0e24f6bd
    • Alan Modra's avatar
      Enable "size" as a dumpprog in ld · e496d83b
      Alan Modra authored
      binutils/
      	* testsuite/lib/binutils-common.exp (run_dump_test): Reference
      	global SIZE and SIZEFLAGS.
      ld/
      	* testsuite/config/default.exp: Define SIZE and SIZEFLAGS.
      
      (cherry picked from commit cd8adbf3017272877c7e196e2e326f888f207bd9)
      e496d83b
    • Alan Modra's avatar
      Detect .eh_frame_hdr earlier for SIZEOF_HEADERS · 8fd6b8a0
      Alan Modra authored
      Current code detects the need for PT_GNU_EH_FRAME using a field set by
      _bfd_elf_discard_section_eh_frame_hdr, which is called fairly late in
      the linking process.  Use the elf hash table eh_info instead, which is
      set up earlier by size_dynamic_sections.
      
      	* elf-bfd.h (struct output_elf_obj_tdata): Delete eh_frame_hdr.
      	(elf_eh_frame_hdr): Don't define.
      	(_bfd_elf_discard_section_eh_frame_hdr): Update prototype.
      	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Delete
      	abfd parameter.  Don't set elf_eh_frame_hdr.
      	* elf.c (elf_eh_frame_hdr): New function.
      	(get_program_header_size): Adjust elf_eh_frame_hdr call.
      	(_bfd_elf_map_sections_to_segments): Likewise.
      
      (cherry picked from commit 8df52eeeb06efcccd6b840689ad8e11ebb264e7f)
      8fd6b8a0
    • Alan Modra's avatar
      PowerPC64 treatment of absolute symbols · 26995ab2
      Alan Modra authored
      Supporting -static-pie on PowerPC64 requires the linker to properly
      treat SHN_ABS symbols for cases like glibc's _nl_current_LC_CTYPE_used
      absolute symbol.  I've been slow to fix the linker on powerpc because
      there is some chance that this will break some shared libraries or
      PIEs.
      
      bfd/
      	* elf64-ppc.c (ppc64_elf_check_relocs): Consolidate local sym
      	handling code.  Don't count dyn relocs against non-dynamic
      	absolute symbols.
      	(dec_dynrel_count): Adjust to suit.
      	(ppc64_elf_edit_toc): Don't remove entries for absolute symbols
      	when pic.
      	(allocate_got): Don't allocate space for got relocs against
      	non-dynamic absolute syms.
      	(ppc64_elf_layout_multitoc): Likewise.
      	(got_and_plt_relr): Likewise.
      	(ppc64_elf_size_dynamic_sections): Likewise for local got.
      	(got_and_plt_relr_for_local_syms): Likewise.
      	(ppc64_elf_size_stubs): Don't allocate space for relr either.
      	(ppc64_elf_relocate_section): Don't write relocs against non-dynamic
      	absolute symbols.  Don't optimise got and toc code sequences
      	loading absolute symbol entries.
      ld/
      	* testsuite/ld-powerpc/abs-reloc.s,
      	* testsuite/ld-powerpc/abs-static.d,
      	* testsuite/ld-powerpc/abs-static.r,
      	* testsuite/ld-powerpc/abs-pie.d,
      	* testsuite/ld-powerpc/abs-pie.r,
      	* testsuite/ld-powerpc/abs-shared.d,
      	* testsuite/ld-powerpc/abs-shared.r,
      	* testsuite/ld-powerpc/abs-pie-relr.d,
      	* testsuite/ld-powerpc/abs-pie-relr.r,
      	* testsuite/ld-powerpc/abs-shared-relr.d,
      	* testsuite/ld-powerpc/abs-shared-relr.r: New tests.
      	* testsuite/ld-powerpc/powerpc.exp: Run them.
      
      (cherry picked from commit 3a3a4c1fe4ccb1914d29fbf8f5930d55aacec78f)
      26995ab2
    • Alan Modra's avatar
      PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu · d3ec1c51
      Alan Modra authored
      The assertion is this one in ppc_build_one_stub
        BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size);
      It is checking that a stub doesn't overwrite the tail of a previous
      stub, so not something trivial.
      
      Normally, stub sizing iterates until no stubs are added, detected by
      no change in stub section size.  Iteration also continues if no stubs
      are added but one or more stubs increases in size, which also can be
      detected by a change in stub section size.  But there is a
      pathological case where stub section sizing decreases one iteration
      then increases the next.  To handle that situation, stub sizing also
      stops at more than STUB_SHRINK_ITER (20) iterations when calculated
      stub section size is smaller.  The previous larger size is kept for
      the actual layout (so that building the stubs, which behaves like
      another iteration of stub sizing, will see the stub section sizes
      shrink).  The problem with that stopping condition is that it assumes
      that stub sizing is only affected by addresses external to the stub
      sections, which isn't always true.
      
      This patch fixes that by also keeping larger individual stub_offset
      addresses past STUB_SHRINK_ITER.  It also catches a further
      pathological case where one stub shrinks and another expands in such a
      way that no stub section size change is seen.
      
      	PR 28827
      	* elf64-ppc.c (struct ppc_link_hash_table): Add stub_changed.
      	(STUB_SHRINK_ITER): Move earlier in file.
      	(ppc_size_one_stub): Detect any change in stub_offset.  Keep
      	larger one if past STUB_SHRINK_ITER.
      	(ppc64_elf_size_stubs): Iterate on stub_changed too.
      
      (cherry picked from commit 0441f94fba61998b4bd18487aacf70a672df099c)
      
      Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
      
      The previous patch wasn't quite correct.  The size and padding depends
      on offset used in the current iteration, and if we're fudging the
      offset past STUB_SHRINK_ITER then we'd better use that offset.  We
      can't have plt_stub_pad using stub_sec->size as the offset.
      
      	PR 28827
      	* elf64-ppc.c (plt_stub_pad): Add stub_off param.
      	(ppc_size_one_stub): Set up stub_offset to value used in this
      	iteration before sizing the stub.  Adjust plt_stub_pad calls.
      
      (cherry picked from commit 2405fc4016feadea33cb747d5654514f62b74ff4)
      
      Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
      
      In trying to find a testcase for PR28827, I managed to hit a linker
      error in bfd_set_section_contents with a .branch_lt input section
      being too large for the output .branch_lt.
      
      bfd/
      	PR 28827
      	* elf64-ppc.c (ppc64_elf_size_stubs): Set section size to
      	maxsize past STUB_SHRINK_ITER before laying out.  Remove now
      	unnecessary conditional setting of maxsize at start of loop.
      ld/
      	* testsuite/ld-powerpc/pr28827-2.d,
      	* testsuite/ld-powerpc/pr28827-2.lnk,
      	* testsuite/ld-powerpc/pr28827-2.s: New test.
      	* testsuite/ld-powerpc/powerpc.exp: Run it.
      
      (cherry picked from commit 9ff8aa7d418bc508dbd429576b93e30ed9dc5891)
      d3ec1c51
    • Alan Modra's avatar
      Update PowerPC64 symtocbase test · 9097ec6c
      Alan Modra authored
      Using a symbol other than .TOC. with @tocbase is an extension to the
      ABI.  It is never valid to use a symbol without a definition in the
      binary, and symbols on these expressions cannot be overridden.  Make
      this explicit by using ".hidden" in the testcase.
      
      	* testsuite/ld-powerpc/symtocbase-1.s: Align data.  Make function
      	entry symbol hidden.
      	* testsuite/ld-powerpc/symtocbase-2.s: Likewise.
      	* testsuite/ld-powerpc/symtocbase.d: Adjust expected output.
      
      (cherry picked from commit ef5684c2bdf4d4f9975650e3b7b8f9b0ff98abee)
      9097ec6c
    • Alan Modra's avatar
      objcopy --only-keep-debug · 68f54315
      Alan Modra authored
      From: Peilin Ye <peilin.ye@bytedance.com>
      objcopy's --only-keep-debug option has been broken for ELF files since
      commit 8c803a2d.
      
        1. binutils/objcopy.c:setup_section() marks non-debug sections as
           SHT_NOBITS, then calls bfd_copy_private_section_data();
        2. If ISEC and OSEC share the same section flags,
           bfd/elf.c:_bfd_elf_init_private_section_data() restores OSEC's
           section type back to ISEC's section type, effectively undoing
           "make_nobits".
      
      	* objcopy.c (setup_section): Act on make_nobits after calling
      	bfd_copy_private_section_data.
      
      (cherry picked from commit 7c4643efe7befea8e5063e8b56c0400fd8cee2d5)
      68f54315
    • Alan Modra's avatar
      PR28826 x86_64 ld segfaults building xen · 61ecfbda
      Alan Modra authored
      Fallout from commit e86fc4a5
      
      	PR 28826
      	* coffgen.c (coff_write_alien_symbol): Init dummy to zeros.
      
      (cherry picked from commit 07c9f243b3a12cc6749bc02ee7b165859979348b)
      61ecfbda
    • Alan Modra's avatar
      PR28753, buffer overflow in read_section_stabs_debugging_info · cad4d6b9
      Alan Modra authored
      	PR 28753
      	* rddbg.c (read_section_stabs_debugging_info): Don't read past
      	end of section when concatentating stab strings.
      
      (cherry picked from commit 085b299b71721e15f5c5c5344dc3e4e4536dadba)
      cad4d6b9
    • GDB Administrator's avatar
      Automatic date update in version.in · 96aa81f8
      GDB Administrator authored
      96aa81f8
  6. Feb 04, 2022
  7. Feb 03, 2022
  8. Feb 02, 2022
  9. Feb 01, 2022
  10. Jan 31, 2022
  11. Jan 30, 2022
  12. Jan 29, 2022
  13. Jan 28, 2022
  14. Jan 27, 2022
  15. Jan 26, 2022
    • H.J. Lu's avatar
      ld: Rewrite lang_size_relro_segment_1 · 8b7c6a1f
      H.J. Lu authored
      1. Compute the desired PT_GNU_RELRO segment base and find the maximum
      section alignment of sections starting from the PT_GNU_RELRO segment.
      2. Find the first preceding load section.
      3. Don't add the 1-page gap between the first preceding load section and
      the relro segment if the maximum page size >= the maximum section
      alignment.  Align the PT_GNU_RELRO segment first.  Subtract the maximum
      page size if therer is still a 1-page gap.
      
      	PR ld/28743
      	PR ld/28819
      	* ldlang.c (lang_size_relro_segment_1): Rewrite.
      	* testsuite/ld-x86-64/pr28743-1.d: New file.
      	* testsuite/ld-x86-64/pr28743-1.s: Likewise.
      	* testsuite/ld-x86-64/x86-64.exp: Run pr28743-1.
      
      (cherry picked from commit c804c6f98d342c3d46f73d7a7ec6229d5ab1c9f3)
      8b7c6a1f
    • GDB Administrator's avatar
      Automatic date update in version.in · 34fd2744
      GDB Administrator authored
      34fd2744
    • Klaus Ziegler's avatar
      Fix problem building binutils on SPARC/amd64 · b60d9d90
      Klaus Ziegler authored
      	PR 28816
      	* elf/common.h (AT_SUN_HWCAP): Make definition conditional.
      b60d9d90
  16. Jan 25, 2022