Skip to content
Snippets Groups Projects
  1. Mar 07, 2023
    • Simon Marchi's avatar
      gdbsupport: ignore -Wenum-constexpr-conversion in enum-flags.h · ae61525f
      Simon Marchi authored
      When building with clang 16, we get:
      
            CXX    gdb.o
          In file included from /home/smarchi/src/binutils-gdb/gdb/gdb.c:19:
          In file included from /home/smarchi/src/binutils-gdb/gdb/defs.h:65:
          /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
              integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                             ^
      
      The error message does not make it clear in the context of which enum
      flag this fails (i.e. what is T in this context), but it doesn't really
      matter, we have similar warning/errors for many of them, if we let the
      build go through.
      
      clang is right that the value -1 is invalid for the enum type we cast -1
      to.  However, we do need this expression in order to select an integer
      type with the appropriate signedness.  That is, with the same signedness
      as the underlying type of the enum.
      
      I first wondered if that was really needed, if we couldn't use
      std::underlying_type for that.  It turns out that the comment just above
      says:
      
          /* Note that std::underlying_type<enum_type> is not what we want here,
             since that returns unsigned int even when the enum decays to signed
             int.  */
      
      I was surprised, because std::is_signed<std::underlying_type<enum_type>>
      returns the right thing.  So I tried replacing all this with
      std::underlying_type, see if that would work.  Doing so causes some
      build failures in unittests/enum-flags-selftests.c:
      
            CXX    unittests/enum-flags-selftests.o
          /home/smarchi/src/binutils-gdb/gdb/unittests/enum-flags-selftests.c:254:1: error: static assertion failed due to requirement 'gdb::is_same<selftests::enum_flags_tests::check_valid_expr254::archetype<enum_flags<s
          elftests::enum_flags_tests::RE>, selftests::enum_flags_tests::RE, enum_flags<selftests::enum_flags_tests::RE2>, selftests::enum_flags_tests::RE2, enum_flags<selftests::enum_flags_tests::URE>, selftests::enum_fla
          gs_tests::URE, int>, selftests::enum_flags_tests::check_valid_expr254::archetype<enum_flags<selftests::enum_flags_tests::RE>, selftests::enum_flags_tests::RE, enum_flags<selftests::enum_flags_tests::RE2>, selfte
          sts::enum_flags_tests::RE2, enum_flags<selftests::enum_flags_tests::URE>, selftests::enum_flags_tests::URE, unsigned int>>::value == true':
          CHECK_VALID (true,  int,  true ? EF () : EF2 ())
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          /home/smarchi/src/binutils-gdb/gdb/unittests/enum-flags-selftests.c:91:3: note: expanded from macro 'CHECK_VALID'
            CHECK_VALID_EXPR_6 (EF, RE, EF2, RE2, UEF, URE, VALID, EXPR_TYPE, EXPR)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/valid-expr.h:105:3: note: expanded from macro 'CHECK_VALID_EXPR_6'
            CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2,           \
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/valid-expr.h:66:3: note: expanded from macro 'CHECK_VALID_EXPR_INT'
            static_assert (gdb::is_detected_exact<archetype<TYPES, EXPR_TYPE>,    \
            ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      This is a bit hard to decode, but basically enumerations have the
      following funny property that they decay into a signed int, even if
      their implicit underlying type is unsigned.  This code:
      
          enum A {};
          enum B {};
      
          int main() {
            std::cout << std::is_signed<std::underlying_type<A>::type>::value
                      << std::endl;
            std::cout << std::is_signed<std::underlying_type<B>::type>::value
                      << std::endl;
            auto result = true ? A() : B();
            std::cout << std::is_signed<decltype(result)>::value << std::endl;
          }
      
      produces:
      
          0
          0
          1
      
      So, the "CHECK_VALID" above checks that this property works for enum flags the
      same way as it would if you were using their underlying enum types.  And
      somehow, changing integer_for_size to use std::underlying_type breaks that.
      
      Since the current code does what we want, and I don't see any way of doing it
      differently, ignore -Wenum-constexpr-conversion around it.
      
      Change-Id: Ibc82ae7bbdb812102ae3f1dd099fc859dc6f3cc2
      ae61525f
  2. Feb 16, 2023
    • Alan Modra's avatar
      Delete PROGRESS macros · 7ed4ad59
      Alan Modra authored
      I don't see much point in cluttering the source with the PROGRESS
      macros, which of course do nothing at all with the definitions in
      progress.h.  progress.h is unchanged apart from the copyright comment
      since commit d4d4c53c in 1994.
      
      binutils/
      	* ar.c: Don't include progress.h, or invoke PROGRESS macros.
      	* nm.c: Likewise.
      	* objcopy.c: Likewise.
      	* objdump.c: Likewise.
      gas/
      	* as.h: Don't include progress.h.
      	* as.c: Don't invoke PROGRESS macros.
      	* write.c: Likewise.
      include/
      	* progress.h: Delete.
      ld/
      	* ldmain.c: Don't include progress.h, or invoke PROGRESS macros.
      7ed4ad59
  3. Feb 06, 2023
    • Alan Modra's avatar
      ppc32 and "LOAD segment with RWX permissions" · 84789002
      Alan Modra authored
      When using a bss-plt we'll always trigger the RWX warning, which
      disturbs gcc test results.  On the other hand, there may be reason to
      want the warning when gcc is configured with --enable-secureplt.
      So turning off the warning entirely for powerpc might not be the best
      solution.  Instead, we'll turn off the warning whenever a bss-plt is
      generated, unless the user explicitly asked for the warning.
      
      bfd/
      	* elf32-ppc.c (ppc_elf_select_plt_layout): Set
      	no_warn_rwx_segments on generating a bss plt, unless explicity
      	enabled by the user.  Also show the bss-plt warning when
      	--warn-rwx-segments is given without --bss-plt.
      include/
      	* bfdlink.h (struct bfd_link_info): Add user_warn_rwx_segments.
      ld/
      	* lexsup.c (parse_args): Set user_warn_rwx_segments.
      	* testsuite/ld-elf/elf.exp: Pass --secure-plt for powerpc to
      	the rwx tests.
      84789002
  4. Feb 03, 2023
    • Guillermo E. Martinez's avatar
      bpf: fix error conversion from long unsigned int to unsigned int [-Werror=overflow] · 7f6ebecd
      Guillermo E. Martinez authored
      Regenerating BPF target using the maintainer mode emits:
      .../opcodes/bpf-opc.c:57:11: error: conversion from ‘long unsigned int’ to ‘unsigned int’ changes value from ‘18446744073709486335’ to ‘4294902015’ [-Werror=overflow]
        57 |   64, 64, 0xffffffffffff00ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
      
      The use of a narrow size to handle the mask CGEN in instruction format
      is causing this error.  Additionally eBPF `call' instructions
      constructed by expressions using symbols (BPF_PSEUDO_CALL) emits
      annotations in `src' field of the instruction, used to identify BPF
      target endianness.
      
      cpu/
      	* bpf.cpu (define-call-insn): Remove `src' field from
      	instruction mask.
      
      include/
      	*opcode/cge.h (CGEN_IFMT): Adjust mask bit width.
      
      opcodes/
      	* bpf-opc.c: Regenerate.
      7f6ebecd
  5. Feb 02, 2023
  6. Jan 19, 2023
    • Mike Frysinger's avatar
      sim: info: convert verbose field to a bool · cc67f780
      Mike Frysinger authored
      The verbose argument has always been an int treated as a bool, so
      convert it to an explicit bool.  Further, update the API docs to
      match the reality that the verbose value is actually used by some
      of the internal modules.
      cc67f780
  7. Jan 12, 2023
    • Nick Alcock's avatar
      ctf: fix various dreadful typos in the ctf_archive format comments · 5e8b4bbc
      Nick Alcock authored
      When defining a format it helps to a) get the endianness right when you
      explicitly state what it is and b) define things in terms of fields that
      exist rather than fields that don't.
      
      (A bunch of changes of names during implementation were not reflected in
      these comments...)
      
      Thanks to Jose "Eye of the Eagle" Marchesi for spotting these.
      
      include/
      	* ctf.h (struct ctf_archive) [ctfa_ctfs]: The size element of
      	this is in little-endian byte order, not network byte order.
      	(struct ctf_archive_modent): This is positioned right after the
      	end fo the struct ctf_archive, not at the offset of a
      	nonexistent field.  The number of elements in the array depends
      	on ctfa_ndicts, not another nonexistent field.
      5e8b4bbc
  8. Jan 11, 2023
    • Mark Harmstone's avatar
      Fix size of external_reloc for pe-aarch64 · 5093b5a5
      Mark Harmstone authored
      This patch series finishes off the work by Jedidiah Thompson, and adds
      support for creating aarch64 PE images.
      
      This should be essentially complete: I've used this to create a "hello
      world" Windows program in asm, and (with GCC patches) a UEFI program in
      C. I think the only things missing are the .secidx relocation, which is
      needed for PDBs, and the SEH pseudos used for C++ exceptions.
      
      This first patch fixes the size of RELSZ; I'm not sure why it was 14 in
      the first place. This is the size of the "Base Relocation Block" in
      https://learn.microsoft.com/en-us/windows/win32/debug/pe-format, and
      AFAIK should be 10 for everything.
      5093b5a5
  9. Jan 06, 2023
    • Indu Bhagat's avatar
      sframe: fix the defined SFRAME_FRE_TYPE_*_LIMIT constants · 725a19bf
      Indu Bhagat authored
      An earlier commit 3f107464 defined the SFRAME_FRE_TYPE_*_LIMIT
      constants.  These constants are used (by gas and libsframe) to pick an
      SFrame FRE type based on the function size.  Those constants, however,
      were buggy, causing the generated SFrame sections to be bloated as
      SFRAME_FRE_TYPE_ADDR2/SFRAME_FRE_TYPE_ADDR4 got chosen more often than
      necessary.
      
      gas/
      	* sframe-opt.c (sframe_estimate_size_before_relax): Use
      	typecast.
      	(sframe_convert_frag): Likewise.
      
      libsframe/
      	* sframe.c (sframe_calc_fre_type): Use a more appropriate type
      	for argument.  Adjust the check for SFRAME_FRE_TYPE_ADDR4_LIMIT
      	to keep it warning-free but meaningful.
      
      include/
      	* sframe-api.h (sframe_calc_fre_type): Use a more appropriate
      	type for the argument.
      	* sframe.h (SFRAME_FRE_TYPE_ADDR1_LIMIT): Correct the constant.
      	(SFRAME_FRE_TYPE_ADDR2_LIMIT): Likewise.
      	(SFRAME_FRE_TYPE_ADDR4_LIMIT): Likewise.
      725a19bf
  10. Jan 03, 2023
  11. Jan 01, 2023
  12. Dec 31, 2022
  13. Dec 27, 2022
  14. Dec 23, 2022
  15. Dec 22, 2022
    • Indu Bhagat's avatar
      sframe.h: add support for .cfi_b_key_frame · 41eed6e1
      Indu Bhagat authored
      ARM 8.3 provides five separate keys that can be used to authenticate
      pointers. There are two key for executable (instruction) pointers. The
      enum pointer_auth_key in gas/config/tc-aarch64.h currently holds two keys:
        enum pointer_auth_key {
          AARCH64_PAUTH_KEY_A,
          AARCH64_PAUTH_KEY_B
        };
      
      Analogous to the above, in SFrame format V1, a bit is reserved in the SFrame
      FDE to indicate which key is used for signing the frame's return addresses:
        - SFRAME_AARCH64_PAUTH_KEY_A has a value of 0
        - SFRAME_AARCH64_PAUTH_KEY_B has a value of 1
      
      Note that the information in this bit will always be used along with the
      mangled_ra_p bit, the latter indicates whether the return addresses are
      mangled/contain PAC auth bits.
      
      include/ChangeLog:
      
      	* sframe.h (SFRAME_AARCH64_PAUTH_KEY_A): New definition.
      	(SFRAME_AARCH64_PAUTH_KEY_B): Likewise.
      	(SFRAME_V1_FUNC_INFO): Adjust to accommodate pauth_key.
      	(SFRAME_V1_FUNC_PAUTH_KEY): New macro.
      	(SFRAME_V1_FUNC_INFO_UPDATE_PAUTH_KEY): Likewise.
      41eed6e1
  16. Dec 21, 2022
    • Mike Frysinger's avatar
      sim: move register headers into sim/ namespace [PR sim/29869] · d026e67e
      Mike Frysinger authored
      These headers define the register numbers for each port to implement
      the sim_fetch_register & sim_store_register interfaces.  While gdb
      uses these, the APIs are part of the sim, not gdb.  Move the headers
      out of the gdb/ include namespace and into sim/ instead.
      d026e67e
  17. Dec 17, 2022
    • Indu Bhagat's avatar
      libsframe: provide new access API for mangled RA bit · 9c4b163c
      Indu Bhagat authored
      include/ChangeLog:
      
      	* sframe-api.h (sframe_fre_get_ra_mangled_p): New declaration.
      
      ChangeLog:
      
      	* libsframe/sframe.c (sframe_get_fre_ra_mangled_p): New
      	definition.
      	(sframe_fre_get_ra_mangled_p): New static function.
      9c4b163c
    • Indu Bhagat's avatar
      sframe.h: add support for .cfi_negate_ra_state · 4604c729
      Indu Bhagat authored
      Use the last remaining bit in the 'SFrame FRE info' word to store whether
      the RA is signed/unsigned with PAC authorization code: this bit is named
      as the "mangled RA" bit.  This bit is still unused for x86-64.
      
      The behaviour of the mangled-RA info bit in SFrame format closely
      follows the behaviour of DW_CFA_AARCH64_negate_ra_state in DWARF.  During
      unwinding, whenever an SFrame FRE with non-zero "mangled RA" bit is
      encountered, it means the upper bits of the return address contain Pointer
      Authentication code.  The unwinder, hence, must use appropriate means to
      restore LR correctly in such cases.
      
      include/ChangeLog:
      
      	* sframe.h (SFRAME_V1_FRE_INFO_UPDATE_MANGLED_RA_P): New macro.
      	(SFRAME_V1_FRE_MANGLED_RA_P): Likewise.
      4604c729
  18. Dec 15, 2022
    • Indu Bhagat's avatar
      libsframe asan: avoid generating misaligned loads · 8c078abd
      Indu Bhagat authored
      There are two places where unaligned loads were seen on aarch64:
        - #1. access to the SFrame FRE stack offsets in the in-memory
          representation/abstraction provided by libsframe.
        - #2. access to the SFrame FRE start address in the on-disk representation
          of the frame row entry.
      
      For #1, we can fix this by reordering the struct members of
      sframe_frame_row_entry in libsframe/sframe-api.h.
      
      For #2, we need to default to using memcpy instead, and copy out the bytes
      to a location for output.
      
      SFrame format is an unaligned on-disk format. As such, there are other blobs
      of memory in the on-disk SFrame FRE that are on not on their natural
      boundaries.  But that does not pose further problems yet, because the users
      are provided access to the on-disk SFrame FRE data via libsframe's
      sframe_frame_row_entry, the latter has its' struct members aligned on their
      respective natural boundaries (and initialized using memcpy).
      
      PR 29856 libsframe asan: load misaligned at sframe.c:516
      
      ChangeLog:
      
      	PR libsframe/29856
      	* bfd/elf64-x86-64.c: Adjust as the struct members have been
      	reordered.
      	* libsframe/sframe.c (sframe_decode_fre_start_address): Use
      	memcpy to perform 16-bit/32-bit reads.
      	* libsframe/testsuite/libsframe.encode/encode-1.c: Adjust as the
      	struct members have been reordered.
      
      include/ChangeLog:
      
      	PR libsframe/29856
      	* sframe-api.h: Reorder fre_offsets for natural alignment.
      8c078abd
  19. Dec 09, 2022
    • Indu Bhagat's avatar
      libsframe: rename API sframe_fde_func_info to sframe_fde_create_func_info · b659fb35
      Indu Bhagat authored
      The new name better reflects the purpose of the function.
      
      ChangeLog:
      
      	* bfd/elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Use new
      	name.
      	* libsframe/sframe.c (sframe_fde_create_func_info): Rename
      	sframe_fde_func_info to this.
      	* libsframe/testsuite/libsframe.encode/encode-1.c: Use new name.
      
      include/ChangeLog:
      
      	* sframe-api.h (sframe_fde_create_func_info): Rename
      	sframe_fde_func_info to this.
      b659fb35
    • Indu Bhagat's avatar
      sframe: gas: libsframe: define constants and remove magic numbers · 3f107464
      Indu Bhagat authored
      Define constants in sframe.h for the various limits associated with the
      range of offsets that can be encoded in the start address of an SFrame
      FRE. E.g., sframe_frame_row_entry_addr1 is used when start address
      offset can be encoded as 1-byte unsigned value.
      
      Update the code in gas to use these defined constants as it checks for
      these limits, and remove the usage of magic numbers.
      
      ChangeLog:
      
      	* gas/sframe-opt.c (sframe_estimate_size_before_relax):
      	(sframe_convert_frag): Do not use magic numbers.
      	* libsframe/sframe.c (sframe_calc_fre_type): Likewise.
      
      include/ChangeLog:
      
      	* sframe.h (SFRAME_FRE_TYPE_ADDR1_LIMIT): New constant.
      	(SFRAME_FRE_TYPE_ADDR2_LIMIT): Likewise.
      	(SFRAME_FRE_TYPE_ADDR4_LIMIT): Likewise.
      3f107464
    • Indu Bhagat's avatar
      sframe.h: make some macros more precise · 70cfae61
      Indu Bhagat authored
      include/ChangeLog:
      
      	* sframe.h (SFRAME_V1_FUNC_INFO): Use specific bits only.
      	(SFRAME_V1_FRE_INFO): Likewise.
      70cfae61
  20. Dec 07, 2022
    • Alan Modra's avatar
      Compression tidy and fixes · c3620d6d
      Alan Modra authored
      Tidies:
      - Move stuff from bfd-in.h and libbfd.c to compress.c
      - Delete COMPRESS_DEBUG from enum compressed_debug_section_type
      - Move compress_debug field out of link_info to ld_config.
      Fixes:
      - Correct test in bfd_convert_section_setup to use obfd flags,
        not ibfd.
      - Apply bfd_applicable_file_flags to compression bfd flags added
        by gas and ld to the output bfd.
      
      bfd/
      	* bfd-in.h (enum compressed_debug_section_type),
      	(struct compressed_type_tuple),
      	(bfd_get_compression_algorithm),
      	(bfd_get_compression_algorithm_name),
      	* libbfd.c (compressed_debug_section_names),
      	(bfd_get_compression_algorithm),
      	(bfd_get_compression_algorithm_name): Move..
      	* compress.c: ..to here, deleting COMPRESS_DEBUG from
      	enum compressed_debug_section_type.
      	(bfd_convert_section_setup): Test obfd flags not ibfd for
      	compression flags.
      	* elf.c (elf_fake_sections): Replace link_info->compress_debug
      	test with abfd->flags test.
      	* bfd-in2.h: Regenerate.
      binutils/
      	* objcopy.c (copy_file): Tidy setting of bfd compress flags.
      	Expand comment.
      gas/
      	* write.c (compress_debug): Test bfd compress flags rather than
      	flag_compress_debug.
      	(write_object_file): Apply bfd_applicable_file_flags to compress
      	debug flags added to output bfd.
      include/
      	* bfdlink.h (struct bfd_link_info): Delete compress_debug.
      ld/
      	* ld.h (ld_config_type): Add compress_debug.
      	* emultempl/elf.em: Replace references to link_info.compress_debug
      	with config.compress_debug.
      	* lexsup.c (elf_static_list_options): Likewise.
      	* ldmain.c (main): Likewise.  Apply bfd_applicable_file_flags
      	to compress debug flags added to output bfd.
      c3620d6d
  21. Nov 29, 2022
    • Max Filippov's avatar
      xtensa: allow dynamic configuration · d0a2cfbd
      Max Filippov authored
      Import include/xtensa-dynconfig.h that defines XCHAL_* macros as fields
      of a structure returned from the xtensa_get_config_v<x> function call.
      Define that structure and fill it with default parameter values
      specified in the include/xtensa-config.h.
      Define reusable function xtensa_load_config that tries to load
      configuration and return an address of an exported object from it.
      Define functions xtensa_get_config_v{1,2} that use xtensa_load_config
      to get structures xtensa_config_v{1,2}, either dynamically configured
      or the default.
      
      bfd/
      	* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Append
      	xtensa-dynconfig.c.
      	* Makefile.in: Regenerate.
      	* configure: Regenerate.
      	* configure.ac (xtensa_elf32_be_vec, xtensa_elf32_le_vec): Add
      	xtensa-dynconfig.lo to the tb.
      	* elf32-xtensa.c (xtensa-config.h): Replace #include with
      	xtensa-dynconfig.h.
      	(XSHAL_ABI, XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): Remove
      	definitions.
      	* xtensa-dynconfig.c: New file.
      	* xtensa-isa.c (xtensa-dynconfig.h): New #include.
      	(xtensa_get_modules): New function.
      	(xtensa_isa_init): Call xtensa_get_modules instead of taking
      	address of global xtensa_modules.
      
      gas/
      	* config/tc-xtensa.c (xtensa-config.h): Replace #include with
      	xtensa-dynconfig.h.
      	(XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0, XTENSA_MARCH_EARLIEST):
      	Remove definitions.
      	* config/tc-xtensa.h (xtensa-config.h): Replace #include with
      	xtensa-dynconfig.h.
      	* config/xtensa-relax.c (xtensa-config.h): Replace #include with
      	xtensa-dynconfig.h.
      	(XCHAL_HAVE_WIDE_BRANCHES): Remove definition.
      
      include/
      	* xtensa-dynconfig.h: New file.
      
      ld/
      	* emultempl/xtensaelf.em (xtensa-config.h): Replace #include
      	with xtensa-dynconfig.h.
      	(XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): Remove definitions.
      d0a2cfbd
  22. Nov 25, 2022
    • Christoph Müllner's avatar
      riscv: Add AIA extension support (Smaia, Ssaia) · ac8df5a1
      Christoph Müllner authored
      
      This commit adds the AIA extensions (Smaia and Ssaia) CSRs.
      
      bfd/ChangeLog:
      
      	* elfxx-riscv.c: Add 'smaia' and 'ssaia' to the list
      	of known standard extensions.
      
      gas/ChangeLog:
      
      	* config/tc-riscv.c (enum riscv_csr_class):
      	(riscv_csr_address): Add CSR classes for Smaia/Ssaia.
      	* testsuite/gas/riscv/csr-dw-regnums.d: Add new CSRs.
      	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
      	* testsuite/gas/riscv/csr-version-1p10.d: Likewise.
      	* testsuite/gas/riscv/csr-version-1p10.l: Likewise.
      	* testsuite/gas/riscv/csr-version-1p11.d: Likewise.
      	* testsuite/gas/riscv/csr-version-1p11.l: Likewise.
      	* testsuite/gas/riscv/csr-version-1p12.d: Likewise.
      	* testsuite/gas/riscv/csr-version-1p12.l: Likewise.
      	* testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
      	* testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
      	* testsuite/gas/riscv/csr.s: Likewise.
      
      include/ChangeLog:
      
      	* opcode/riscv-opc.h (CSR_MISELECT): New CSR macro.
      	(CSR_MIREG): Likewise.
      	(CSR_MTOPEI): Likewise.
      	(CSR_MTOPI): Likewise.
      	(CSR_MVIEN): Likewise.
      	(CSR_MVIP): Likewise.
      	(CSR_MIDELEGH): Likewise.
      	(CSR_MIEH): Likewise.
      	(CSR_MVIENH): Likewise.
      	(CSR_MVIPH): Likewise.
      	(CSR_MIPH): Likewise.
      	(CSR_SISELECT): Likewise.
      	(CSR_SIREG): Likewise.
      	(CSR_STOPEI): Likewise.
      	(CSR_STOPI): Likewise.
      	(CSR_SIEH): Likewise.
      	(CSR_SIPH): Likewise.
      	(CSR_HVIEN): Likewise.
      	(CSR_HVICTL): Likewise.
      	(CSR_HVIPRIO1): Likewise.
      	(CSR_HVIPRIO2): Likewise.
      	(CSR_VSISELECT): Likewise.
      	(CSR_VSIREG): Likewise.
      	(CSR_VSTOPEI): Likewise.
      	(CSR_VSTOPI): Likewise.
      	(CSR_HIDELEGH): Likewise.
      	(CSR_HVIENH): Likewise.
      	(CSR_HVIPH): Likewise.
      	(CSR_HVIPRIO1H): Likewise.
      	(CSR_HVIPRIO2H): Likewise.
      	(CSR_VSIEH): Likewise.
      	(CSR_VSIPH): Likewise.
      	(DECLARE_CSR): Add CSRs for Smaia and Ssaia.
      
      Changes for v3:
      - Imply ssaia for smaia
      - Imply zicsr for ssaia (and transitively smaia)
      - Move hypervisor CSRs to Ssaia+H
      - Rebase on upstream/master
      
      Changes for v2:
      - Add hypervisor and VS CSRs
      - Fix whitespace issue
      
      Signed-off-by: default avatarChristoph Müllner <christoph.muellner@vrull.eu>
      ac8df5a1
  23. Nov 19, 2022
    • Tsukasa OI's avatar
      RISC-V: Add 'Ssstateen' extension and its CSRs · 15253318
      Tsukasa OI authored
      This commit adds 'Ssstateen' extension, which is a supervisor-visible view
      of the 'Smstateen' extension.  It means, this extension implements sstateen*
      and hstateen* CSRs of the 'Smstateen' extension.
      
      Note that 'Smstateen' extension itself is unchanged but due to
      implementation simplicity, it is implemented so that 'Smstateen' implies
      'Ssstateen' (just like 'M' implies 'Zmmul').
      
      This is based on the latest version of RISC-V Profiles
      (version 0.9-draft, Frozen):
      <https://github.com/riscv/riscv-profiles/commit/226b7f643067b29abc6723fac60d5f6d3f9eb901>
      
      bfd/ChangeLog:
      
      	* elfxx-riscv.c (riscv_implicit_subsets): Update implication rules.
      	(riscv_supported_std_s_ext) Add 'Ssstateen' extension.
      
      gas/ChangeLog:
      
      	* config/tc-riscv.c (enum riscv_csr_class): Rename
      	CSR_CLASS_SMSTATEEN_AND_H{,_32} to CSR_CLASS_SSSTATEEN_...
      	Add CSR_CLASS_SSSTATEEN.
      	(riscv_csr_address): Support new/renamed CSR classes.
      	* testsuite/gas/riscv/csr.s: Add 'Ssstateen' extension to comment.
      	* testsuite/gas/riscv/csr-version-1p9p1.l: Reflect changes to
      	error messages.
      	* testsuite/gas/riscv/csr-version-1p10.l: Likewise.
      	* testsuite/gas/riscv/csr-version-1p11.l: Likewise.
      	* testsuite/gas/riscv/csr-version-1p12.l: Likewise.
      	* testsuite/gas/riscv/ssstateen-csr.s: Test for 'Ssstateen' CSRs.
      	* testsuite/gas/riscv/ssstateen-csr.d: Likewise.
      	* testsuite/gas/riscv/smstateen-csr-s.d: Test to make sure that
      	supervisor/hypervisor part of 'Smstateen' CSRs are accessible from
      	'RV32IH_Smstateen', not just from 'RV32IH_Ssstateen' that is tested
      	in ssstateen-csr.d.
      
      include/ChangeLog:
      
      	* opcode/riscv-opc.h: Update DECLARE_CSR declarations with
      	new CSR classes.
      15253318
  24. Nov 17, 2022
  25. Nov 16, 2022
    • Indu Bhagat's avatar
      readelf/objdump: support for SFrame section · 42b6953b
      Indu Bhagat authored
      This patch adds support for SFrame in readelf and objdump. The arguments
      of --sframe are optional for both readelf and objdump.
      
      include/ChangeLog:
      
      	* sframe-api.h (dump_sframe): New function declaration.
      
      ChangeLog:
      
      	* binutils/Makefile.am: Add dependency on libsframe for
      	readelf and objdump.
      	* binutils/Makefile.in: Regenerate.
      	* binutils/doc/binutils.texi: Document --sframe=[section].
      	* binutils/doc/sframe.options.texi: New file.
      	* binutils/objdump.c: Add support for SFrame format.
      	* binutils/readelf.c: Likewise.
      	* include/sframe-api.h: Add new API for dumping .sframe
      	section.
      	* libsframe/Makefile.am: Add sframe-dump.c.
      	* libsframe/Makefile.in: Regenerate.
      	* libsframe/sframe-dump.c: New file.
      42b6953b
    • Indu Bhagat's avatar
      bfd: linker: merge .sframe sections · cf0e0a0b
      Indu Bhagat authored
      The linker merges all the input .sframe sections.  When merging, the
      linker verifies that all the input .sframe sections have the same
      abi/arch.
      
      The linker uses libsframe library to perform key actions on the
      .sframe sections - decode, read, and create output data.  This
      implies buildsystem changes to make and install libsframe before
      libbfd.
      
      The linker places the output .sframe section in a new segment of its
      own: PT_GNU_SFRAME.  A new segment is not added, however, if the
      generated .sframe section is empty.
      
      When a section is discarded from the final link, the corresponding
      entries in the .sframe section for those functions are also deleted.
      
      The linker sorts the SFrame FDEs on start address by default and sets
      the SFRAME_F_FDE_SORTED flag in the .sframe section.
      
      This patch also adds support for generation of SFrame unwind
      information for the .plt* sections on x86_64.  SFrame unwind info is
      generated for IBT enabled PLT, lazy/non-lazy PLT.
      
      The existing linker option --no-ld-generated-unwind-info has been
      adapted to include the control of whether .sframe unwind information
      will be generated for the linker generated sections like PLT.
      
      Changes to the linker script have been made as necessary.
      
      ChangeLog:
      
      	* Makefile.def: Add install dependency on libsframe for libbfd.
      	* Makefile.in: Regenerated.
      	* bfd/Makefile.am: Add elf-sframe.c
      	* bfd/Makefile.in: Regenerated.
      	* bfd/bfd-in2.h (SEC_INFO_TYPE_SFRAME): Regenerated.
      	* bfd/configure: Regenerate.
      	* bfd/configure.ac: Add elf-sframe.lo.
      	* bfd/elf-bfd.h (struct sframe_func_bfdinfo): New struct.
      	(struct sframe_dec_info): Likewise.
      	(struct sframe_enc_info): Likewise.
      	(struct elf_link_hash_table): New member for encoded .sframe
      	object.
      	(struct output_elf_obj_tdata): New member.
      	(elf_sframe): New access macro.
      	(_bfd_elf_set_section_sframe): New declaration.
      	* bfd/elf.c (get_segment_type): Handle new segment
      	PT_GNU_SFRAME.
      	(bfd_section_from_phdr): Likewise.
      	(get_program_header_size): Likewise.
      	(_bfd_elf_map_sections_to_segments): Likewise.
      	* bfd/elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Add
      	contents to the .sframe sections or .plt* entries.
      	* bfd/elflink.c (elf_section_ignore_discarded_relocs): Handle
      	SEC_INFO_TYPE_SFRAME.
      	(_bfd_elf_default_action_discarded): Handle .sframe section.
      	(elf_link_input_bfd): Merge .sframe section.
      	(bfd_elf_final_link): Write the output .sframe section.
      	(bfd_elf_discard_info): Handle discarding .sframe section.
      	* bfd/elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Create
      	.sframe section for .plt and .plt.sec.
      	(_bfd_x86_elf_finish_dynamic_sections): Handle .sframe from
      	.plt* sections.
      	* bfd/elfxx-x86.h (PLT_SFRAME_FDE_START_OFFSET): New
      	definition.
      	(SFRAME_PLT0_MAX_NUM_FRES): Likewise.
      	(SFRAME_PLTN_MAX_NUM_FRES): Likewise.
      	(struct elf_x86_sframe_plt): New structure.
      	(struct elf_x86_link_hash_table): New member.
      	(struct elf_x86_init_table): New members for .sframe
      	creation.
      	* bfd/section.c: Add new definition SEC_INFO_TYPE_SFRAME.
      	* binutils/readelf.c (get_segment_type): Handle new segment
      	PT_GNU_SFRAME.
      	* ld/ld.texi: Update documentation for
      	--no-ld-generated-unwind-info.
      	* ld/scripttempl/elf.sc: Support .sframe sections.
      	* ld/Makefile.am (TESTSFRAMELIB): Use it.
      	(check-DEJAGNU): Likewise.
      	* ld/Makefile.in: Regenerated.
      	* ld/configure.ac (TESTSFRAMELIB): Set to the .so or .a like TESTBFDLIB.
      	* ld/configure: Regenerated.
      	* bfd/elf-sframe.c: New file.
      
      include/ChangeLog:
      
      	* elf/common.h (PT_GNU_SFRAME): New definition.
      	* elf/internal.h (struct elf_segment_map): Handle new segment
      	type PT_GNU_SFRAME.
      
      ld/testsuite/ChangeLog:
      
      	* ld/testsuite/ld-bootstrap/bootstrap.exp: Add SFRAMELIB.
      	* ld/testsuite/ld-aarch64/aarch64-elf.exp: Add new test
      	  sframe-simple-1.
      	* ld/testsuite/ld-aarch64/sframe-bar.s: New file.
      	* ld/testsuite/ld-aarch64/sframe-foo.s: Likewise.
      	* ld/testsuite/ld-aarch64/sframe-simple-1.d: Likewise.
      	* ld/testsuite/ld-sframe/sframe-empty.d: New test.
      	* ld/testsuite/ld-sframe/sframe-empty.s: New file.
      	* ld/testsuite/ld-sframe/sframe.exp: New testsuite.
      	* ld/testsuite/ld-x86-64/sframe-bar.s: New file.
      	* ld/testsuite/ld-x86-64/sframe-foo.s: Likewise.
      	* ld/testsuite/ld-x86-64/sframe-simple-1.d: Likewise.
      	* ld/testsuite/ld-x86-64/sframe-plt-1.d: Likewise.
      	* ld/testsuite/ld-x86-64/sframe-simple-1.d: Likewise.
      	* ld/testsuite/ld-x86-64/x86-64.exp: Add new tests -
      	  sframe-simple-1, sframe-plt-1.
      	* ld/testsuite/lib/ld-lib.exp: Add new proc to check if
      	  assembler supports SFrame section.
      	* ld/testsuite/ld-sframe/discard.d: New file.
      	* ld/testsuite/ld-sframe/discard.ld: Likewise.
      	* ld/testsuite/ld-sframe/discard.s: Likewise.
      cf0e0a0b
    • Weimin Pan's avatar
      libsframe: add the SFrame library · 19e559f1
      Weimin Pan authored
      libsframe is a library that allows you to:
      - decode a .sframe section
      - probe and inspect a .sframe section
      - encode (and eventually write) a .sframe section.
      
      This library is currently being used by the linker, readelf, objdump.
      This library will also be used by the SFrame unwinder which is still
      to be upstream'd.
      
      The file include/sframe-api.h defines the user-facing APIs for decoding,
      encoding and probing .sframe sections. A set of error codes together
      with their error message strings are also defined.
      
      Endian flipping is performed automatically at read and write time, if
      cross-endianness is detected.
      
      ChangeLog:
      
      	* Makefile.def: Add libsframe as new module with its
      	dependencies.
      	* Makefile.in: Regenerated.
      	* binutils/Makefile.am: Add libsframe.
      	* binutils/Makefile.in: Regenerated.
      	* configure: Regenerated
      	* configure.ac: Add libsframe to host_libs.
      	* libsframe/Makefile.am: New file.
      	* libsframe/Makefile.in: New file.
      	* libsframe/aclocal.m4: New file.
      	* libsframe/config.h.in: New file.
      	* libsframe/configure: New file.
      	* libsframe/configure.ac: New file.
      	* libsframe/sframe-error.c: New file.
      	* libsframe/sframe-impl.h: New file.
      	* libsframe/sframe.c: New file.
      
      include/ChangeLog:
      
      	* sframe-api.h: New file.
      
      testsuite/ChangeLog:
      
      	* libsframe/testsuite/Makefile.am: New file.
      	* libsframe/testsuite/Makefile.in: Regenerated.
      	* libsframe/testsuite/libsframe.decode/Makefile.am: New
      	  file.
      	* libsframe/testsuite/libsframe.decode/Makefile.in:
      	  Regenerated.
      	* libsframe/testsuite/libsframe.decode/decode.exp: New file.
      	* libsframe/testsuite/libsframe.encode/Makefile.am:
      	  Likewise.
      	* libsframe/testsuite/libsframe.encode/Makefile.in:
      	  Regenerated.
      	* libsframe/testsuite/libsframe.encode/encode.exp: New file.
      	* libsframe/testsuite/libsframe.encode/encode-1.c: Likewise.
      	* libsframe/testsuite/libsframe.decode/be-flipping.c: Likewise.
      	* libsframe/testsuite/libsframe.decode/frecnt-1.c: Likewise.
      	* libsframe/testsuite/libsframe.decode/frecnt-2.c: Likewise.
      	* libsframe/testsuite/libsframe.decode/DATA-BE: New file.
      	* libsframe/testsuite/libsframe.decode/DATA1: Likewise.
      	* libsframe/testsuite/libsframe.decode/DATA2: Likewise.
      19e559f1
    • Indu Bhagat's avatar
      sframe.h: Add SFrame format definition · 972d23dd
      Indu Bhagat authored
      The header sframe.h defines the SFrame format.
      
      The SFrame format is the Simple Frame format.  It can be used to
      represent the minimal necessary unwind information required for
      backtracing.  The current version supports AMD64 and AARCH64.
      
      More details of the SFrame format are included in the documentation
      of the header file in this patch.
      
      include/ChangeLog:
      	* sframe.h: New file.
      972d23dd
  26. Nov 14, 2022
    • Andre Vieira's avatar
      aarch64: Add support for Common Short Sequence Compression extension · 1f7b42d5
      Andre Vieira authored
      This patch adds support for the CSSC extension and its corresponding
      instructions: ABS, CNT, CTZ, SMAX, UMAX, SMIN, UMIN.
      
      gas/ChangeLog:
      
              * config/tc-aarch64.c (parse_operands): Handle new operand types.
              * doc/c-aarch64.texi: Document new extension.
              * testsuite/gas/aarch64/cssc.d: New test.
              * testsuite/gas/aarch64/cssc.s: New test.
      
      include/ChangeLog:
      
              * opcode/aarch64.h (AARCH64_FEATURE_CSSC): New feature Macro.
              (enum aarch64_opnd): New operand types.
              (enum aarch64_insn_class): New instruction class.
      
      opcodes/ChangeLog:
      
      	* aarch64-asm-2.c: Regenerate.
      	* aarch64-dis-2.c: Regenerate.
      	* aarch64-opc-2.c: Regenerate.
      	* aarch64-opc.c (operand_general_constraint_met_p): Update for new
      	operand types.
      	(aarch64_print_operand): Likewise.
      	* aarch64-opc.h (enum aarch64_field_kind): Declare FLD_CSSC_imm8 field.
      	* aarch64-tbl.h (aarch64_feature_cssc): Define new feature set.
      	(CSSC): Define new feature set Macro.
      	(CSSC_INSN): Define new instruction type.
      	(aarch64_opcode_table): Add new instructions.
      1f7b42d5
  27. Nov 08, 2022
    • Mike Frysinger's avatar
      sim: drop unused CORE_ADDR_TYPE · 195064c8
      Mike Frysinger authored
      This hasn't been used by gdb in decades, and doesn't make sense with
      a standalone sim program/library where the ABI is fixed.  So punt it
      to simplify the code.
      195064c8
  28. Nov 02, 2022
  29. Oct 31, 2022
Loading