[PATCH v2 0/9] RISC-V: Support version controling for ISA standard extensions and CSR

Jim Wilson jimw@sifive.com
Mon Jun 1 21:35:54 GMT 2020


I found another problem with the patches.  RISC-V Linux native
gdbserver fails to build.  gdbserver/linux-riscv-low.cc includes
include/opcode/riscv.h.  Your patch added bfd.h include to that file,
just like 7 other files in that dir.  Unfortunately, gdbserver is not
built with -I options pointing at the bfd source and build trees like
gdb is.  Also, bfd is configured for the host, and gdbserver is
configured for the target, so including bfd header files in gdbserver
seems wrong.  linux-riscv-low.cc is the only one trying to include
header files from include/opcode but that doesn't seem inherently
wrong.  We could fix this by moving the parts that gdbserver needs to
another file that is target safe.  This is primarily
riscv_insn_length, but might also include other stuff.  riscv-opc.h is
probably safe but seems odd, so maybe a riscv-target.h or
riscv-common.h would be better, and add a comment saying that this is
intended to be shared between host and target code.  Then gdbserver
can include the safe file and avoid the bfd.h include.  Or
alternatively we could duplicate some code and just put it directly in
gdbserver, but I'd prefer to avoid that if we can.

JIm


More information about the Binutils mailing list