changeset 26604:10b824cf2b18

remove support for shared libraries with dyld and shl_load Loading shared libraries with the shl_load (HP-UX) and dyld (Mac OS) APIs is no longer supported. * configure.ac: Don't check for shl_load or dyld interfaces. * oct-shlib.cc (octave_shl_load_shlib, octave_dyld_shlib): Delete classes.
author John W. Eaton <jwe@octave.org>
date Tue, 22 Jan 2019 23:27:43 +0000
parents 5ab12183280d
children 5224600b1b20
files configure.ac liboctave/util/oct-shlib.cc
diffstat 2 files changed, 0 insertions(+), 209 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Tue Jan 22 13:45:45 2019 -0800
+++ b/configure.ac	Tue Jan 22 23:27:43 2019 +0000
@@ -850,9 +850,7 @@
 RDYNAMIC_FLAG=
 DL_API_MSG=""
 dlopen_api=no
-shl_load_api=no
 loadlibrary_api=no
-dyld_api=no
 
 case $lt_cv_dlopen in
   dlopen)
@@ -862,24 +860,12 @@
       [Define to 1 if system has dlopen, dlsym, dlerror, and dlclose for dynamic linking.])
     OCTAVE_CXX_FLAG([-rdynamic], [RDYNAMIC_FLAG=-rdynamic])
   ;;
-  shl_load)
-    shl_load_api=yes
-    DL_API_MSG="shl_load"
-    AC_DEFINE(HAVE_SHL_LOAD_API, 1,
-      [Define to 1 if system has shl_load and shl_findsym for dynamic linking.])
-  ;;
   LoadLibrary)
     loadlibrary_api=yes
     DL_API_MSG="LoadLibrary"
     AC_DEFINE(HAVE_LOADLIBRARY_API, 1,
       [Define to 1 if system has LoadLibrary for dynamic linking.])
   ;;
-  dyld)
-    dyld_api=yes
-    DL_API_MSG="dyld"
-    AC_DEFINE(HAVE_DYLD_API, 1,
-      [Define to 1 if system has dyld for dynamic linking.])
-  ;;
   *)
     AC_MSG_ERROR([Octave requires some way to perform dynamic linking.])
   ;;
--- a/liboctave/util/oct-shlib.cc	Tue Jan 22 13:45:45 2019 -0800
+++ b/liboctave/util/oct-shlib.cc	Tue Jan 22 23:27:43 2019 +0000
@@ -27,15 +27,6 @@
 
 #include <map>
 
-#if defined (HAVE_SHL_LOAD_API)
-#  include <cerrno>
-#  include <cstring>
-#endif
-
-#if defined (HAVE_DYLD_API)
-#  include <mach-o/dyld.h>
-#endif
-
 extern "C"
 {
 #if defined (HAVE_DLOPEN_API)
@@ -47,8 +38,6 @@
 extern void * dlsym (void *, const char *);
 extern int dlclose (void *);
 #  endif
-#elif defined (HAVE_SHL_LOAD_API)
-#  include <dl.h>
 #elif defined (HAVE_LOADLIBRARY_API)
 #  define WIN32_LEAN_AND_MEAN 1
 #  include <windows.h>
@@ -265,84 +254,6 @@
     return function;
   }
 
-#elif defined (HAVE_SHL_LOAD_API)
-
-  class
-  octave_shl_load_shlib : public dynamic_library::dynlib_rep
-  {
-  public:
-
-    octave_shl_load_shlib (const std::string& f);
-
-    // No copying!
-
-    octave_shl_load_shlib (const octave_shl_load_shlib&) = delete;
-
-    octave_shl_load_shlib& operator = (const octave_shl_load_shlib&) = delete;
-
-    ~octave_shl_load_shlib (void);
-
-    void * search (const std::string& name,
-                   dynamic_library::name_mangler mangler = 0);
-
-    bool is_open (void) const { return (search_all_loaded || library != 0); }
-
-  private:
-
-    shl_t library;
-  };
-
-  octave_shl_load_shlib::octave_shl_load_shlib (const std::string& f)
-    : dynamic_library::dynlib_rep (f), library (0)
-  {
-    file = f;
-
-    if (file.empty())
-      {
-        search_all_loaded = true;
-        return;
-      }
-
-    library = shl_load (file.c_str (), BIND_IMMEDIATE, 0L);
-
-    if (! library)
-      {
-        using namespace std;  // FIXME: Why have this line?
-        (*current_liboctave_error_handler) ("%s", std::strerror (errno));
-      }
-  }
-
-  octave_shl_load_shlib::~octave_shl_load_shlib (void)
-  {
-    if (library)
-      shl_unload (library);
-  }
-
-  void *
-  octave_shl_load_shlib::search (const std::string& name,
-                                 dynamic_library::name_mangler mangler)
-  {
-    void *function = nullptr;
-
-    if (! is_open ())
-      (*current_liboctave_error_handler)
-        ("shared library %s is not open", file.c_str ());
-
-    std::string sym_name = name;
-
-    if (mangler)
-      sym_name = mangler (name);
-
-    if (search_all_loaded)
-      int status = shl_findsym (nullptr, sym_name.c_str (),
-                                TYPE_UNDEFINED, &function);
-    else
-      int status = shl_findsym (&library, sym_name.c_str (),
-                                TYPE_UNDEFINED, &function);
-
-    return function;
-  }
-
 #elif defined (HAVE_LOADLIBRARY_API)
 
   class
@@ -503,108 +414,6 @@
     return function;
   }
 
-#elif defined (HAVE_DYLD_API)
-
-  class
-  octave_dyld_shlib : public dynamic_library::dynlib_rep
-  {
-  public:
-
-    octave_dyld_shlib (void);
-
-    // No copying!
-
-    octave_dyld_shlib (const octave_dyld_shlib&) = delete;
-
-    octave_dyld_shlib& operator = (const octave_dyld_shlib&) = delete;
-
-    ~octave_dyld_shlib (void);
-
-    void open (const std::string& f);
-
-    void * search (const std::string& name,
-                   dynamic_library::name_mangler mangler = nullptr);
-
-    void close (void);
-
-    bool is_open (void) const { return (search_all_loaded || handle != 0); }
-
-  private:
-
-    NSObjectFileImage img;
-    NSModule handle;
-  };
-
-  octave_dyld_shlib::octave_dyld_shlib (const std::string& f)
-    : dynamic_library::dynlib_rep (f), handle (0)
-  {
-    if (f.empty ())
-      (*current_liboctave_error_handler)
-        ("global search is not implemented for DYLD_API");
-
-    int returnCode = NSCreateObjectFileImageFromFile (file.c_str (), &img);
-
-    if (NSObjectFileImageSuccess != returnCode)
-      {
-        (*current_liboctave_error_handler)
-          ("got NSObjectFileImageReturnCode %d", returnCode);
-
-        // FIXME: should use NSLinkEditError () to get
-        //        more info on what went wrong.
-      }
-
-    handle = NSLinkModule (img, file.c_str (),
-                           (NSLINKMODULE_OPTION_RETURN_ON_ERROR
-                            | NSLINKMODULE_OPTION_PRIVATE));
-    if (! handle)
-      {
-        NSLinkEditErrors ler;
-        int lerno;
-        const char *file2;
-        const char *errstr = nullptr;
-
-        NSLinkEditError (&ler, &lerno, &file2, &errstr);
-
-        if (! errstr)
-          errstr = "unspecified error";
-
-        (*current_liboctave_error_handler) ("%s: %s", file.c_str (), errstr);
-      }
-  }
-
-  octave_dyld_shlib::~octave_dyld_shlib (void)
-  {
-    if (handle)
-      NSUnLinkModule (handle, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES);
-
-    NSDestroyObjectFileImage (img);
-  }
-
-  void *
-  octave_dyld_shlib::search (const std::string& name,
-                             dynamic_library::name_mangler mangler)
-  {
-    void *function = nullptr;
-
-    if (! is_open ())
-      (*current_liboctave_error_handler)
-        ("bundle %s is not open", file.c_str ());
-
-    std::string sym_name = name;
-
-    if (mangler)
-      sym_name = mangler (name);
-
-    NSSymbol symbol = NSLookupSymbolInModule (handle, sym_name.c_str ());
-
-    if (symbol)
-      {
-        function = NSAddressOfSymbol (symbol);
-      }
-
-    return function;
-  }
-
 #endif
 
   dynamic_library::dynlib_rep *
@@ -612,12 +421,8 @@
   {
 #if defined (HAVE_DLOPEN_API)
     return new octave_dlopen_shlib (f);
-#elif defined (HAVE_SHL_LOAD_API)
-    return new octave_shl_load_shlib (f);
 #elif defined (HAVE_LOADLIBRARY_API)
     return new octave_w32_shlib (f);
-#elif defined (HAVE_DYLD_API)
-    return new octave_dyld_shlib (f);
 #else
     (*current_liboctave_error_handler)
       ("support for dynamically loaded libraries was unavailable or disabled when liboctave was built");