changeset 3842:07b99a1889cb

[project @ 2001-06-29 18:58:21 by jwe]
author jwe
date Fri, 29 Jun 2001 18:58:22 +0000
parents bbe74a066592
children f848bc60b927
files ChangeLog acconfig.h aclocal.m4 configure.in src/ChangeLog src/defun-int.h src/dynamic-ld.cc
diffstat 7 files changed, 77 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 27 02:29:04 2001 +0000
+++ b/ChangeLog	Fri Jun 29 18:58:22 2001 +0000
@@ -1,3 +1,10 @@
+2001-06-29  Mumit Khan  <khan@nanotech.wisc.edu>
+
+	* aclocal.m4 (OCTAVE_CXX_ABI): New macro.
+	(OCTAVE_CXX_PREPENDS_UNDERSCORE): Add missing return value.
+	* configure.in: Use.
+	* acconfig.h (CXX_ABI): New macro.
+
 2001-05-23  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* configure.in: Quote the call to AC_CHECK_FUNC inside the
--- a/acconfig.h	Wed Jun 27 02:29:04 2001 +0000
+++ b/acconfig.h	Fri Jun 29 18:58:22 2001 +0000
@@ -14,6 +14,9 @@
    internal array and matrix classes. */
 #undef BOUNDS_CHECKING
 
+/* Define to the C++ ABI your compiler uses.  */
+#undef CXX_ABI
+
 /* Define if your C++ runtime library is ISO compliant. */
 #undef CXX_ISO_COMPLIANT_LIBRARY
 
--- a/aclocal.m4	Wed Jun 27 02:29:04 2001 +0000
+++ b/aclocal.m4	Fri Jun 29 18:58:22 2001 +0000
@@ -913,7 +913,7 @@
     AC_LANG_SAVE
     AC_LANG_CPLUSPLUS
     cat > conftest.$ac_ext <<EOF
-bool FSmy_dld_fcn (void) { }
+bool FSmy_dld_fcn (void) { return false; }
 EOF
     if AC_TRY_EVAL(ac_compile); then
       if test "`${NM-nm} conftest.o | grep _FSmy_dld_fcn`" != ""; then
@@ -990,3 +990,41 @@
     ])
   fi
 ])
+dnl
+dnl Determine the C++ compiler ABI. It sets the macro CXX_ABI to the
+dnl name of the ABI, and is used to mangle the C linkage loadable
+dnl functions to avoid ABI mismatch.  GNU C++ currently uses gnu_v2 
+dnl (GCC versions <= 2.95.x) dnl or gnu_v3 (GCC versions >= 3.0).
+dnl Set to "unknown" is when we don't know enough about the ABI, which 
+dnl will happen when using an unsupported C++ compiler. 
+dnl
+dnl OCTAVE_CXX_ABI
+AC_DEFUN(OCTAVE_CXX_ABI,
+[AC_MSG_CHECKING([C++ ABI version used by ${CXX}])
+  AC_CACHE_VAL(octave_cv_cxx_abi,
+    [octave_cv_cxx_abi='unknown'
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    cat > conftest.$ac_ext <<EOF
+bool FSmy_dld_fcn (void) { return false; }
+EOF
+    if AC_TRY_EVAL(ac_compile); then
+      if test "`${NM-nm} conftest.o | grep FSmy_dld_fcn__Fv`" != ""; then
+        octave_cv_cxx_abi='gnu_v2'
+      fi
+      if test "`${NM-nm} conftest.o | grep _Z12FSmy_dld_fcnv`" != ""; then
+        octave_cv_cxx_abi='gnu_v3'
+      fi
+      if test "`${NM-nm} conftest.o | grep __1cMFSmy_dld_fcn6F_b_`" != ""; then
+        octave_cv_cxx_abi='sun'
+      fi
+    else
+      echo "configure: failed program was:" >&AC_FD_CC
+      cat conftest.$ac_ext >&AC_FD_CC
+    fi
+    AC_LANG_RESTORE
+  ])
+  AC_MSG_RESULT($octave_cv_cxx_abi)
+  AC_DEFINE_UNQUOTED(CXX_ABI, $octave_cv_cxx_abi)
+])
+
--- a/configure.in	Wed Jun 27 02:29:04 2001 +0000
+++ b/configure.in	Fri Jun 29 18:58:22 2001 +0000
@@ -21,7 +21,7 @@
 ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 ### 02111-1307, USA. 
 
-AC_REVISION($Revision: 1.348 $)
+AC_REVISION($Revision: 1.349 $)
 AC_PREREQ(2.9)
 AC_INIT(src/octave.cc)
 AC_CONFIG_HEADER(config.h)
@@ -194,6 +194,11 @@
 OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL
 OCTAVE_CXX_ISO_COMPLIANT_LIBRARY
 
+# Determine the ABI used the C++ compiler, needed by the dynamic loading
+# code. Currently supported ABIs are GNU v2, GNU v3 and Sun Workshop.
+
+OCTAVE_CXX_ABI
+
 ### See which C compiler to use (we expect to find gcc).
 
 EXTERN_CFLAGS="$CFLAGS"
--- a/src/ChangeLog	Wed Jun 27 02:29:04 2001 +0000
+++ b/src/ChangeLog	Fri Jun 29 18:58:22 2001 +0000
@@ -1,3 +1,11 @@
+2001-06-29  Mumit Khan  <khan@nanotech.wisc.edu>
+
+	* defun-int.h (DEFINE_FUN_INSTALLER_FUN{2,3}): New macros.
+	(DEFINE_FUN_INSTALLER_FUN): Use.
+	* dynamic-ld.cc ({STRINGIFY, STRINGIFY1}): New macros.
+	(octave_dynamic_loader::mangle_name): Support dynamic linking
+	for GNU v3 and Sun C++ ABI.
+
 2001-06-26  Mumit Khan  <khan@nanotech.wisc.edu>
 
 	* c-file-ptr-stream.h (c_file_ptr_buf::c_file_ptr_buf): Add GCC3
--- a/src/defun-int.h	Wed Jun 27 02:29:04 2001 +0000
+++ b/src/defun-int.h	Fri Jun 29 18:58:22 2001 +0000
@@ -76,14 +76,22 @@
 typedef bool (*octave_dld_fcn_installer) (const octave_shlib&);
 
 #define DEFINE_FUN_INSTALLER_FUN(name, doc) \
+  DEFINE_FUN_INSTALLER_FUN2(name, doc, CXX_ABI)
+
+#define DEFINE_FUN_INSTALLER_FUN2(name, doc, cxx_abi) \
+  DEFINE_FUN_INSTALLER_FUN3(name, doc, cxx_abi)
+
+#define DEFINE_FUN_INSTALLER_FUN3(name, doc, cxx_abi) \
+  extern "C" \
   bool \
-  FS ## name (const octave_shlib& shl) \
+  FS ## name ## _ ## cxx_abi (const octave_shlib& shl) \
   { \
     check_version (OCTAVE_VERSION, #name); \
     install_dld_function (F ## name, #name, shl, doc); \
     return error_state ? false : true; \
   }
 
+
 // MAKE_BUILTINS is defined to extract function names and related
 // information and create the *.df files that are eventually used to
 // create the builtins.cc file.
--- a/src/dynamic-ld.cc	Wed Jun 27 02:29:04 2001 +0000
+++ b/src/dynamic-ld.cc	Fri Jun 29 18:58:22 2001 +0000
@@ -308,6 +308,9 @@
   return (instance_ok ()) ? instance->do_remove (fcn_name, shl) : false;
 }
 
+#define STRINGIFY(s) STRINGIFY1(s)
+#define STRINGIFY1(s) #s
+
 std::string
 octave_dynamic_loader::mangle_name (const std::string& name)
 {
@@ -317,7 +320,8 @@
   std::string retval ("FS");
 #endif
   retval.append (name);
-  retval.append ("__FRC12octave_shlib");
+  retval.append ("_");
+  retval.append (STRINGIFY (CXX_ABI));
   return retval;
 }