public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Fix the error when building RISC-V linux native gdbserver.
@ 2020-06-02  3:04 Nelson Chu
  2020-06-02 20:43 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Nelson Chu @ 2020-06-02  3:04 UTC (permalink / raw)
  To: binutils, jimw

The original report in 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/opcode/riscv.h |  5 ++---
 opcodes/riscv-opc.c    | 16 ++++++++--------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/include/opcode/riscv.h b/include/opcode/riscv.h
index feeaa6e..fecf410 100644
--- a/include/opcode/riscv.h
+++ b/include/opcode/riscv.h
@@ -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);
diff --git a/opcodes/riscv-opc.c b/opcodes/riscv-opc.c
index f011f1b..4481359 100644
--- a/opcodes/riscv-opc.c
+++ b/opcodes/riscv-opc.c
@@ -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
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Fix the error when building RISC-V linux native gdbserver.
  2020-06-02  3:04 [PATCH] RISC-V: Fix the error when building RISC-V linux native gdbserver Nelson Chu
@ 2020-06-02 20:43 ` Jim Wilson
  2020-06-03  1:24   ` Nelson Chu
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2020-06-02 20:43 UTC (permalink / raw)
  To: Nelson Chu; +Cc: Binutils

On Mon, Jun 1, 2020 at 8:04 PM Nelson Chu <nelson.chu@sifive.com> wrote:
> 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.

OK.  Thanks for the fix.

Jim

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Fix the error when building RISC-V linux native gdbserver.
  2020-06-02 20:43 ` Jim Wilson
@ 2020-06-03  1:24   ` Nelson Chu
  0 siblings, 0 replies; 3+ messages in thread
From: Nelson Chu @ 2020-06-03  1:24 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Binutils

On Wed, Jun 3, 2020 at 4:43 AM Jim Wilson <jimw@sifive.com> wrote:
>
> On Mon, Jun 1, 2020 at 8:04 PM Nelson Chu <nelson.chu@sifive.com> wrote:
> > 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.
>
> OK.  Thanks for the fix.

Thanks.  Committed.

Nelson

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-03  1:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02  3:04 [PATCH] RISC-V: Fix the error when building RISC-V linux native gdbserver Nelson Chu
2020-06-02 20:43 ` Jim Wilson
2020-06-03  1:24   ` Nelson Chu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).