From cf8d17a6ab9bbd43d1dfa4047b7d7d46a1354cc5 Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 24 Jan 2000 00:18:20 +0000 Subject: [PATCH] Handle systems that need underscores in symbols. --- configure.in | 42 ++++++++++++++++++++++++++++++++++++++++++ verilog.sh | 2 +- vvm/Makefile.in | 6 +++--- vvm/machine.h | 43 +++++++++++++++++++++++++++++++++++++++++++ vvm/vvm_calltf.cc | 8 ++++++-- 5 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 vvm/machine.h diff --git a/configure.in b/configure.in index a416d3bae..b12db9dae 100644 --- a/configure.in +++ b/configure.in @@ -7,5 +7,47 @@ AC_PROG_CXX AC_CHECK_TOOL(STRIP, strip, true) AC_CHECK_HEADERS(getopt.h) AC_PROG_INSTALL +AC_CHECK_LIB(dl,main,[DLLIB=-ldl]) +AC_SUBST(DLLIB) + +####################### +## test for underscores +####################### + +AC_MSG_CHECKING("for leading and/or trailing underscores") +cat << EOF > underscore.c + void underscore(void){} +EOF +$CC -c underscore.c > /dev/null 2>&1 + +CC_LEADING_UNDERSCORE=no +CC_TRAILING_UNDERSCORE=no + +output=`nm underscore.o|grep _underscore 2>&1` +if test ! -z "$output"; then + CC_LEADING_UNDERSCORE=yes + AC_DEFINE(NEED_LU) +fi + +output=`nm underscore.o|grep underscore_ 2>&1` +if test ! -z "$output"; then + CC_TRAILING_UNDERSCORE=yes + AC_DEFINE(NEED_TU) +fi + +if test "$CC_LEADING_UNDERSCORE" = yes; then + AC_DEFINE(WLU) +fi +if test "$CC_TRAILING_UNDERSCORE" = yes; then + AC_DEFINE(WTU) +fi + +rm underscore.c underscore.o + +AC_MSG_RESULT("$CC_LEADING_UNDERSCORE $CC_TRAILING_UNDERSCORE") + +####################### +## end of test for underscores +####################### AC_OUTPUT(Makefile vpi/Makefile ivlpp/Makefile vvm/Makefile) diff --git a/verilog.sh b/verilog.sh index ad37a093f..25a7219e4 100644 --- a/verilog.sh +++ b/verilog.sh @@ -116,7 +116,7 @@ case "${target}" in "xnf") mv ${tmpCCFile} ${outputFile} ;; - "vvm") ${execCpp} -rdynamic -I${includedir} -L${libdir} ${tmpCCFile} -o ${outputFile} -lvvm -ldl ; + "vvm") ${execCpp} -rdynamic -I${includedir} -L${libdir} ${tmpCCFile} -o ${outputFile} -lvvm @dlllib@ ; if test $? -ne 0 ; then echo "C++ compilation failed. Terminating compilation." rm -f ${tmpCCFile} diff --git a/vvm/Makefile.in b/vvm/Makefile.in index 1a1f3722a..eb8b4a619 100644 --- a/vvm/Makefile.in +++ b/vvm/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.17 2000/01/23 23:54:36 steve Exp $" +#ident "$Id: Makefile.in,v 1.18 2000/01/24 00:18:20 steve Exp $" # # SHELL = /bin/sh @@ -50,12 +50,12 @@ all: libvvm.a %.o dep/%.d: %.cc @[ -d dep ] || mkdir dep - $(CXX) -Wall -fno-exceptions $(CXXFLAGS) -MD -c $< -o $*.o + $(CXX) -Wall -fno-exceptions $(CPPFLAGS) $(CXXFLAGS) -MD -c $< -o $*.o mv $*.d dep %.o dep/%.d: %.c @[ -d dep ] || mkdir dep - $(CC) -Wall $(CFLAGS) -MD -c $< -o $*.o + $(CC) -Wall $(CPPFLAGS) $(CFLAGS) -MD -c $< -o $*.o mv $*.d dep O = vvm_bit.o vvm_calltf.o vvm_event.o vvm_gates.o vvm_mult.o \ diff --git a/vvm/machine.h b/vvm/machine.h new file mode 100644 index 000000000..a514346b6 --- /dev/null +++ b/vvm/machine.h @@ -0,0 +1,43 @@ +#ifndef __vvm_machine_H +#define __vvm_machine_H +/* + * Copyright (c) 2000 Stephen Williams (steve@icarus.com) + * + * This source code is free software; you can redistribute it + * and/or modify it in source code form under the terms of the GNU + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#if !defined(WINNT) +#ident "$Id: machine.h,v 1.1 2000/01/24 00:18:20 steve Exp $" +#endif + +#ifdef NEED_LU +#define LU "_" +#else +#define LU "" +#endif + +#ifdef NEED_TU +#define TU "_" +#else +#define TU "" +#endif + +/* + * $Log: machine.h,v $ + * Revision 1.1 2000/01/24 00:18:20 steve + * Handle systems that need underscores in symbols. + * + */ +#endif diff --git a/vvm/vvm_calltf.cc b/vvm/vvm_calltf.cc index af26c462a..4eed29288 100644 --- a/vvm/vvm_calltf.cc +++ b/vvm/vvm_calltf.cc @@ -17,9 +17,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vvm_calltf.cc,v 1.9 1999/11/28 18:05:37 steve Exp $" +#ident "$Id: vvm_calltf.cc,v 1.10 2000/01/24 00:18:20 steve Exp $" #endif +# include "machine.h" # include "vvm_calltf.h" # include # include "vpi_priv.h" @@ -99,7 +100,7 @@ void vvm_load_vpi_module(const char*name) return; } - void*table = dlsym(mod, "vlog_startup_routines"); + void*table = dlsym(mod, LU "vlog_startup_routines" TU); vlog_startup_routines_t*routines = (vlog_startup_routines_t*)table; if (routines == 0) { cerr << name << ": Unable to locate the vlog_startup_routines" @@ -116,6 +117,9 @@ void vvm_load_vpi_module(const char*name) /* * $Log: vvm_calltf.cc,v $ + * Revision 1.10 2000/01/24 00:18:20 steve + * Handle systems that need underscores in symbols. + * * Revision 1.9 1999/11/28 18:05:37 steve * Set VPI_MODULE_PATH in the target code, if desired. *