1. Mar 11, 2021
    • Kuan-Lin Chen's avatar
      9e61e0b4
    • Nick Clifton's avatar
      Fix compile time warnings when building riscv assembler. · ead75040
      Nick Clifton authored
      	* config/tc-riscv.c (riscv_ip): Fix compile time warnings about
      	misleading indentation.
      ead75040
    • Nelson Chu's avatar
      RISC-V: PR27158, fixed UJ/SB types and added CSS/CL/CS types for .insn. · 98be5ceb
      Nelson Chu authored
      * Renamed obsolete UJ/SB types and RVC types, also added CSS/CL(CS) types,
      
      [VALID/EXTRACT/ENCODE macros]
      BTYPE_IMM:            Renamed from SBTYPE_IMM.
      JTYPE_IMM:            Renamed from UJTYPE_IMM.
      CITYPE_IMM:           Renamed from RVC_IMM.
      CITYPE_LUI_IMM:       Renamed from RVC_LUI_IMM.
      CITYPE_ADDI16SP_IMM:  Renamed from RVC_ADDI16SP_IMM.
      CITYPE_LWSP_IMM:      Renamed from RVC_LWSP_IMM.
      CITYPE_LDSP_IMM:      Renamed from RVC_LDSP_IMM.
      CIWTYPE_IMM:          Renamed from RVC_UIMM8.
      CIWTYPE_ADDI4SPN_IMM: Renamed from RVC_ADDI4SPN_IMM.
      CSSTYPE_IMM:          Added for .insn without special encoding.
      CSSTYPE_SWSP_IMM:     Renamed from RVC_SWSP_IMM.
      CSSTYPE_SDSP_IMM:     Renamed from RVC_SDSP_IMM.
      CLTYPE_IMM:           Added for .insn without special encoding.
      CLTYPE_LW_IMM:        Renamed from RVC_LW_IMM.
      CLTYPE_LD_IMM:        Renamed from RVC_LD_IMM.
      RVC_SIMM3:            Unused and removed.
      CBTYPE_IMM:           Renamed from RVC_B_IMM.
      CJTYPE_IMM:           Renamed from RVC_J_IMM.
      
      * Added new operands and removed the unused ones,
      
      C5: Unsigned CL(CS) immediate, added for .insn directive.
      C6: Unsigned CSS immediate, added for .insn directive.
      Ci: Unused and removed.
      C<: Unused and removed.
      
      bfd/
          PR 27158
          * elfnn-riscv.c (perform_relocation): Updated encoding macros.
          (_bfd_riscv_relax_call): Likewise.
          (_bfd_riscv_relax_lui): Likewise.
          * elfxx-riscv.c (howto_table): Likewise.
      gas/
          PR 27158
          * config/tc-riscv.c (riscv_ip): Updated encoding macros.
          (md_apply_fix): Likewise.
          (md_convert_frag_branch): Likewise.
          (validate_riscv_insn): Likewise.  Also arranged operands, including
          added C5 and C6 operands, and removed unused Ci and C< operands.
          * doc/c-riscv.texi: Updated and added CSS/CL/CS types.
          * testsuite/gas/riscv/insn.d: Added CSS/CL/CS instructions.
          * testsuite/gas/riscv/insn.s: Likewise.
      gdb/
          PR 27158
          * riscv-tdep.c (decode_ci_type_insn): Updated encoding macros.
          (decode_j_type_insn): Likewise.
          (decode_cj_type_insn): Likewise.
          (decode_b_type_insn): Likewise.
          (decode): Likewise.
      include/
          PR 27158
          * opcode/riscv.h: Updated encoding macros.
      opcodes/
          PR 27158
          * riscv-dis.c (print_insn_args): Updated encoding macros.
          * riscv-opc.c (MASK_RVC_IMM): defined to ENCODE_CITYPE_IMM.
          (match_c_addi16sp): Updated encoding macros.
          (match_c_lui): Likewise.
          (match_c_lui_with_hint): Likewise.
          (match_c_addi4spn): Likewise.
          (match_c_slli): Likewise.
          (match_slli_as_c_slli): Likewise.
          (match_c_slli64): Likewise.
          (match_srxi_as_c_srxi): Likewise.
          (riscv_insn_types): Added .insn css/cl/cs.
      98be5ceb
    • Nelson Chu's avatar
      RISC-V: Add bfd/cpu-riscv.h to support all spec versions controlling. · 4589f5ce
      Nelson Chu authored
      Make the opcode/riscv-opc.c and include/opcode/riscv.h tidy, move the
      spec versions stuff to bfd/cpu-riscv.h.  Also move the csr stuff and
      ext_version_table to gas/config/tc-riscv.c for internal use.  To avoid
      too many repeated code, define general RISCV_GET_SPEC_NAME/SPEC_CLASS
      macros.  Therefore, assembler/dis-assembler/linker/gdb can get all spec
      versions related stuff from cpu-riscv.h and cpu-riscv.c, since the stuff
      are defined there uniformly.
      
      bfd/
          * Makefile.am: Added cpu-riscv.h.
          * Makefile.in: Regenerated.
          * po/SRC-POTFILES.in: Regenerated.
          * cpu-riscv.h: Added to support spec versions controlling.
          Also added extern arrays and functions for cpu-riscv.c.
          (enum riscv_spec_class): Define all spec classes here uniformly.
          (struct riscv_spec): Added for all specs.
          (RISCV_GET_SPEC_CLASS): Added to reduce repeated code.
          (RISCV_GET_SPEC_NAME): Likewise.
          (RISCV_GET_ISA_SPEC_CLASS): Added to get ISA spec class.
          (RISCV_GET_PRIV_SPEC_CLASS): Added to get privileged spec class.
          (RISCV_GET_PRIV_SPEC_NAME): Added to get privileged spec name.
          * cpu-riscv.c (struct priv_spec_t): Replaced with struct riscv_spec.
          (riscv_get_priv_spec_class): Replaced with RISCV_GET_PRIV_SPEC_CLASS.
          (riscv_get_priv_spec_name): Replaced with RISCV_GET_PRIV_SPEC_NAME.
          (riscv_priv_specs): Moved below.
          (riscv_get_priv_spec_class_from_numbers): Likewise, updated.
          (riscv_isa_specs): Moved from include/opcode/riscv.h.
          * elfnn-riscv.c: Included cpu-riscv.h.
          (riscv_merge_attributes): Initialize in_priv_spec and out_priv_spec.
          * elfxx-riscv.c: Included cpu-riscv.h and opcode/riscv.h.
          (RISCV_UNKNOWN_VERSION): Moved from include/opcode/riscv.h.
          * elfxx-riscv.h: Removed extern functions to cpu-riscv.h.
      gas/
          * config/tc-riscv.c: Included cpu-riscv.h.
          (enum riscv_csr_clas): Moved from include/opcode/riscv.h.
          (struct riscv_csr_extra): Likewise.
          (struct riscv_ext_version): Likewise.
          (ext_version_table): Moved from opcodes/riscv-opc.c.
          (default_isa_spec): Updated type to riscv_spec_class.
          (default_priv_spec): Likewise.
          (riscv_set_default_isa_spec): Updated.
          (init_ext_version_hash): Likewise.
          (riscv_init_csr_hash): Likewise, also fixed indent.
      include/
          * opcode/riscv.h: Moved stuff and make the file tidy.
      opcodes/
          * riscv-dis.c: Included cpu-riscv.h, and removed elfxx-riscv.h.
          (default_priv_spec): Updated type to riscv_spec_class.
          (parse_riscv_dis_option): Updated.
          * riscv-opc.c: Moved stuff and make the file tidy.
      4589f5ce
    • Nelson Chu's avatar
      RISC-V: PR27200, allow the first input non-ABI binary to be linked with any one. · 72e89299
      Nelson Chu authored
      RISC-V only defines two float ABIs, soft-float and double-float, and the
      value of soft-float is 0x0.  But 0x0 usually means unknown/default setting
      for many targets, and the non-ABI binary, which is generated by "ld/objcopy
      -b binary", also has the 0x0 elf header flags, this may be confused.
      
      We probably can define a new unknown/default ABI value to make them more
      clear, but that will need more bits in the elf header flags, and also need
      to discuss in the riscv psabi spec.
      
      Training linker have a default ABI setting, and can be changed by ld
      options or configure options is another solution, like what assemblr
      usually do.  So all objects, including the binary files, will have
      explicit ABI setting.  But the binary files will no longer be linked
      with any object, users need to recompile them with the exactly ABI
      they want.  It may be inconvenience sometimes.  Besides, I think linker
      doesn't need to know the default arch/abi so far, just set them according
      to the linked objects should be enough.
      
      Therefore, without changing the riscv psabi, and keep the non-ABI binary
      can be linked with any object, we don't check the ABI flags if no code
      section in the PR24389.  Just that we find the first input non-ABI binary
      still cannot be linked with others in the PR27200.  This patch fixs the
      problem by delaying the elf_flags_init(obfd) check, since the flags of
      non-ABI object with no code cannot be copyed to output BFD, we should
      skip it, even if it is the first linked object.
      
      However, there is a strange "break" at the end of loop in the PR24389.
      The "break" cause the ld testcase "Link with zlib-gabi compressed debug
      output 1" fails for rv64gc-linux toolchain, after applying the above
      change.  The root cause is that - the "break" make linker only checks
      the "first" section of input BFD rather than the entire sections.
      I have checked that AARCH64 and ARM both have the "break" at the end
      of loop, but ARC doesn't.  I suppose we should remove the "break" like
      what ARC do, or use a pair of braces for the if statement.
      
      I have passed the elf/linux toolchain regressions, so the change should
      be fine.
      
      bfd/
          PR 27200
          * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Delay
          copying the elf flags from input BFD to output BFD, until we have
          checked if the input BFD has no code section or not.  Also fix the
          problem that we only check the first section rather than the entire
          sections for input BFD.
      72e89299
    • Nelson Chu's avatar
      RISC-V: PR27348, Remove the obsolete OP_*CUSTOM_IMM. · 1bbea208
      Nelson Chu authored
      include/
          PR 27348
          * opcode/riscv.h: Remove obsolete OP_*CUSTOM_IMM.
      1bbea208
    • Nelson Chu's avatar
      RISC-V: PR27348, Remove obsolete Xcustom support. · 082b331b
      Nelson Chu authored
      include/
          PR 27348
          * opcode/riscv-opc.h: Remove obsolete Xcustom support.
      082b331b
    • Nelson Chu's avatar
      RISC-V: Fixed the indent that caused by the previous commits accidentally. · 324dd125
      Nelson Chu authored
      bfd/
          * elfnn-riscv.c (riscv_relax_delete_bytes): Fixed the indent that
          caused by the previous commit accidentally.
      324dd125
    • Nelson Chu's avatar
      RISC-V: Indent and GNU coding standards tidy, also aligned the code. · 752f3a24
      Nelson Chu authored
      bfd/
          * elfnn-riscv.c: Indent, labels and GNU coding standards tidy,
          also aligned the code.
      gas/
          * config/tc-riscv.c: Indent and GNU coding standards tidy,
          also aligned the code.
          * config/tc-riscv.h: Likewise.
      include/
          * opcode/riscv.h: Indent and GNU coding standards tidy,
          also aligned the code.
      opcodes/
          * riscv-opc.c (riscv_gpr_names_abi): Aligned the code.
          (riscv_fpr_names_abi): Likewise.
          (riscv_opcodes): Likewise.
          (riscv_insn_types): Likewise.
      752f3a24
    • Nelson Chu's avatar
      RISC-V: Error and warning messages tidy. · 28e7e997
      Nelson Chu authored
      Error and warning messages usually starting with lower case letter,
      and without the period at the end.  Besides, add the prefixed "internel:"
      at the beginning of the messages when they are caused internally.
      Also fix indents and typos.
      
      bfd/
          * elfnn-riscv.c (riscv_merge_attributes): Fix typos of messages.
      gas/
          * config/tc-riscv.c: Error and warning messages tidy.
          * testsuite/gas/riscv/priv-reg-fail-fext.l: Updated.
          * testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
          * testsuite/gas/riscv/priv-reg-fail-read-only-02.l: Likewise.
          * testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.
          * testsuite/gas/riscv/priv-reg-fail-version-1p10.l: Likewise.
          * testsuite/gas/riscv/priv-reg-fail-version-1p11.l: Likewise.
          * testsuite/gas/riscv/priv-reg-fail-version-1p9p1.l: Likewise.
      ld/
          * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Updated.
          * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Likewise.
          * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Likewise.
          * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Likewise.
          * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Likewise.
          * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Likewise.
      opcodes/
          * riscv-dis.c (parse_riscv_dis_option): Fix typos of message.
      28e7e997
    • Nelson Chu's avatar
      RISC-V: Comments tidy and improvement. · e3b6e8aa
      Nelson Chu authored
      The GNU coding standards said the comments should be complete sentences
      and end with a period and two spaces.  But sometimes it should be more
      cleaner when the comments only include a word or codes.  Therefore, I made
      the following changes after referring to other target/generic codes,
      
      * Try to write sentences in comments, must end with a period and two spaces.
      * End with two spaces without a period for codes/instructions only.
      * End with one space without a period for a single word/variable only.
      
      Besids, also rewrite/remove some comments which are obsolete or too long,
      and fix indents for comments.
      
      bfd/
          * elfnn-riscv.c: Comments tidy and improvement.
          * elfxx-riscv.c: Likewise.
          * elfxx-riscv.h: Likewise.
      gas/
          * config/tc-riscv.c: Comments tidy and improvement.  Also update
          comment "fallthru" to "Fall through" that end with a period and
          two spaces.
      include/
          * elf/riscv.h: Comments tidy and improvement.
          * opcode/riscv-opc.h: Likewise.
          * opcode/riscv.h: Likewise.
      opcodes/
          * riscv-dis.c: Comments tidy and improvement.
          * riscv-opc.c: Likewise.
      e3b6e8aa
  2. Feb 06, 2021
  3. Feb 05, 2021
  4. Feb 04, 2021
    • H.J. Lu's avatar
      ld: Restore PR ld/15146 tests · 3592ada3
      H.J. Lu authored
      commit 7d409ac0
      Author: Alan Modra <amodra@gmail.com>
      Date:   Thu Feb 4 13:56:34 2021 +1030
      
          PR27311, (symbol from plugin): undefined reference, hidden sym
      
      fixed PR ld/15146.  Restore PR ld/15146 tests.
      
      	PR ld/15146
      	* testsuite/ld-plugin/lto.exp: Run PR ld/15146 tests.
      	* testsuite/ld-plugin/pr15146.d: Restored.
      	* testsuite/ld-plugin/pr15146a.c: Likewise.
      	* testsuite/ld-plugin/pr15146b.c: Likewise.
      	* testsuite/ld-plugin/pr15146c.c: Likewise.
      	* testsuite/ld-plugin/pr15146d.c: Likewise.
      
      (cherry picked from commit 37707bd8)
      3592ada3
    • Alan Modra's avatar
      PR27311, (symbol from plugin): undefined reference, hidden sym · b71c7a58
      Alan Modra authored
      bfd/
      	PR 27311
      	* elflink.c (elf_link_add_object_symbols): Don't pull in as-needed
      	libraries for IR references on pass over libraries after LTO
      	recompilation.
      ld/
      	* testsuite/ld-plugin/pr27311d.c: New test.
      	* testsuite/ld-plugin/lto.exp: Rename pr27311 to pr27311-1, compile
      	and link new test as pr27311-2.
      
      (cherry picked from commit 7d409ac0)
      b71c7a58
    • GDB Administrator's avatar
      Automatic date update in version.in · 401fafe1
      GDB Administrator authored
      401fafe1
  5. Feb 03, 2021
    • Alan Modra's avatar
      pr27270 and pr27284, ar segfaults and wrong file mode · 6184480d
      Alan Modra authored
      	PR 27270
      	PR 27284
      	PR 26945
      	* ar.c: Don't include libbfd.h.
      	(write_archive): Replace xmalloc+strcpy with xstrdup.  Use
      	bfd_stat rather than fstat on iostream.  Move stat and fd tests
      	outside of _WIN32 ifdef.  Delete skip_stat variable.
      	* arsup.c (temp_name, real_ofd): New static variables.
      	(ar_open): Use make_tempname and bfd_fdopenw.
      	(ar_save): Adjust to suit ar_open changes.  Move stat output
      	of _WIN32 ifdef.
      	* objcopy.c: Don't include libbfd.h.
      	(copy_file): Use bfd_stat.
      
      (cherry picked from commit 95b91a04)
      6184480d
    • Alan Modra's avatar
      PR27311, ld.bfd (symbol from plugin): undefined reference · d2ea9f3a
      Alan Modra authored
      A default versioned symbol definition in a shared library is
      overridden by an unversioned definition in a regular object file, and
      thus should not be reason to make an as-needed library needed.
      
      bfd/
      	PR 27311
      	* elflink.c (elf_link_add_object_symbols): Don't pull in as-needed
      	libraries when H is an indirect symbol after calling
      	_bfd_elf_add_default_symbol.
      ld/
      	* testsuite/ld-ifunc/ifunc.exp (libpr16467b.so, libpr16467bn.so):
      	Link with --as-needed.
      
      	* testsuite/ld-plugin/pr27311.d,
      	* testsuite/ld-plugin/pr27311.ver,
      	* testsuite/ld-plugin/pr27311a.c,
      	* testsuite/ld-plugin/pr27311b.c,
      	* testsuite/ld-plugin/pr27311c.c: New testcase.
      	* testsuite/ld-plugin/lto.exp: Run it.  Correct PR14918 and
      	PR12982 entries.
      
      (cherry picked from commit 9918bff7)
      (cherry picked from commit 69551367)
      (cherry picked from commit f01fb44c)
      d2ea9f3a
    • GDB Administrator's avatar
      Automatic date update in version.in · ee6dd624
      GDB Administrator authored
      ee6dd624
  6. Feb 02, 2021
  7. Feb 01, 2021
  8. Jan 31, 2021
  9. Jan 30, 2021
    • GDB Administrator's avatar
      Automatic date update in version.in · 5eae73d7
      GDB Administrator authored
      5eae73d7
    • Alan Modra's avatar
      PR27259, SHF_LINK_ORDER self-link · fe0e8331
      Alan Modra authored
      This stops ld from endless looping on SHF_LINK_ORDER sh_link loops.
      
      bfd/
      	PR 27259
      	* elflink.c (_bfd_elf_gc_mark_extra_sections): Use linker_mark to
      	prevent endless looping of linked-to sections.
      ld/
      	PR 27259
      	* ldelf.c (ldelf_before_place_orphans): Use linker_mark to
      	prevent endless looping of linked-to sections.
      
      (cherry picked from commit def97fb9)
      fe0e8331
  10. Jan 29, 2021
  11. Jan 28, 2021
  12. Jan 27, 2021
    • Nick Alcock's avatar
      ld: depend on libctf · e9013bbd
      Nick Alcock authored
      Since ld may depend on libctf (if present), and libctf may be relinked
      by the installation process, libctf must be installed before ld is,
      or the relink may fail if it calls on symbols or symbol versions that do
      not exist in any libctf already present on the system.  (If none is
      present, the copy in the build tree will be automatically used, but
      if one *is* present, it may take precedence and break things.)
      
      (This is a maybe- dependency, so it will work even if libctf is
      disabled.)
      
      ChangeLog
      2021-01-26  Nick Alcock  <nick.alcock@oracle.com>
      
      	* Makefile.def: Add install-libctf dependency to install-ld.
      	* Makefile.in: Regenerated.
      e9013bbd
    • Nick Clifton's avatar
      Update the DWARF sections recognuised by ELF linker scripts. · 185390e3
      Nick Clifton authored
              PR ld/27230
              * scripttempl/DWARF.sc: Add DWARF-5 .debug_* sections.
      185390e3
    • GDB Administrator's avatar
      Automatic date update in version.in · 0dd1ac83
      GDB Administrator authored
      0dd1ac83
    • Alan Modra's avatar
      Segmentation fault i386-gen · 510753f8
      Alan Modra authored
      A case of inst->next being uninitialised.
      
      	* i386-gen.c (parse_template): Ensure entire template_instance
      	is initialised.
      
      (cherry picked from commit c3ffb8f3)
      510753f8
    • Alan Modra's avatar
      pr27228 testcase · 8a041786
      Alan Modra authored
      This failed on ft32, hppa, and mips-irix targets.  In the case of ft32
      the problem was iterating over an array in reverse and not using the
      proper condition, so BFD_RELOC_NONE was not recognised.
      
      bfd/
      	* elf32-ft32.c (ft32_reloc_type_lookup): Don't miss ft32_reloc_map[0].
      gas/
      	PR 27282
      	* testsuite/gas/all/none.d: Replace skip with xfail, don't xfail ft32.
      	* testsuite/gas/elf/pr27228.d: xfail hppa and allow OBJECT match.
      
      (cherry picked from commit 4287950e)
      8a041786