Define an error function in the PPC simulator library.

Previously this used the error function from GDB directly when linked
against GDB instead of the error method in the host callbacks
structure.  This was exposed via a link error when GDB was converted
to C++.  The error function invokes the error callback similar to
sim_io_error.

Note that there are also error functions in sim/ppc/main.c and
sim/ppc/misc.c.  The ppc libsim.a expects each consumer to provide
several symbols used by the library including "error".  sim-calls.c
provides these symbols when the library is linked into gdb.  The dgen,
igen, tmp-filter, tmp-ld-decode, tmp-ld-cache, and tmp-ld-insn programs
use the functions from misc.c.  psim uses the functions from main.c.

sim/ppc/ChangeLog:

	PR sim/20863
	* sim_calls.c (error): New function.
This commit is contained in:
John Baldwin 2017-09-04 19:53:50 -07:00
parent a379bfd00e
commit 625ce09c1c
2 changed files with 15 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2017-09-05 John Baldwin <jhb@FreeBSD.org>
PR sim/20863
* sim_calls.c (error): New function.
2017-02-13 Mike Frysinger <vapier@gentoo.org>
* cpu.h: Include libiberty.h.

View file

@ -386,6 +386,16 @@ sim_io_error (SIM_DESC sd, const char *fmt, ...)
/****/
void NORETURN
error (const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
callbacks->evprintf_filtered (callbacks, msg, ap);
va_end(ap);
callbacks->error (callbacks, "");
}
void *
zalloc(long size)
{