aboutsummaryrefslogtreecommitdiff
path: root/sim/d10v
diff options
context:
space:
mode:
authorMichael Meissner <gnu@the-meissners.org>1996-09-04 18:50:13 +0000
committerMichael Meissner <gnu@the-meissners.org>1996-09-04 18:50:13 +0000
commit1eaaf3050ed63a769b480ba2e5ef08396567eb71 (patch)
tree1b7efe8c4991a559e01639057b35b1af189224b0 /sim/d10v
parent7eebfc6296f0830a435a21be0ab37a076c8566bd (diff)
downloadgdb-1eaaf3050ed63a769b480ba2e5ef08396567eb71.zip
gdb-1eaaf3050ed63a769b480ba2e5ef08396567eb71.tar.gz
gdb-1eaaf3050ed63a769b480ba2e5ef08396567eb71.tar.bz2
First cut at dealing with canadian crosses; make -t in debugger set d10v_debug if DEBUG
Diffstat (limited to 'sim/d10v')
-rw-r--r--sim/d10v/ChangeLog11
-rw-r--r--sim/d10v/Makefile.in34
-rwxr-xr-xsim/d10v/configure40
-rw-r--r--sim/d10v/configure.in9
-rw-r--r--sim/d10v/interp.c40
5 files changed, 104 insertions, 30 deletions
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index d551da9..aaa1cf4 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -33,12 +33,21 @@ Wed Sep 4 11:35:17 1996 Michael Meissner <meissner@tiktok.cygnus.com>
(sim_info): Print out statistics on instructions.
(sim_{trace,create_inferior}): Eliminate extraneous output unless
debugging.
+ (sim_open): If args == -t and DEBUG was defined, set d10v_debug.
+ Only initialize the hash table the first time sim_open is called.
* Makefile.in: Make objects depend on d10v_sim.h.
- ({,SIM_}CFLAGS): Include configure dependent switches.
+ ({,SIM_}CFLAGS): Include configure dependent switches. Setting
+ CFLAGS does not override host/target defines or SIM_CFLAGS.
+ (CC_FOR_BUILD,gencode): Use CC_FOR_BUILD to compile gencode.
+ (run): By default, the math library is not needed to be linked
+ in.
+ ({BFD,OPCODES,LIBIBERTY}_LIB): Define as variables so they can be
+ overridden.
* configure.in (--enable-sim-cflags): New switch to allow user to
set the defaults.
+ (CC_FOR_BUILD): Deal with canadian crosses.
* configure: Regenerate.
Wed Sep 04 04:45:34 1996 Mark Alexander <marka@cygnus.com>
diff --git a/sim/d10v/Makefile.in b/sim/d10v/Makefile.in
index ca9c100..c56321b 100644
--- a/sim/d10v/Makefile.in
+++ b/sim/d10v/Makefile.in
@@ -16,6 +16,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+default: all
+
VPATH = @srcdir@:@srcdir@/../common:@srcdir@/../../gdb/
srcdir = @srcdir@
srcroot = $(srcdir)/../..
@@ -56,11 +58,13 @@ INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1
AR = @AR@
AR_FLAGS = rc
CC = @CC@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
SIM_CFLAGS = @sim_cflags@
-CFLAGS = @CFLAGS@ @DEFS@ $(SIM_CFLAGS)
+CONFIG_CFLAGS = @DEFS@ $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHES) -DINSIDE_SIMULATOR
+BUILD_CFLAGS = -g -O $(CSEARCH)
MAKEINFO = makeinfo
RANLIB = @RANLIB@
-CC_FOR_BUILD = @CC_FOR_BUILD@
HDEFINES = @HDEFINES@
TDEFINES =
@@ -69,9 +73,11 @@ TDEFINES =
MAKEOVERRIDES=
#X=xstuff.o
-#XL=-lX11
+#X_LIB=-lX11
X=
-XL=
+X_LIB=
+MATH_LIB=
+
INCLUDE = d10v_sim.h
INCDIR = $(srcdir)/../../include
@@ -79,10 +85,14 @@ CSEARCH = -I. -I$(srcdir) -I../../include \
-I../../bfd -I$(INCDIR) -I$(srcdir)/../../bfd -I$(srcdir)/../../gdb -I$(srcdir)/../../newlib/libc/sys/d10v
DEP = mkdep
-all: run libsim.a
+LIBIBERTY_LIB = ../../libiberty/libiberty.a
+BFD_LIB = ../../bfd/libbfd.a
+OPCODES_LIB = ../../opcodes/libopcodes.a
+
+all: run libsim.a
-run: interp.o $(X) run.o table.o callback.o simops.o
- $(CC) $(CFLAGS) -o run $(X) interp.o table.o callback.o simops.o run.o ../../bfd/libbfd.a ../../libiberty/libiberty.a $(XL) -lm
+run: interp.o $(X) run.o table.o callback.o simops.o
+ $(CC) $(CFLAGS) $(CONFIG_CFLAGS) -o run $(X) interp.o table.o callback.o simops.o run.o $(BFD_LIB) $(LIBIBERTY_LIB) $(X_LIB) $(MATH_LIB)
interp.o:interp.c table.c $(INCLUDE)
run.o:run.c $(INCLUDE)
@@ -92,17 +102,17 @@ libsim.a:interp.o table.o simops.o
$(AR) $(ARFLAGS) libsim.a interp.o table.o simops.o
$(RANLIB) libsim.a
-simops.h: gencode
+simops.h: gencode
./gencode -h >$@
-table.c: gencode simops.h
+table.c: gencode simops.h
./gencode >$@
-gencode: gencode.c ../../opcodes/libopcodes.a $(INCLUDE)
- $(CC) $(CFLAGS) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHE) -o gencode $(srcdir)/gencode.c ../../opcodes/libopcodes.a -lc
+gencode: gencode.c ../../opcodes/libopcodes.a $(INCLUDE)
+ $(CC_FOR_BUILD) $(BUILD_CFLAGS) -o gencode $(srcdir)/gencode.c $(OPCODES_LIB)
.c.o:
- $(CC) -c -DINSIDE_SIMULATOR $(CFLAGS) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHES) $<
+ $(CC) -c $(CFLAGS) $(CONFIG_CFLAGS) $<
check:
diff --git a/sim/d10v/configure b/sim/d10v/configure
index 1b8ca99..9da9be6 100755
--- a/sim/d10v/configure
+++ b/sim/d10v/configure
@@ -932,6 +932,39 @@ EOF
fi
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+# If we cannot run a trivial program, we must be cross compiling.
+echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_cross=yes
+else
+cat > conftest.$ac_ext <<EOF
+#line 946 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+{ (eval echo configure:950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+ ac_cv_c_cross=no
+else
+ ac_cv_c_cross=yes
+fi
+fi
+rm -fr conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_cross" 1>&6
+cross_compiling=$ac_cv_c_cross
+
+if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+else
+ CC_FOR_BUILD=gcc
+fi
+
. ${srcdir}/../../bfd/configure.host
# Check whether --enable-sim-cflags or --disable-sim-cflags was given.
@@ -952,6 +985,7 @@ fi
+
AR=${AR-ar}
# Extract the first word of "ranlib", so it can be a program name with args.
@@ -994,11 +1028,11 @@ else
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
-#line 998 "configure"
+#line 1032 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-{ (eval echo configure:1002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
+{ (eval echo configure:1036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_cross=no
else
@@ -1165,11 +1199,11 @@ s%@build_os@%$build_os%g
s%@CC@%$CC%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
s%@HDEFINES@%$HDEFINES%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@sim_cflags@%$sim_cflags%g
-s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
CEOF
EOF
diff --git a/sim/d10v/configure.in b/sim/d10v/configure.in
index cd1700a..647255e 100644
--- a/sim/d10v/configure.in
+++ b/sim/d10v/configure.in
@@ -9,6 +9,14 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_C_BIGENDIAN
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+AC_C_CROSS
+if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+else
+ CC_FOR_BUILD=gcc
+fi
+
. ${srcdir}/../../bfd/configure.host
AC_ARG_ENABLE(sim-cflags,
@@ -23,6 +31,7 @@ if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
echo "Setting sim cflags = $sim_cflags" 6>&1
fi],[sim_cflags=""])dnl
+AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS)
AC_SUBST(HDEFINES)
AR=${AR-ar}
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index 1a1ede9..38b4d4c 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -291,26 +291,38 @@ sim_open (args)
{
struct simops *s;
struct hash_entry *h, *prev;
+ static int init_p = 0;
+
if (args != NULL)
- (*d10v_callback->printf_filtered) (d10v_callback, "sim_open %s\n",args);
+ {
+#ifdef DEBUG
+ if (strcmp (args, "-t") == 0)
+ d10v_debug = DEBUG;
+ else
+#endif
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unsupported option(s): %s\n",args);
+ }
/* put all the opcodes in the hash table */
- for (s = Simops; s->func; s++)
+ if (!init_p++)
{
- h = &hash_table[hash(s->opcode,s->format)];
-
- /* go to the last entry in the chain */
- while (h->next)
- h = h->next;
-
- if (h->ops)
+ for (s = Simops; s->func; s++)
{
- h->next = calloc(1,sizeof(struct hash_entry));
- h = h->next;
+ h = &hash_table[hash(s->opcode,s->format)];
+
+ /* go to the last entry in the chain */
+ while (h->next)
+ h = h->next;
+
+ if (h->ops)
+ {
+ h->next = calloc(1,sizeof(struct hash_entry));
+ h = h->next;
+ }
+ h->ops = s;
+ h->mask = s->mask;
+ h->opcode = s->opcode;
}
- h->ops = s;
- h->mask = s->mask;
- h->opcode = s->opcode;
}
}