svn commit: r349736 - in stable/12/contrib/elftoolchain: common readelf

Mitchell Horne mhorne063 at gmail.com
Thu Jul 4 17:22:47 UTC 2019


On Thu, Jul 4, 2019 at 1:17 PM Mitchell Horne <mhorne at freebsd.org> wrote:
>
> Author: mhorne
> Date: Thu Jul  4 17:17:00 2019
> New Revision: 349736
> URL: https://svnweb.freebsd.org/changeset/base/349736
>
> Log:
>   MFC r349482,r349563:

Apologies, this should read r349482,r349562. The svn mergeinfo is
correct however.


>   readelf: Add support for RISC-V specific e_flags
>
>   Approved by:  markj (mentor, implicit)
>
> Modified:
>   stable/12/contrib/elftoolchain/common/elfdefinitions.h
>   stable/12/contrib/elftoolchain/readelf/readelf.c
> Directory Properties:
>   stable/12/   (props changed)
>
> Modified: stable/12/contrib/elftoolchain/common/elfdefinitions.h
> ==============================================================================
> --- stable/12/contrib/elftoolchain/common/elfdefinitions.h      Thu Jul  4 17:15:36 2019        (r349735)
> +++ stable/12/contrib/elftoolchain/common/elfdefinitions.h      Thu Jul  4 17:17:00 2019        (r349736)
> @@ -33,7 +33,7 @@
>   *   See: http://www.sco.com/developers/gabi/latest/ch4.intro.html
>   * - The May 1998 (version 1.5) draft of "The ELF-64 object format".
>   * - Processor-specific ELF ABI definitions for sparc, i386, amd64, mips,
> - *   ia64, and powerpc processors.
> + *   ia64, powerpc, and RISC-V processors.
>   * - The "Linkers and Libraries Guide", from Sun Microsystems.
>   */
>
> @@ -426,6 +426,22 @@ _ELF_DEFINE_EF(EF_PPC_RELOCATABLE,  0x00010000UL,                  \
>         "-mrelocatable flag")                                           \
>  _ELF_DEFINE_EF(EF_PPC_RELOCATABLE_LIB, 0x00008000UL,                   \
>         "-mrelocatable-lib flag")                                       \
> +_ELF_DEFINE_EF(EF_RISCV_RVC,       0x00000001UL,                       \
> +       "Compressed instruction extension")                             \
> +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_MASK, 0x00000006UL,                  \
> +       "Floating point ABI")                                           \
> +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_SOFT, 0x00000000UL,                  \
> +       "Software emulated floating point")                             \
> +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_SINGLE, 0x00000002UL,                        \
> +       "Single precision floating point")                              \
> +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_DOUBLE, 0x00000004UL,                        \
> +       "Double precision floating point")                              \
> +_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_QUAD, 0x00000006UL,                  \
> +       "Quad precision floating point")                                \
> +_ELF_DEFINE_EF(EF_RISCV_RVE,       0x00000008UL,                       \
> +       "RV32E embedded ABI")                                           \
> +_ELF_DEFINE_EF(EF_RISCV_TSO,       0x00000010UL,                       \
> +       "RVTSO memory consistency model")                               \
>  _ELF_DEFINE_EF(EF_SPARC_EXT_MASK,   0x00ffff00UL,                      \
>         "Vendor Extension mask")                                        \
>  _ELF_DEFINE_EF(EF_SPARC_32PLUS,     0x00000100UL,                      \
>
> Modified: stable/12/contrib/elftoolchain/readelf/readelf.c
> ==============================================================================
> --- stable/12/contrib/elftoolchain/readelf/readelf.c    Thu Jul  4 17:15:36 2019        (r349735)
> +++ stable/12/contrib/elftoolchain/readelf/readelf.c    Thu Jul  4 17:17:00 2019        (r349736)
> @@ -420,6 +420,13 @@ static struct eflags_desc powerpc_eflags_desc[] = {
>         {0, NULL}
>  };
>
> +static struct eflags_desc riscv_eflags_desc[] = {
> +       {EF_RISCV_RVC, "RVC"},
> +       {EF_RISCV_RVE, "RVE"},
> +       {EF_RISCV_TSO, "TSO"},
> +       {0, NULL}
> +};
> +
>  static struct eflags_desc sparc_eflags_desc[] = {
>         {EF_SPARC_32PLUS, "v8+"},
>         {EF_SPARC_SUN_US1, "ultrasparcI"},
> @@ -2279,6 +2286,23 @@ dump_eflags(struct readelf *re, uint64_t e_flags)
>         case EM_PPC:
>         case EM_PPC64:
>                 edesc = powerpc_eflags_desc;
> +               break;
> +       case EM_RISCV:
> +               switch (e_flags & EF_RISCV_FLOAT_ABI_MASK) {
> +               case EF_RISCV_FLOAT_ABI_SOFT:
> +                       printf(", soft-float ABI");
> +                       break;
> +               case EF_RISCV_FLOAT_ABI_SINGLE:
> +                       printf(", single-float ABI");
> +                       break;
> +               case EF_RISCV_FLOAT_ABI_DOUBLE:
> +                       printf(", double-float ABI");
> +                       break;
> +               case EF_RISCV_FLOAT_ABI_QUAD:
> +                       printf(", quad-float ABI");
> +                       break;
> +               }
> +               edesc = riscv_eflags_desc;
>                 break;
>         case EM_SPARC:
>         case EM_SPARC32PLUS:
>


More information about the svn-src-all mailing list