sim: mcore/microblaze: clean up a bit
Fix some various warnings and enable the extra warnings options.
This commit is contained in:
parent
6cd5ace4db
commit
feb703b3f4
@ -1,3 +1,25 @@
|
||||
2015-03-16 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* configure.ac: Call SIM_AC_OPTION_WARNINGS.
|
||||
* confingure: Regenerate.
|
||||
* interp.c (mcore_extract_unsigned_integer): Make static and update
|
||||
prototype. Fix up printf string.
|
||||
(mcore_store_unsigned_integer): Make static and update prototype.
|
||||
(int_sbrk): Likewise.
|
||||
(wbat, wlat, what, rbat, rlat, rhat): Delete INLINE and update
|
||||
prototype.
|
||||
(SEXTB, SEXTW, IOMEM): Delete.
|
||||
(sim_size): Update prototype. Fix up printf string.
|
||||
(init_pointers): Update prototype.
|
||||
(set_initial_gprs): Update prototype. Fix up printf string.
|
||||
(log_open, log_close, is_opened, handle_trap1, process_stub, util,
|
||||
iu_carry): Update prototype.
|
||||
(sim_resume): Update prototype. Change addr to a word.
|
||||
(sim_write, sim_read, sim_store_register, sim_fetch_register,
|
||||
sim_trace, sim_stop_reason, sim_stop, sim_info, sim_open,
|
||||
sim_close, sim_load, sim_create_inferior, sim_do_command,
|
||||
sim_set_callbacks): Update prototype.
|
||||
|
||||
2015-03-16 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* config.in, configure: Regenerate.
|
||||
|
115
sim/mcore/configure
vendored
115
sim/mcore/configure
vendored
@ -759,6 +759,9 @@ enable_sim_trace
|
||||
enable_sim_profile
|
||||
with_pkgversion
|
||||
with_bugurl
|
||||
enable_werror
|
||||
enable_build_warnings
|
||||
enable_sim_build_warnings
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
host_alias
|
||||
@ -1401,6 +1404,11 @@ Optional Features:
|
||||
--enable-sim-stdio Specify whether to use stdio for console input/output.
|
||||
--enable-sim-trace=opts Enable tracing flags
|
||||
--enable-sim-profile=opts Enable profiling flags
|
||||
--enable-werror treat compile warnings as errors
|
||||
--enable-build-warnings enable build-time compiler warnings if gcc is used
|
||||
--enable-sim-build-warnings
|
||||
enable SIM specific build-time compiler warnings if
|
||||
gcc is used
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@ -12354,7 +12362,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12357 "configure"
|
||||
#line 12365 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12460,7 +12468,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12463 "configure"
|
||||
#line 12471 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12951,6 +12959,109 @@ sim_link_links="${sim_link_links} targ-vals.def"
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
enableval=$enable_werror; case "${enableval}" in
|
||||
yes | y) ERROR_ON_WARNING="yes" ;;
|
||||
no | n) ERROR_ON_WARNING="no" ;;
|
||||
*) as_fn_error "bad value ${enableval} for --enable-werror" "$LINENO" 5 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
# Enable -Werror by default when using gcc
|
||||
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
|
||||
ERROR_ON_WARNING=yes
|
||||
fi
|
||||
|
||||
WERROR_CFLAGS=""
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
# NOTE: Disabled in the sim dir due to most sims generating warnings.
|
||||
# WERROR_CFLAGS="-Werror"
|
||||
true
|
||||
fi
|
||||
|
||||
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
|
||||
-Wpointer-sign \
|
||||
-Wno-unused -Wunused-value -Wunused-function \
|
||||
-Wno-switch -Wno-char-subscripts -Wmissing-prototypes
|
||||
-Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \
|
||||
-Wold-style-declaration -Wold-style-definition"
|
||||
|
||||
# Enable -Wno-format by default when using gcc on mingw since many
|
||||
# GCC versions complain about %I64.
|
||||
case "${host}" in
|
||||
*-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;;
|
||||
*) build_warnings="$build_warnings -Wformat-nonliteral" ;;
|
||||
esac
|
||||
|
||||
# Check whether --enable-build-warnings was given.
|
||||
if test "${enable_build_warnings+set}" = set; then :
|
||||
enableval=$enable_build_warnings; case "${enableval}" in
|
||||
yes) ;;
|
||||
no) build_warnings="-w";;
|
||||
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${build_warnings} ${t}";;
|
||||
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${t} ${build_warnings}";;
|
||||
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
||||
echo "Setting compiler warning flags = $build_warnings" 6>&1
|
||||
fi
|
||||
fi
|
||||
# Check whether --enable-sim-build-warnings was given.
|
||||
if test "${enable_sim_build_warnings+set}" = set; then :
|
||||
enableval=$enable_sim_build_warnings; case "${enableval}" in
|
||||
yes) ;;
|
||||
no) build_warnings="-w";;
|
||||
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${build_warnings} ${t}";;
|
||||
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${t} ${build_warnings}";;
|
||||
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
||||
echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
|
||||
fi
|
||||
fi
|
||||
WARN_CFLAGS=""
|
||||
if test "x${build_warnings}" != x -a "x$GCC" = xyes
|
||||
then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler warning flags" >&5
|
||||
$as_echo_n "checking compiler warning flags... " >&6; }
|
||||
# Separate out the -Werror flag as some files just cannot be
|
||||
# compiled with it enabled.
|
||||
for w in ${build_warnings}; do
|
||||
case $w in
|
||||
-Werr*) WERROR_CFLAGS=-Werror ;;
|
||||
*) # Check that GCC accepts it
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $w"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
WARN_CFLAGS="${WARN_CFLAGS} $w"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
esac
|
||||
done
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
|
||||
$as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
|
||||
ac_sources="$sim_link_files"
|
||||
ac_dests="$sim_link_links"
|
||||
while test -n "$ac_sources"; do
|
||||
|
@ -5,4 +5,6 @@ sinclude(../common/acinclude.m4)
|
||||
|
||||
SIM_AC_COMMON
|
||||
|
||||
SIM_AC_OPTION_WARNINGS
|
||||
|
||||
SIM_AC_OUTPUT
|
||||
|
@ -42,10 +42,8 @@ static unsigned long heap_ptr = 0;
|
||||
host_callback * callback;
|
||||
|
||||
|
||||
unsigned long
|
||||
mcore_extract_unsigned_integer (addr, len)
|
||||
unsigned char * addr;
|
||||
int len;
|
||||
static unsigned long
|
||||
mcore_extract_unsigned_integer (unsigned char *addr, int len)
|
||||
{
|
||||
unsigned long retval;
|
||||
unsigned char * p;
|
||||
@ -53,7 +51,7 @@ mcore_extract_unsigned_integer (addr, len)
|
||||
unsigned char * endaddr = startaddr + len;
|
||||
|
||||
if (len > (int) sizeof (unsigned long))
|
||||
printf ("That operation is not available on integers of more than %d bytes.",
|
||||
printf ("That operation is not available on integers of more than %zu bytes.",
|
||||
sizeof (unsigned long));
|
||||
|
||||
/* Start at the most significant end of the integer, and work towards
|
||||
@ -74,11 +72,8 @@ mcore_extract_unsigned_integer (addr, len)
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
mcore_store_unsigned_integer (addr, len, val)
|
||||
unsigned char * addr;
|
||||
int len;
|
||||
unsigned long val;
|
||||
static void
|
||||
mcore_store_unsigned_integer (unsigned char *addr, int len, unsigned long val)
|
||||
{
|
||||
unsigned char * p;
|
||||
unsigned char * startaddr = (unsigned char *)addr;
|
||||
@ -179,9 +174,8 @@ static int issue_messages = 0;
|
||||
#define PARM4 5
|
||||
#define RET1 2 /* register for return values. */
|
||||
|
||||
long
|
||||
int_sbrk (inc_bytes)
|
||||
int inc_bytes;
|
||||
static long
|
||||
int_sbrk (int inc_bytes)
|
||||
{
|
||||
long addr;
|
||||
|
||||
@ -195,9 +189,8 @@ int_sbrk (inc_bytes)
|
||||
return addr;
|
||||
}
|
||||
|
||||
static void INLINE
|
||||
wbat (x, v)
|
||||
word x, v;
|
||||
static void
|
||||
wbat (word x, word v)
|
||||
{
|
||||
if (((uword)x) >= cpu.asregs.msize)
|
||||
{
|
||||
@ -213,9 +206,8 @@ wbat (x, v)
|
||||
}
|
||||
}
|
||||
|
||||
static void INLINE
|
||||
wlat (x, v)
|
||||
word x, v;
|
||||
static void
|
||||
wlat (word x, word v)
|
||||
{
|
||||
if (((uword)x) >= cpu.asregs.msize)
|
||||
{
|
||||
@ -252,9 +244,8 @@ wlat (x, v)
|
||||
}
|
||||
}
|
||||
|
||||
static void INLINE
|
||||
what (x, v)
|
||||
word x, v;
|
||||
static void
|
||||
what (word x, word v)
|
||||
{
|
||||
if (((uword)x) >= cpu.asregs.msize)
|
||||
{
|
||||
@ -289,9 +280,8 @@ what (x, v)
|
||||
}
|
||||
|
||||
/* Read functions. */
|
||||
static int INLINE
|
||||
rbat (x)
|
||||
word x;
|
||||
static int
|
||||
rbat (word x)
|
||||
{
|
||||
if (((uword)x) >= cpu.asregs.msize)
|
||||
{
|
||||
@ -308,9 +298,8 @@ rbat (x)
|
||||
}
|
||||
}
|
||||
|
||||
static int INLINE
|
||||
rlat (x)
|
||||
word x;
|
||||
static int
|
||||
rlat (word x)
|
||||
{
|
||||
if (((uword) x) >= cpu.asregs.msize)
|
||||
{
|
||||
@ -343,9 +332,8 @@ rlat (x)
|
||||
}
|
||||
}
|
||||
|
||||
static int INLINE
|
||||
rhat (x)
|
||||
word x;
|
||||
static int
|
||||
rhat (word x)
|
||||
{
|
||||
if (((uword)x) >= cpu.asregs.msize)
|
||||
{
|
||||
@ -379,24 +367,12 @@ rhat (x)
|
||||
}
|
||||
|
||||
|
||||
#define SEXTB(x) (((x & 0xff) ^ (~ 0x7f)) + 0x80)
|
||||
#define SEXTW(y) ((int)((short)y))
|
||||
|
||||
static int
|
||||
IOMEM (addr, write, value)
|
||||
int addr;
|
||||
int write;
|
||||
int value;
|
||||
{
|
||||
}
|
||||
|
||||
/* Default to a 8 Mbyte (== 2^23) memory space. */
|
||||
static int sim_memory_size = 23;
|
||||
|
||||
#define MEM_SIZE_FLOOR 64
|
||||
void
|
||||
sim_size (power)
|
||||
int power;
|
||||
sim_size (int power)
|
||||
{
|
||||
sim_memory_size = power;
|
||||
cpu.asregs.msize = 1 << sim_memory_size;
|
||||
@ -415,7 +391,7 @@ sim_size (power)
|
||||
{
|
||||
if (issue_messages)
|
||||
fprintf (stderr,
|
||||
"Not enough VM for simulation of %d bytes of RAM\n",
|
||||
"Not enough VM for simulation of %lu bytes of RAM\n",
|
||||
cpu.asregs.msize);
|
||||
|
||||
cpu.asregs.msize = 1;
|
||||
@ -424,14 +400,14 @@ sim_size (power)
|
||||
}
|
||||
|
||||
static void
|
||||
init_pointers ()
|
||||
init_pointers (void)
|
||||
{
|
||||
if (cpu.asregs.msize != (1 << sim_memory_size))
|
||||
sim_size (sim_memory_size);
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_gprs ()
|
||||
set_initial_gprs (void)
|
||||
{
|
||||
int i;
|
||||
long space;
|
||||
@ -446,7 +422,7 @@ set_initial_gprs ()
|
||||
memsize = cpu.asregs.msize / (1024 * 1024);
|
||||
|
||||
if (issue_messages > 1)
|
||||
fprintf (stderr, "Simulated memory of %d Mbytes (0x0 .. 0x%08x)\n",
|
||||
fprintf (stderr, "Simulated memory of %lu Mbytes (0x0 .. 0x%08lx)\n",
|
||||
memsize, cpu.asregs.msize - 1);
|
||||
|
||||
/* Clean out the GPRs and alternate GPRs. */
|
||||
@ -481,8 +457,7 @@ set_initial_gprs ()
|
||||
unsigned char opened[100];
|
||||
|
||||
static void
|
||||
log_open (fd)
|
||||
int fd;
|
||||
log_open (int fd)
|
||||
{
|
||||
if (fd < 0 || fd > NUM_ELEM (opened))
|
||||
return;
|
||||
@ -491,8 +466,7 @@ log_open (fd)
|
||||
}
|
||||
|
||||
static void
|
||||
log_close (fd)
|
||||
int fd;
|
||||
log_close (int fd)
|
||||
{
|
||||
if (fd < 0 || fd > NUM_ELEM (opened))
|
||||
return;
|
||||
@ -501,8 +475,7 @@ log_close (fd)
|
||||
}
|
||||
|
||||
static int
|
||||
is_opened (fd)
|
||||
int fd;
|
||||
is_opened (int fd)
|
||||
{
|
||||
if (fd < 0 || fd > NUM_ELEM (opened))
|
||||
return 0;
|
||||
@ -511,7 +484,7 @@ is_opened (fd)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_trap1 ()
|
||||
handle_trap1 (void)
|
||||
{
|
||||
unsigned long a[3];
|
||||
|
||||
@ -628,8 +601,7 @@ handle_trap1 ()
|
||||
}
|
||||
|
||||
static void
|
||||
process_stub (what)
|
||||
int what;
|
||||
process_stub (int what)
|
||||
{
|
||||
/* These values should match those in libgloss/mcore/syscalls.s. */
|
||||
switch (what)
|
||||
@ -653,8 +625,7 @@ process_stub (what)
|
||||
}
|
||||
|
||||
static void
|
||||
util (what)
|
||||
unsigned what;
|
||||
util (unsigned what)
|
||||
{
|
||||
switch (what)
|
||||
{
|
||||
@ -708,10 +679,7 @@ util (what)
|
||||
|
||||
/* For figuring out whether we carried; addc/subc use this. */
|
||||
static int
|
||||
iu_carry (a, b, cin)
|
||||
unsigned long a;
|
||||
unsigned long b;
|
||||
int cin;
|
||||
iu_carry (unsigned long a, unsigned long b, int cin)
|
||||
{
|
||||
unsigned long x;
|
||||
|
||||
@ -749,9 +717,7 @@ int WLW;
|
||||
static int tracing = 0;
|
||||
|
||||
void
|
||||
sim_resume (sd, step, siggnal)
|
||||
SIM_DESC sd;
|
||||
int step, siggnal;
|
||||
sim_resume (SIM_DESC sd, int step, int siggnal)
|
||||
{
|
||||
int needfetch;
|
||||
word ibuf;
|
||||
@ -960,7 +926,7 @@ sim_resume (sd, step, siggnal)
|
||||
break;
|
||||
case 0x4: /* ldq */
|
||||
{
|
||||
char *addr = (char *)cpu.gr[RD];
|
||||
word addr = cpu.gr[RD];
|
||||
int regno = 4; /* always r4-r7 */
|
||||
|
||||
bonus_cycles++;
|
||||
@ -976,7 +942,7 @@ sim_resume (sd, step, siggnal)
|
||||
break;
|
||||
case 0x5: /* stq */
|
||||
{
|
||||
char *addr = (char *)cpu.gr[RD];
|
||||
word addr = cpu.gr[RD];
|
||||
int regno = 4; /* always r4-r7 */
|
||||
|
||||
memops += 4;
|
||||
@ -992,7 +958,7 @@ sim_resume (sd, step, siggnal)
|
||||
break;
|
||||
case 0x6: /* ldm */
|
||||
{
|
||||
char *addr = (char *)cpu.gr[0];
|
||||
word addr = cpu.gr[0];
|
||||
int regno = RD;
|
||||
|
||||
/* bonus cycle is really only needed if
|
||||
@ -1011,7 +977,7 @@ sim_resume (sd, step, siggnal)
|
||||
break;
|
||||
case 0x7: /* stm */
|
||||
{
|
||||
char *addr = (char *)cpu.gr[0];
|
||||
word addr = cpu.gr[0];
|
||||
int regno = RD;
|
||||
|
||||
/* this should be removed! */
|
||||
@ -1706,11 +1672,7 @@ sim_resume (sd, step, siggnal)
|
||||
|
||||
|
||||
int
|
||||
sim_write (sd, addr, buffer, size)
|
||||
SIM_DESC sd;
|
||||
SIM_ADDR addr;
|
||||
const unsigned char * buffer;
|
||||
int size;
|
||||
sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size)
|
||||
{
|
||||
int i;
|
||||
init_pointers ();
|
||||
@ -1721,11 +1683,7 @@ sim_write (sd, addr, buffer, size)
|
||||
}
|
||||
|
||||
int
|
||||
sim_read (sd, addr, buffer, size)
|
||||
SIM_DESC sd;
|
||||
SIM_ADDR addr;
|
||||
unsigned char * buffer;
|
||||
int size;
|
||||
sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
|
||||
{
|
||||
int i;
|
||||
init_pointers ();
|
||||
@ -1737,11 +1695,7 @@ sim_read (sd, addr, buffer, size)
|
||||
|
||||
|
||||
int
|
||||
sim_store_register (sd, rn, memory, length)
|
||||
SIM_DESC sd;
|
||||
int rn;
|
||||
unsigned char * memory;
|
||||
int length;
|
||||
sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
|
||||
{
|
||||
init_pointers ();
|
||||
|
||||
@ -1763,11 +1717,7 @@ sim_store_register (sd, rn, memory, length)
|
||||
}
|
||||
|
||||
int
|
||||
sim_fetch_register (sd, rn, memory, length)
|
||||
SIM_DESC sd;
|
||||
int rn;
|
||||
unsigned char * memory;
|
||||
int length;
|
||||
sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
|
||||
{
|
||||
init_pointers ();
|
||||
|
||||
@ -1789,8 +1739,7 @@ sim_fetch_register (sd, rn, memory, length)
|
||||
|
||||
|
||||
int
|
||||
sim_trace (sd)
|
||||
SIM_DESC sd;
|
||||
sim_trace (SIM_DESC sd)
|
||||
{
|
||||
tracing = 1;
|
||||
|
||||
@ -1802,10 +1751,7 @@ sim_trace (sd)
|
||||
}
|
||||
|
||||
void
|
||||
sim_stop_reason (sd, reason, sigrc)
|
||||
SIM_DESC sd;
|
||||
enum sim_stop * reason;
|
||||
int * sigrc;
|
||||
sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
|
||||
{
|
||||
if (cpu.asregs.exception == SIGQUIT)
|
||||
{
|
||||
@ -1821,8 +1767,7 @@ sim_stop_reason (sd, reason, sigrc)
|
||||
|
||||
|
||||
int
|
||||
sim_stop (sd)
|
||||
SIM_DESC sd;
|
||||
sim_stop (SIM_DESC sd)
|
||||
{
|
||||
cpu.asregs.exception = SIGINT;
|
||||
return 1;
|
||||
@ -1830,9 +1775,7 @@ sim_stop (sd)
|
||||
|
||||
|
||||
void
|
||||
sim_info (sd, verbose)
|
||||
SIM_DESC sd;
|
||||
int verbose;
|
||||
sim_info (SIM_DESC sd, int verbose)
|
||||
{
|
||||
#ifdef WATCHFUNCTIONS
|
||||
int w, wcyc;
|
||||
@ -1889,11 +1832,7 @@ struct aout
|
||||
#define SHORT(x) (((x)[0]<<8)|(x)[1])
|
||||
|
||||
SIM_DESC
|
||||
sim_open (kind, cb, abfd, argv)
|
||||
SIM_OPEN_KIND kind;
|
||||
host_callback * cb;
|
||||
struct bfd * abfd;
|
||||
char ** argv;
|
||||
sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv)
|
||||
{
|
||||
int osize = sim_memory_size;
|
||||
myname = argv[0];
|
||||
@ -1913,19 +1852,13 @@ sim_open (kind, cb, abfd, argv)
|
||||
}
|
||||
|
||||
void
|
||||
sim_close (sd, quitting)
|
||||
SIM_DESC sd;
|
||||
int quitting;
|
||||
sim_close (SIM_DESC sd, int quitting)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
SIM_RC
|
||||
sim_load (sd, prog, abfd, from_tty)
|
||||
SIM_DESC sd;
|
||||
const char * prog;
|
||||
bfd * abfd;
|
||||
int from_tty;
|
||||
sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
|
||||
{
|
||||
/* Do the right thing for ELF executables; this turns out to be
|
||||
just about the right thing for any object format that:
|
||||
@ -2000,11 +1933,7 @@ sim_load (sd, prog, abfd, from_tty)
|
||||
}
|
||||
|
||||
SIM_RC
|
||||
sim_create_inferior (sd, prog_bfd, argv, env)
|
||||
SIM_DESC sd;
|
||||
struct bfd * prog_bfd;
|
||||
char ** argv;
|
||||
char ** env;
|
||||
sim_create_inferior (SIM_DESC sd, struct bfd *prog_bfd, char **argv, char **env)
|
||||
{
|
||||
char ** avp;
|
||||
int nargs = 0;
|
||||
@ -2122,9 +2051,7 @@ sim_create_inferior (sd, prog_bfd, argv, env)
|
||||
}
|
||||
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd;
|
||||
const char *cmd;
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
/* Nothing there yet; it's all an error. */
|
||||
|
||||
@ -2196,8 +2123,7 @@ sim_do_command (sd, cmd)
|
||||
}
|
||||
|
||||
void
|
||||
sim_set_callbacks (ptr)
|
||||
host_callback * ptr;
|
||||
sim_set_callbacks (host_callback *ptr)
|
||||
{
|
||||
callback = ptr;
|
||||
}
|
||||
|
@ -1,3 +1,15 @@
|
||||
2015-03-16 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* configure.ac: Call SIM_AC_OPTION_WARNINGS.
|
||||
* confingure: Regenerate.
|
||||
* interp.c: Include run-sim.h.
|
||||
(microblaze_extract_unsigned_integer): Mark static.
|
||||
(microblaze_store_unsigned_integer): Likewise.
|
||||
(int_sbrk, SEXTB, SEXTW, IOMEM): Delete.
|
||||
(init_pointers, set_initial_gprs): Add (void) to prototype.
|
||||
(opened, log_open, log_close, is_opened, handle_trap1, process_stub,
|
||||
util, iu_carry): Delete.
|
||||
|
||||
2015-03-16 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* config.in, configure: Regenerate.
|
||||
|
115
sim/microblaze/configure
vendored
115
sim/microblaze/configure
vendored
@ -759,6 +759,9 @@ enable_sim_trace
|
||||
enable_sim_profile
|
||||
with_pkgversion
|
||||
with_bugurl
|
||||
enable_werror
|
||||
enable_build_warnings
|
||||
enable_sim_build_warnings
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
host_alias
|
||||
@ -1401,6 +1404,11 @@ Optional Features:
|
||||
--enable-sim-stdio Specify whether to use stdio for console input/output.
|
||||
--enable-sim-trace=opts Enable tracing flags
|
||||
--enable-sim-profile=opts Enable profiling flags
|
||||
--enable-werror treat compile warnings as errors
|
||||
--enable-build-warnings enable build-time compiler warnings if gcc is used
|
||||
--enable-sim-build-warnings
|
||||
enable SIM specific build-time compiler warnings if
|
||||
gcc is used
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@ -12354,7 +12362,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12357 "configure"
|
||||
#line 12365 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12460,7 +12468,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 12463 "configure"
|
||||
#line 12471 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12951,6 +12959,109 @@ sim_link_links="${sim_link_links} targ-vals.def"
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
enableval=$enable_werror; case "${enableval}" in
|
||||
yes | y) ERROR_ON_WARNING="yes" ;;
|
||||
no | n) ERROR_ON_WARNING="no" ;;
|
||||
*) as_fn_error "bad value ${enableval} for --enable-werror" "$LINENO" 5 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
# Enable -Werror by default when using gcc
|
||||
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
|
||||
ERROR_ON_WARNING=yes
|
||||
fi
|
||||
|
||||
WERROR_CFLAGS=""
|
||||
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||
# NOTE: Disabled in the sim dir due to most sims generating warnings.
|
||||
# WERROR_CFLAGS="-Werror"
|
||||
true
|
||||
fi
|
||||
|
||||
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
|
||||
-Wpointer-sign \
|
||||
-Wno-unused -Wunused-value -Wunused-function \
|
||||
-Wno-switch -Wno-char-subscripts -Wmissing-prototypes
|
||||
-Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \
|
||||
-Wold-style-declaration -Wold-style-definition"
|
||||
|
||||
# Enable -Wno-format by default when using gcc on mingw since many
|
||||
# GCC versions complain about %I64.
|
||||
case "${host}" in
|
||||
*-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;;
|
||||
*) build_warnings="$build_warnings -Wformat-nonliteral" ;;
|
||||
esac
|
||||
|
||||
# Check whether --enable-build-warnings was given.
|
||||
if test "${enable_build_warnings+set}" = set; then :
|
||||
enableval=$enable_build_warnings; case "${enableval}" in
|
||||
yes) ;;
|
||||
no) build_warnings="-w";;
|
||||
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${build_warnings} ${t}";;
|
||||
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${t} ${build_warnings}";;
|
||||
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
||||
echo "Setting compiler warning flags = $build_warnings" 6>&1
|
||||
fi
|
||||
fi
|
||||
# Check whether --enable-sim-build-warnings was given.
|
||||
if test "${enable_sim_build_warnings+set}" = set; then :
|
||||
enableval=$enable_sim_build_warnings; case "${enableval}" in
|
||||
yes) ;;
|
||||
no) build_warnings="-w";;
|
||||
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${build_warnings} ${t}";;
|
||||
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
||||
build_warnings="${t} ${build_warnings}";;
|
||||
*) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
||||
esac
|
||||
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
|
||||
echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
|
||||
fi
|
||||
fi
|
||||
WARN_CFLAGS=""
|
||||
if test "x${build_warnings}" != x -a "x$GCC" = xyes
|
||||
then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler warning flags" >&5
|
||||
$as_echo_n "checking compiler warning flags... " >&6; }
|
||||
# Separate out the -Werror flag as some files just cannot be
|
||||
# compiled with it enabled.
|
||||
for w in ${build_warnings}; do
|
||||
case $w in
|
||||
-Werr*) WERROR_CFLAGS=-Werror ;;
|
||||
*) # Check that GCC accepts it
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $w"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
WARN_CFLAGS="${WARN_CFLAGS} $w"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
esac
|
||||
done
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
|
||||
$as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
|
||||
ac_sources="$sim_link_files"
|
||||
ac_dests="$sim_link_links"
|
||||
while test -n "$ac_sources"; do
|
||||
|
@ -5,4 +5,6 @@ sinclude(../common/acinclude.m4)
|
||||
|
||||
SIM_AC_COMMON
|
||||
|
||||
SIM_AC_OPTION_WARNINGS
|
||||
|
||||
SIM_AC_OUTPUT
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gdb/callback.h"
|
||||
#include "libiberty.h"
|
||||
#include "gdb/remote-sim.h"
|
||||
#include "run-sim.h"
|
||||
#include "sim-main.h"
|
||||
#include "sim-utils.h"
|
||||
#include "microblaze-dis.h"
|
||||
@ -41,7 +42,7 @@ static unsigned long heap_ptr = 0;
|
||||
static unsigned long stack_ptr = 0;
|
||||
host_callback *callback;
|
||||
|
||||
unsigned long
|
||||
static unsigned long
|
||||
microblaze_extract_unsigned_integer (unsigned char *addr, int len)
|
||||
{
|
||||
unsigned long retval;
|
||||
@ -71,7 +72,7 @@ microblaze_extract_unsigned_integer (unsigned char *addr, int len)
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
microblaze_store_unsigned_integer (unsigned char *addr, int len,
|
||||
unsigned long val)
|
||||
{
|
||||
@ -106,21 +107,6 @@ static char *myname;
|
||||
|
||||
static int issue_messages = 0;
|
||||
|
||||
long
|
||||
int_sbrk (int inc_bytes)
|
||||
{
|
||||
long addr;
|
||||
|
||||
addr = heap_ptr;
|
||||
|
||||
heap_ptr += inc_bytes;
|
||||
|
||||
if (issue_messages && heap_ptr > SP)
|
||||
fprintf (stderr, "Warning: heap_ptr overlaps stack!\n");
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
static void /* INLINE */
|
||||
wbat (word x, word v)
|
||||
{
|
||||
@ -298,15 +284,6 @@ rhat (word x)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define SEXTB(x) (((x & 0xff) ^ (~ 0x7f)) + 0x80)
|
||||
#define SEXTW(y) ((int)((short)y))
|
||||
|
||||
static int
|
||||
IOMEM (int addr, int write, int value)
|
||||
{
|
||||
}
|
||||
|
||||
/* Default to a 8 Mbyte (== 2^23) memory space. */
|
||||
static int sim_memory_size = 1 << 23;
|
||||
|
||||
@ -335,14 +312,14 @@ sim_size (int size)
|
||||
}
|
||||
|
||||
static void
|
||||
init_pointers ()
|
||||
init_pointers (void)
|
||||
{
|
||||
if (CPU.msize != (sim_memory_size))
|
||||
sim_size (sim_memory_size);
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_gprs ()
|
||||
set_initial_gprs (void)
|
||||
{
|
||||
int i;
|
||||
long space;
|
||||
@ -366,122 +343,6 @@ set_initial_gprs ()
|
||||
CPU.insts = 0;
|
||||
CPU.cycles = 0;
|
||||
CPU.imm_enable = 0;
|
||||
|
||||
}
|
||||
|
||||
/* Functions so that trapped open/close don't interfere with the
|
||||
parent's functions. We say that we can't close the descriptors
|
||||
that we didn't open. exit() and cleanup() get in trouble here,
|
||||
to some extent. That's the price of emulation. */
|
||||
|
||||
unsigned char opened[100];
|
||||
|
||||
static void
|
||||
log_open (int fd)
|
||||
{
|
||||
if (fd < 0 || fd > NUM_ELEM (opened))
|
||||
return;
|
||||
|
||||
opened[fd] = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
log_close (int fd)
|
||||
{
|
||||
if (fd < 0 || fd > NUM_ELEM (opened))
|
||||
return;
|
||||
|
||||
opened[fd] = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
is_opened (int fd)
|
||||
{
|
||||
if (fd < 0 || fd > NUM_ELEM (opened))
|
||||
return 0;
|
||||
|
||||
return opened[fd];
|
||||
}
|
||||
|
||||
static void
|
||||
handle_trap1 ()
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
process_stub (int what)
|
||||
{
|
||||
/* These values should match those in libgloss/microblaze/syscalls.s. */
|
||||
switch (what)
|
||||
{
|
||||
case 3: /* _read */
|
||||
case 4: /* _write */
|
||||
case 5: /* _open */
|
||||
case 6: /* _close */
|
||||
case 10: /* _unlink */
|
||||
case 19: /* _lseek */
|
||||
case 43: /* _times */
|
||||
handle_trap1 ();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (issue_messages)
|
||||
fprintf (stderr, "Unhandled stub opcode: %d\n", what);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
util (unsigned what)
|
||||
{
|
||||
switch (what)
|
||||
{
|
||||
case 0: /* exit */
|
||||
CPU.exception = SIGQUIT;
|
||||
break;
|
||||
|
||||
case 1: /* printf */
|
||||
{
|
||||
unsigned long a[6];
|
||||
unsigned char *s;
|
||||
int i;
|
||||
|
||||
for (s = (unsigned char *)a[0], i = 1 ; *s && i < 6 ; s++)
|
||||
if (*s == '%')
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* scanf */
|
||||
if (issue_messages)
|
||||
fprintf (stderr, "WARNING: scanf unimplemented\n");
|
||||
break;
|
||||
|
||||
case 3: /* utime */
|
||||
break;
|
||||
|
||||
case 0xFF:
|
||||
process_stub (CPU.regs[1]);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (issue_messages)
|
||||
fprintf (stderr, "Unhandled util code: %x\n", what);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* For figuring out whether we carried; addc/subc use this. */
|
||||
static int
|
||||
iu_carry (unsigned long a, unsigned long b, int cin)
|
||||
{
|
||||
unsigned long x;
|
||||
|
||||
x = (a & 0xffff) + (b & 0xffff) + cin;
|
||||
x = (x >> 16) + (a >> 16) + (b >> 16);
|
||||
x >>= 16;
|
||||
|
||||
return (x != 0);
|
||||
}
|
||||
|
||||
#define WATCHFUNCTIONS 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user