RISC-V: Fix the error when building RISC-V linux native gdbserver.
authorNelson Chu <nelson.chu@sifive.com>
Tue, 2 Jun 2020 01:44:13 +0000 (09:44 +0800)
committerNelson Chu <nelson.chu@sifive.com>
Wed, 3 Jun 2020 01:20:59 +0000 (09:20 +0800)
The original report is as follow,
https://sourceware.org/pipermail/binutils/2020-June/111383.html

Inlcude the bfd.h in the include/opcode/riscv.h may cause gdbserver fail
to build.  I just want to use the `bfd_boolean` in the opcodes/riscv-opc.c,
but I didn't realize this cause the build failed.  Fortunately, I can also
use the `int` as the function return types just like others in the
opcodes/riscv-opc.c.

include/
* opcode/riscv.h: Remove #include "bfd.h".  And change the return
types of riscv_get_isa_spec_class and riscv_get_priv_spec_class
from bfd_boolean to int.

opcodes/
* riscv-opc.c (riscv_get_isa_spec_class): Change bfd_boolean to int.
(riscv_get_priv_spec_class): Likewise.

include/ChangeLog
include/opcode/riscv.h
opcodes/ChangeLog
opcodes/riscv-opc.c

index 08eadb6cbd6479681b6e1d0e44fef555e4a00f45..5c0a82b5f8e851f68c20ceccd31dced46d5012b0 100644 (file)
@@ -1,3 +1,9 @@
+2020-06-03  Nelson Chu  <nelson.chu@sifive.com>
+
+       * opcode/riscv.h: Remove #include "bfd.h".  And change the return
+       types of riscv_get_isa_spec_class and riscv_get_priv_spec_class
+       from bfd_boolean to int.
+
 2020-05-28  Alan Modra  <amodra@gmail.com>
 
        PR 26044
index feeaa6e8dca63bb2f611671c561ec1750d69c416..fecf41042f48cb2c442d3d739d0ad9cd795082b9 100644 (file)
@@ -24,7 +24,6 @@
 #include "riscv-opc.h"
 #include <stdlib.h>
 #include <stdint.h>
-#include "bfd.h"
 
 typedef uint64_t insn_t;
 
@@ -490,9 +489,9 @@ extern const struct riscv_opcode riscv_opcodes[];
 extern const struct riscv_opcode riscv_insn_types[];
 extern const struct riscv_ext_version riscv_ext_version_table[];
 
-extern bfd_boolean
+extern int
 riscv_get_isa_spec_class (const char *, enum riscv_isa_spec_class *);
-extern bfd_boolean
+extern int
 riscv_get_priv_spec_class (const char *, enum riscv_priv_spec_class *);
 extern const char *
 riscv_get_priv_spec_name (enum riscv_priv_spec_class);
index d842ab6467259cd12d8a92c90fcbbb462ffee05e..950819daf35e74dbe5f968277864571e39715a0b 100644 (file)
@@ -1,3 +1,8 @@
+2020-06-03  Nelson Chu  <nelson.chu@sifive.com>
+
+       * riscv-opc.c (riscv_get_isa_spec_class): Change bfd_boolean to int.
+       (riscv_get_priv_spec_class): Likewise.
+
 2020-06-01  Alan Modra  <amodra@gmail.com>
 
        * bpf-desc.c: Regenerate.
index f011f1bbb7e8dea0ee0b58d356c1e56402d8f30a..4481359a876daebefd89b3478578f55420c18fdb 100644 (file)
@@ -958,24 +958,24 @@ static const struct isa_spec_t isa_specs[] =
 
 /* Get the corresponding ISA spec class by giving a ISA spec string.  */
 
-bfd_boolean
+int
 riscv_get_isa_spec_class (const char *s,
                          enum riscv_isa_spec_class *class)
 {
   const struct isa_spec_t *version;
 
   if (s == NULL)
-    return FALSE;
+    return 0;
 
   for (version = &isa_specs[0]; version->name != NULL; ++version)
     if (strcmp (version->name, s) == 0)
       {
        *class = version->class;
-       return TRUE;
+       return 1;
       }
 
   /* Can not find the supported ISA spec.  */
-  return FALSE;
+  return 0;
 }
 
 struct priv_spec_t
@@ -999,24 +999,24 @@ static const struct priv_spec_t priv_specs[] =
 /* Get the corresponding CSR version class by giving a privilege
    version string.  */
 
-bfd_boolean
+int
 riscv_get_priv_spec_class (const char *s,
                           enum riscv_priv_spec_class *class)
 {
   const struct priv_spec_t *version;
 
   if (s == NULL)
-    return FALSE;
+    return 0;
 
   for (version = &priv_specs[0]; version->name != NULL; ++version)
     if (strcmp (version->name, s) == 0)
       {
        *class = version->class;
-       return TRUE;
+       return 1;
       }
 
   /* Can not find the supported privilege version.  */
-  return FALSE;
+  return 0;
 }
 
 /* Get the corresponding privilege version string by giving a CSR
This page took 0.028406 seconds and 4 git commands to generate.