[PATCH 4/6] sim: m32r: unify ELF & Linux traps logic

John Baldwin jhb@FreeBSD.org
Mon Jul 12 14:20:54 GMT 2021


On 6/30/21 9:55 PM, Mike Frysinger via Gdb-patches wrote:
> This makes the simulator work the same regardless of the target (bare
> metal m32r-elf or Linux m32r-linux-gnu) by unifying the traps code.
> It was mostly already the same with the only difference being support
> for trap #2 reserved for Linux syscalls.  We can move that logic to
> runtime by checking the current environment operating mode instead.

This breaks the build on non-Linux hosts as <sys/sysinfo.h> and
sysinfo() are only available on Linux hosts.  Specifically, this is
the error I get now trying to build 'master' on a FreeBSD host:

gmake[4]: Entering directory '/usr/home/john/work/git/gdb/obj/sim/m32r'
   CC     traps.o
/home/john/work/git/gdb/sim/m32r/traps.c:40:10: fatal error: 'sys/sysinfo.h' file not found
#include <sys/sysinfo.h>
          ^~~~~~~~~~~~~~~
1 error generated.
gmake[4]: *** [Makefile:537: traps.o] Error 1
gmake[4]: Leaving directory '/usr/home/john/work/git/gdb/obj/sim/m32r'

I was going to add the autoconf glue for a HAVE_SYSINFO to wrap the
#include and the emulation of the associated syscall, but I wasn't
quite sure where to put it (or if we really want to to support the
syscall emulation on non-Linux hosts in general)?

-- 
John Baldwin


More information about the Gdb-patches mailing list