and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

  1. 24 Jul, 2020 3 commits
  2. 23 Jul, 2020 3 commits
    • Maciej W. Rozycki's avatar
      PR ld/26288: Allow the use of `--just-symbols' with ET_EXEC input · fa3b1311
      Maciej W. Rozycki authored
      Fix a regression from commit a87e1817 ("Have the linker fail if any
      attempt to link in an executable is made.") and do not reject ET_EXEC
      input supplied with the `--just-symbols' option.  Such use is legitimate
      as the file requested is not actually linked and only the symbols are
      extracted. Furthermore it is often the most useful application, as
      already observed in our documentation for the option, where it allows
      "to refer symbolically to absolute locations of memory defined in other
      programs."
      
      Provide a set of tests for the use of ET_EXEC with `--just-symbols'.
      These are excluded however for SH/PE targets because they complain if a
      section's VMA is 0:
      
      ld: zero vma section reloc detected: `.text' #0 f=32795
      ld: zero vma section reloc detected: `.data' #1 f=291
      
      and for x86_64/PE targets because they seem to hardwire the VMA:
      
       100000000 12000000 01000000 00000000 00000000  ................
      
      	ld/
      	PR ld/26288
      	* ldelf.c (ldelf_after_open): Do not reject ET_EXEC input
      	supplied with `--just-symbols'.
      	* testsuite/ld-misc/just-symbols.exp: New test script.
      	* testsuite/ld-misc/just-symbols-1.dd: New test dump.
      	* testsuite/ld-misc/just-symbols.ld: New test linker script.
      	* testsuite/ld-misc/just-symbols-0.s: New test source.
      	* testsuite/ld-misc/just-symbols-1.s: New test source.
      
      (cherry picked from commit 97c79e21)
      fa3b1311
    • Maciej W. Rozycki's avatar
      PR ld/26288: Revert obsolete part of PR ld/26047 fix · 9b616552
      Maciej W. Rozycki authored
      Revert commit a3fc9418 ("Stop the linker from accepting executable
      ELF files as inputs to other links."), which has been made obsolete by
      commit a87e1817 ("Have the linker fail if any attempt to link in an
      executable is made.").  An earlier check triggers added with the latter
      commit making the piece of code removed dead.
      
      	ld/
      	PR ld/26288
      
      	Revert:
      	PR 26047
      	* ldelf.c (ldelf_after_open): Fail if attempting to link one
      	executable into another.
      
      (cherry picked from commit b5dd7120)
      9b616552
    • GDB Administrator's avatar
      Automatic date update in version.in · 60955197
      GDB Administrator authored
      60955197
  3. 22 Jul, 2020 2 commits
    • H.J. Lu's avatar
      ld: Properly override the IR definition · 041d1c2d
      H.J. Lu authored
      We change the previous definition in the IR object to undefweak only
      after all LTO symbols have been read.
      
      include/
      
      	PR ld/26262
      	PR ld/26267
      	* bfdlink.h (bfd_link_info): Add lto_all_symbols_read.
      
      ld/
      
      	PR ld/26262
      	PR ld/26267
      	* ldlang.c (lang_process): Set lto_all_symbols_read after all
      	LTO IR symbols have been read.
      	* plugin.c (plugin_notice): Override the IR definition only if
      	all LTO IR symbols have been read or the new definition is
      	non-weak and the the IR definition is weak
      	* testsuite/ld-plugin/lto.exp: Run PR ld/26262 and ld/26267
      	tests.
      	* testsuite/ld-plugin/pr26262a.c: New file.
      	* testsuite/ld-plugin/pr26262b.c: Likewise.
      	* testsuite/ld-plugin/pr26262c.c: Likewise.
      	* testsuite/ld-plugin/pr26267.err: Likewise.
      	* testsuite/ld-plugin/pr26267a.c: Likewise.
      	* testsuite/ld-plugin/pr26267b.c: Likewise.
      	* testsuite/ld-plugin/pr26267c.c: Likewise.
      
      (cherry picked from commit 0e6a3f07)
      041d1c2d
    • GDB Administrator's avatar
      Automatic date update in version.in · 544fb889
      GDB Administrator authored
      544fb889
  4. 21 Jul, 2020 1 commit
  5. 20 Jul, 2020 3 commits
  6. 19 Jul, 2020 3 commits
    • H.J. Lu's avatar
      x86: Change PLT32 reloc against section to PC32 · 52da8d36
      H.J. Lu authored
      Commit 292676c1 resolved PLT32 reloc aganst local symbol to section.
      Since PLT32 relocation must be against symbols, turn such PLT32
      relocation into PC32 relocation.
      
      gas/
      
      	PR gas/26263
      	* config/tc-i386.c (i386_validate_fix): Change PLT32 reloc
      	against section to PC32 reloc.
      	* testsuite/gas/i386/relax-5.d: Updated.
      	* testsuite/gas/i386/x86-64-relax-4.d: Likewise.
      
      ld/
      
      	PR gas/26263
      	* testsuite/ld-i386/i386.exp: Run PR gas/26263 test.
      	* testsuite/ld-x86-64/x86-64.exp: Likewise.
      	* testsuite/ld-i386/pr26263.d: New file.
      	* testsuite/ld-x86-64/pr26263.d: Likewise.
      	* testsuite/ld-x86-64/pr26263.s: Likewise.
      
      (cherry picked from commit 2585b7a5)
      52da8d36
    • Alan Modra's avatar
      Power10 stub selection · d349c8e2
      Alan Modra authored
      This patch better supports mixing of power10 and non-power10 code,
      as might be seen in a cpu-optimized library using ifuncs to select
      functions optimized for a given cpu.  Using -Wl,--no-power10-stubs
      isn't that good in this situation since non-power10 notoc stubs are
      slower and larger than the power10 variants, which you'd like to use
      on power10 code paths.
      
      With this change, power10 pc-relative code that makes calls marked
      @notoc uses power10 stubs if stubs are necessary, and other calls use
      non-power10 instructions in stubs.  This will mean that if gcc is
      generating code for -mcpu=power10 but with pc-rel disabled then you'll
      get the older stubs even on power10 (unless you force with
      -Wl,--power10-stubs).  That shouldn't be too big a problem: stubs that
      use r2 are reasonable.  It's just the ones that set up addressing
      using "mflr 12; bcl 20,31,.+4; mflr 11; mtlr 12" that should be
      avoided if possible.
      
      bfd/
      	* elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs.
      	(select_alt_stub): New function.
      	(ppc_get_stub_entry): Use it here.
      	(ppc64_elf_check_relocs): Set had_power10_relocs rather than
      	power10_stubs.
      	(ppc64_elf_size_stubs): Clear power10_stubs here instead.  Don't
      	merge notoc stubs with other varieties when power10_stubs is "auto".
      	Instead dup the stub hash table entry.
      	(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
      	tests of power10_stubs.
      ld/
      	* emultempl/ppc64elf.em (power10-stubs): Accept optional "auto" arg.
      	* ld.texi (power10-stubs): Update.
      	* testsuite/ld-powerpc/callstub-1.d: Force --power10-stubs.
      	* testsuite/ld-powerpc/callstub-2.d: Relax branch offset comparison.
      	* testsuite/ld-powerpc/callstub-4.d: New test.
      	* testsuite/ld-powerpc/notoc.d: Force --no-power10-stubs.
      	* testsuite/ld-powerpc/notoc3.d,
      	* testsuite/ld-powerpc/notoc3.s,
      	* testsuite/ld-powerpc/notoc3.wf: New test.
      	* testsuite/ld-powerpc/powerpc.exp: Run new tests.  Pass
      	--no-power10-stubs for notoc link.
      
      (cherry picked from commit e10a07b3)
      d349c8e2
    • GDB Administrator's avatar
      Automatic date update in version.in · c6e3e5b2
      GDB Administrator authored
      c6e3e5b2
  7. 18 Jul, 2020 1 commit
  8. 17 Jul, 2020 1 commit
  9. 16 Jul, 2020 1 commit
  10. 15 Jul, 2020 7 commits
    • Hans-Peter Nilsson's avatar
      mmix bfd: fix bfd_assert for R_MMIX_PUSHJ_STUBBABLE against undef'd symbol · 131af83d
      Hans-Peter Nilsson authored
      Spotted when inspecting gcc testsuite logs, but this already is
      covered by the ld-mmix testsuite, it's just that the assert is ignored
      since the regexp match is for a substring and not anchored.
      
      With the anchors added but not the bugfix, the ld.log shows that the
      asserts cause a non-match as intended:
      
      Executing on host: sh -c {./ld-new   -LX/src/ld/testsuite/ld-mmix  -m elf64mmix -o tmpdir/dump tmpdir/undef-2.o tmpdir/start.o  2>&1}  /dev/null dump.tmp (timeout = 300)
      ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
      ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
      ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
      ./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'
      failed with: <./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
      ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
      ./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
      ./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'>, expected: <\A[^\n\r]*undefined reference to `undefd'\Z>
      FAIL: ld-mmix/undef-2
      
      Gone with the fix of course, leaving just the intended "undefined
      reference" line.
      
      I'm not going to add anchors manually for all the "error:" strings in
      the test-suite, not even in the mmix parts.  Sorry, but I'll just do
      it for *these* specific undefined-reference tests.
      
      Just a thought: maybe the run_dump_test "error:" string should
      *automatically* get anchor marks prepended and appended for a single
      line match as in the patch, "\A[^\n\r]*" prepended and \Z appended
      unless either anchor mark or \r or \n is present in the regexp?
      
      Committed.
      
      bfd:
      	* elf64-mmix.c (mmix_elf_relax_section): Improve accounting for
      	R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols.
      
      ld/testsuite:
      	* testsuite/ld-mmix/undef-1.d, testsuite/ld-mmix/undef-1m.d,
      	testsuite/ld-mmix/undef-2.d, testsuite/ld-mmix/undef-2m.d: Add
      	start- and end-anchors to error-string to match just a
      	single-line error-message.
      
      (cherry picked from commit a8a48c75)
      131af83d
    • H.J. Lu's avatar
      x86: Don't display eiz with no scale · ae310391
      H.J. Lu authored
      Change
      
      67 48 8b 1c 25 ef cd ab 89 	mov    0x89abcdef(,%eiz,1),%rbx
      
      to
      
      67 48 8b 1c 25 ef cd ab 89 	mov    0x89abcdef,%rbx
      
      in AT&T syntax and
      
      67 48 8b 1c 25 ef cd ab 89 	mov    rbx,QWORD PTR [eiz*1+0x89abcdef]
      
      to
      
      67 48 8b 1c 25 ef cd ab 89 	mov    rbx,QWORD PTR ds:0x89abcdef
      
      in Intel syntax.
      
      gas/
      
      	PR gas/26237
      	* testsuite/gas/i386/evex-no-scale-64.d: Updated.
      	* testsuite/gas/i386/addr32.d: Likewise.
      	* testsuite/gas/i386/x86-64-addr32-intel.d: Likewise.
      	* testsuite/gas/i386/x86-64-addr32.d: Likewise.
      
      opcodes/
      
      	PR gas/26237
      	* i386-dis.c (OP_E_memory): Don't display eiz with no scale
      	without base nor index registers.
      
      (cherry picked from commit 04c662e2)
      ae310391
    • H.J. Lu's avatar
      x86-64: Zero-extend lower 32 bits displacement to 64 bits · b3239a5e
      H.J. Lu authored
      Since the addr32 (0x67) prefix zero-extends the lower 32 bits address to
      64 bits, change disassembler to zero-extend the lower 32 bits displacement
      to 64 bits when there is no base nor index registers.
      
      gas/
      
      	PR gas/26237
      	* testsuite/gas/i386/addr32.s: Add tests for 32-bit wrapped around
      	address.
      	* testsuite/gas/i386/x86-64-addr32.s: Likewise.
      	* testsuite/gas/i386/addr32.d: Updated.
      	* testsuite/gas/i386/x86-64-addr32-intel.d: Likewise.
      	* testsuite/gas/i386/x86-64-addr32.d: Likewise.
      	* testsuite/gas/i386/ilp32/x86-64-addr32-intel.d: Likewise.
      	* testsuite/gas/i386/ilp32/x86-64-addr32.d: Likewise.
      
      opcodes/
      
      	PR gas/26237
      	* i386-dis.c (OP_E_memory): Without base nor index registers,
      	32-bit displacement to 64 bits.
      
      (cherry picked from commit 8e58ef80)
      b3239a5e
    • H.J. Lu's avatar
      x86: Remove 32-bit sign extension in offset_in_range · ed0e8aec
      H.J. Lu authored
      When encoding a 32-bit offset, there is no need to sign-extend it to 64
      bits since only the lower 32 bits are used.
      
      	PR gas/26237
      	* config/tc-i386.c (offset_in_range): Remove 32-bit sign
      	extension.
      
      (cherry picked from commit 7a705315)
      ed0e8aec
    • Nick Clifton's avatar
      Fix the generation of REL relocs for missing build notes. · 2952e927
      Nick Clifton authored
      	* write.c (create_note_reloc): Add desc2_size parameter.  Zero out
      	the addend field of REL relocations.  Store the full addend into
      	the note for REL relocations.
      2952e927
    • Nick Clifton's avatar
      Fix an illegal memory access in the BFD library which can be triggered by an... · 78fede70
      Nick Clifton authored
      Fix an illegal memory access in the BFD library which can be triggered by an attempt to parse a corrupt PE format file.
      
      	PR26240
      	* coffgen.c (coff_get_normalized_symtab): Fix off-by-one error in
      	check for aux entries that overflow the buufer.
      78fede70
    • GDB Administrator's avatar
      Automatic date update in version.in · d804c486
      GDB Administrator authored
      d804c486
  11. 14 Jul, 2020 1 commit
  12. 13 Jul, 2020 5 commits
    • Alan Modra's avatar
      powerpc garbage collect test · d6fdc51f
      Alan Modra authored
      ld's garbage collection test on powerpc64 catered for old compilers
      (pre -mcmodel=medium support), setting options that caused the test to
      fail.  Which meant the test wasn't really testing anything.  Get rid
      of that old compiler support, and avoid -fPIE fails on ppc32.
      
      	* testsuite/ld-gc/gc.exp: Don't set -mminimal-toc for powerpc64,
      	and remove powerpc64 xfail.  Use -fno-PIE for ppc32.
      
      (cherry picked from commit c560184e)
      d6fdc51f
    • Alan Modra's avatar
      pr18841 tests on powerpc64 · 3d186ccc
      Alan Modra authored
      The PR18841 test does cross-module calls from within an ifunc
      resolver, which is nasty, and not supported in general since the
      called function may not be relocated.  In this case the called
      function (zoo) is just a stub so doesn't need relocating, but on ppc64
      the function descriptor for zoo in the executable won't be relocated
      at the time the shared library ifunc resolver runs.  That means the
      test will fail if your compiler generates PIEs by default.
      
      	PR 18841
      	* testsuite/ld-ifunc/ifunc.exp: Run pr18841 tests non-pie.
      
      (cherry picked from commit 470cd0fa)
      3d186ccc
    • Nick Clifton's avatar
    • Nick Clifton's avatar
      Change fatal errors about linking in executable files to simple warnings. · baebeaa3
      Nick Clifton authored
      	* ldelf.c (ldelf_after_open): Change fatal errors about linking in
      	executable files to simple warnings.
      baebeaa3
    • GDB Administrator's avatar
      Automatic date update in version.in · d50b9573
      GDB Administrator authored
      d50b9573
  13. 12 Jul, 2020 1 commit
  14. 11 Jul, 2020 1 commit
  15. 10 Jul, 2020 3 commits
    • Alan Modra's avatar
      Document powerpc64 ld options · ae9defaa
      Alan Modra authored
      	* ld.texi (PowerPC64 ELF64): Document --no-inline-optimize,
      	--power10-stubs and --no-power10-stubs.
      
      (cherry picked from commit d882c988)
      ae9defaa
    • Alan Modra's avatar
      PowerPC64 ld --no-power10-stubs · 8c1ec83f
      Alan Modra authored
      Needed for libraries that use ifuncs or other means to support
      cpu-optimized versions of functions, some power10, some not, and those
      functions make calls using linkage stubs.
      
      bfd/
      	* elf64-ppc.h (struct ppc64_elf_params): Add power10_stubs.
      	* elf64-ppc.c (struct ppc_link_hash_table): Delete
      	power10_stubs.
      	(ppc64_elf_check_relocs): Adjust setting of power10_stubs.
      	(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
      	uses of power10_stubs.
      ld/
      	* emultempl/ppc64elf.em (params): Init new field.
      	(enum ppc64_opt): Add OPTION_POWER10_STUBS and OPTION_NO_POWER10_STUBS.
      	(PARSE_AND_LIST_LONGOPTS): Support --power10-stubs and
      	--no-power10-stubs.
      	(PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Likewise.
      	* testsuite/ld-powerpc/callstub-3.d: New test.
      	* testsuite/ld-powerpc/powerpc.exp: Run it.
      
      (cherry picked from commit d3b10ee7)
      8c1ec83f
    • GDB Administrator's avatar
      Automatic date update in version.in · b8c0584c
      GDB Administrator authored
      b8c0584c
  16. 09 Jul, 2020 3 commits
  17. 08 Jul, 2020 1 commit