[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
libtool--gary--1.0--patch-7
From: |
Gary V. Vaughan |
Subject: |
libtool--gary--1.0--patch-7 |
Date: |
Thu, 8 Apr 2004 00:15:22 +0100 (BST) |
User-agent: |
mailnotify/0.3 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Okay to commit?
http://tkd.kicks-ass.net/arch/address@hidden/libtool--gary--1.0--patch-7
- --
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
_________________________________________________________
This patch notification generated by tlaapply version 0.4
http://tkd.kicks-ass.net/arch/address@hidden/cvs-utils--arch--1.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)
iD8DBQFAdIuJFRMICSmD1gYRAtPpAJ95eJlsDpYvbnVhyTpPE5/ya4EnngCeN+qP
zUDDGr8hdaRce1IqhYFTpUY=
=WahN
-----END PGP SIGNATURE-----
* looking for address@hidden/libtool--gary--1.0--patch-6 to compare with
* comparing to address@hidden/libtool--gary--1.0--patch-6
A libltdl/.arch-ids/loader-dld_link.c.id
A libltdl/.arch-ids/loader-dlopen.c.id
A libltdl/.arch-ids/loader-dyld.c.id
A libltdl/.arch-ids/loader-load_add_on.c.id
A libltdl/.arch-ids/loader-loadlibrary.c.id
A libltdl/.arch-ids/loader-preopen.c.id
A libltdl/.arch-ids/loader-shl_load.c.id
A libltdl/.arch-ids/lt_dlloader.h.id
A libltdl/loader-dld_link.c
A libltdl/loader-dlopen.c
A libltdl/loader-dyld.c
A libltdl/loader-load_add_on.c
A libltdl/loader-loadlibrary.c
A libltdl/loader-preopen.c
A libltdl/loader-shl_load.c
A libltdl/lt_dlloader.h
M ChangeLog
M tests/depdemo/Makefile.am
M tests/f77demo/Makefile.am
M tests/mdemo/Makefile.am
M tests/mdemo2/Makefile.am
M tests/pdemo/Makefile.am
M tests/tagdemo/Makefile.am
M libltdl/Makefile.am
M libltdl/ltdl.c
M libltdl/ltdl.h
M m4/ltdl.m4
M tests/cdemo/Makefile.am
M tests/demo/Makefile.am
M libltdl/lt__alloc.h
M libltdl/lt_system.h
* modified files
Index: Changelog
from Gary V. Vaughan <address@hidden>
Factor out the individual loaders, in preparation for preloading
them as libtool modules. Currently loader-preopen.c is linked
unconditionally and other appropriate loaders discovered by
AC_LTDL_DLLIB are built and linked in:
* libltdl/Makefile.am (libltdl_la_SOURCES): Add loader-preopen
module.
* m4/ltdl.m4 (AC_LTDL_DLLIB): Use AC_LIBOBJ to add appropriate
loaders to libltdl.
* libltdl/lt_system.h (LT_SCOPE): Moved to here.
* libltdl/ltdl.h (lt_dlloader, lt_user_data, lt_module)
(lt_module_open, lt_module_close, lt_find_sym, lt_dlloader_exit)
(struct lt_user_dlloader, lt_dlloader_next, lt_dlloader_find)
(lt_dlloader_name, lt_dlloader_data, lt_dlloader_add)
(lt_dlloader_remove): Moved declarations...
* libltdl/lt_loader.h: ...to here.
* libltdl/ltdl.c: Include lt_loader.h. Move loader implementation
code from here...
* libltdl/loader-dld_link.c, libltdl/loader-dlopen.c,
libltdl/loader-dyld.c, libltdl/loader-load_add_on.c,
libltdl/loader-loadlibrary.c, libltdl/loader-preopen.c,
libltdl/loader-shl_load.c: ...to here.
* tests/cdemo/Makefile.am, tests/demo/Makefile.am,
tests/depdemo/Makefile.am, tests/f77demo/Makefile.am,
tests/mdemo/Makefile.am, tests/mdemo2/Makefile.am,
tests/pdemo/Makefile.am, tests/tagdemo/Makefile.am (AM_CPPFLAGS):
Add -I$(top_srcdir)/../.. so that libltdl include files can be
written as #include <libltdl/lt_dlloader.h> and found correctly.
--- orig/libltdl/Makefile.am
+++ mod/libltdl/Makefile.am
@@ -39,6 +39,7 @@
CLEANFILES = libltdl.la libltdlc.la
libltdl_la_SOURCES = ltdl.h ltdl.c \
+ loader-preopen.c \
lt_error.h lt_error.c lt_mutex.h lt_mutex.c \
lt__private.h lt__alloc.h lt__alloc.c \
lt__pre89.h lt__glibc.h argz.h lt__dirent.h \
--- orig/libltdl/lt__alloc.h
+++ mod/libltdl/lt__alloc.h
@@ -1,4 +1,4 @@
-/* lt__alloc.c -- internal memory management interface
+/* lt__alloc.h -- internal memory management interface
Copyright (C) 2004 Free Software Foundation, Inc.
Originally by Gary V. Vaughan <address@hidden>
--- orig/libltdl/lt_system.h
+++ mod/libltdl/lt_system.h
@@ -110,6 +110,21 @@
# endif
#endif
+/* DLL building support on win32 hosts; mostly to workaround their
+ ridiculous implementation of data symbol exporting. */
+#ifndef LT_SCOPE
+# ifdef __WINDOWS__
+# ifdef DLL_EXPORT /* defined by libtool (if required) */
+# define LT_SCOPE __declspec(dllexport)
+# endif
+# ifdef LIBLTDL_DLL_IMPORT /* define if linking with this dll */
+# define LT_SCOPE extern __declspec(dllimport)
+# endif
+# endif
+# ifndef LT_SCOPE /* static linking or !__WINDOWS__ */
+# define LT_SCOPE extern
+# endif
+#endif
#ifdef __WINDOWS__
/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
--- orig/libltdl/ltdl.c
+++ mod/libltdl/ltdl.c
@@ -27,6 +27,7 @@
*/
+#include "lt_dlloader.h"
#include "lt__private.h"
@@ -118,1016 +119,29 @@
-
-/* --- DLOPEN() INTERFACE LOADER --- */
-
+/* --- DLLOADER VIRTUAL FUNCTION TABLES --- */
#if HAVE_LIBDL
-
-/* dynamic linking with dlopen/dlsym */
-
-#if HAVE_DLFCN_H
-# include <dlfcn.h>
-#endif
-
-#if HAVE_SYS_DL_H
-# include <sys/dl.h>
-#endif
-
-/* We may have to define LT_LAZY_OR_NOW in the command line if we
- find out it does not work in some platform. */
-#ifndef LT_LAZY_OR_NOW
-# ifdef RTLD_LAZY
-# define LT_LAZY_OR_NOW RTLD_LAZY
-# else
-# ifdef DL_LAZY
-# define LT_LAZY_OR_NOW DL_LAZY
-# endif
-# endif /* !RTLD_LAZY */
+LT_SCOPE struct lt_user_dlloader lt__sys_dl;
#endif
-#ifndef LT_LAZY_OR_NOW
-# ifdef RTLD_NOW
-# define LT_LAZY_OR_NOW RTLD_NOW
-# else
-# ifdef DL_NOW
-# define LT_LAZY_OR_NOW DL_NOW
-# endif
-# endif /* !RTLD_NOW */
-#endif
-#ifndef LT_LAZY_OR_NOW
-# define LT_LAZY_OR_NOW 0
-#endif /* !LT_LAZY_OR_NOW */
-
-#if HAVE_DLERROR
-# define DLERROR(arg) dlerror ()
-#else
-# define DLERROR(arg) LT__STRERROR (arg)
-#endif
-
-static lt_module
-sys_dl_open (lt_user_data loader_data, const char *filename)
-{
- lt_module module = dlopen (filename, LT_LAZY_OR_NOW);
-
- if (!module)
- {
- LT__MUTEX_SETERRORSTR (DLERROR (CANNOT_OPEN));
- }
-
- return module;
-}
-
-static int
-sys_dl_close (lt_user_data loader_data, lt_module module)
-{
- int errors = 0;
-
- if (dlclose (module) != 0)
- {
- LT__MUTEX_SETERRORSTR (DLERROR (CANNOT_CLOSE));
- ++errors;
- }
-
- return errors;
-}
-
-static void *
-sys_dl_sym (lt_user_data loader_data, lt_module module, const char *symbol)
-{
- void *address = dlsym (module, symbol);
-
- if (!address)
- {
- LT__MUTEX_SETERRORSTR (DLERROR (SYMBOL_NOT_FOUND));
- }
-
- return address;
-}
-
-static struct lt_user_dlloader sys_dl =
- {
-# ifdef NEED_USCORE
- "_",
-# else
- 0,
-# endif
- sys_dl_open, sys_dl_close, sys_dl_sym, 0, 0 };
-
-
-#endif /* HAVE_LIBDL */
-
-
-
-/* --- SHL_LOAD() INTERFACE LOADER --- */
-
#if HAVE_SHL_LOAD
-
-/* dynamic linking with shl_load (HP-UX) (comments from gmodule) */
-
-#ifdef HAVE_DL_H
-# include <dl.h>
+LT_SCOPE struct lt_user_dlloader lt__sys_shl;
#endif
-
-/* some flags are missing on some systems, so we provide
- * harmless defaults.
- *
- * Mandatory:
- * BIND_IMMEDIATE - Resolve symbol references when the library is loaded.
- * BIND_DEFERRED - Delay code symbol resolution until actual reference.
- *
- * Optionally:
- * BIND_FIRST - Place the library at the head of the symbol search
- * order.
- * BIND_NONFATAL - The default BIND_IMMEDIATE behavior is to treat all
- * unsatisfied symbols as fatal. This flag allows
- * binding of unsatisfied code symbols to be deferred
- * until use.
- * [Perl: For certain libraries, like DCE, deferred
- * binding often causes run time problems. Adding
- * BIND_NONFATAL to BIND_IMMEDIATE still allows
- * unresolved references in situations like this.]
- * BIND_NOSTART - Do not call the initializer for the shared library
- * when the library is loaded, nor on a future call to
- * shl_unload().
- * BIND_VERBOSE - Print verbose messages concerning possible
- * unsatisfied symbols.
- *
- * hp9000s700/hp9000s800:
- * BIND_RESTRICTED - Restrict symbols visible by the library to those
- * present at library load time.
- * DYNAMIC_PATH - Allow the loader to dynamically search for the
- * library specified by the path argument.
- */
-
-#ifndef DYNAMIC_PATH
-# define DYNAMIC_PATH 0
-#endif
-#ifndef BIND_RESTRICTED
-# define BIND_RESTRICTED 0
-#endif
-
-#define LT_BIND_FLAGS (BIND_IMMEDIATE | BIND_NONFATAL | DYNAMIC_PATH)
-
-static lt_module
-sys_shl_open (lt_user_data loader_data, const char *filenam)
-{
- static shl_t self = (shl_t) 0;
- lt_module module = shl_load (filename, LT_BIND_FLAGS, 0L);
-
- /* Since searching for a symbol against a NULL module handle will also
- look in everything else that was already loaded and exported with
- the -E compiler flag, we always cache a handle saved before any
- modules are loaded. */
- if (!self)
- {
- void *address;
- shl_findsym (&self, "main", TYPE_UNDEFINED, &address);
- }
-
- if (!filename)
- {
- module = self;
- }
- else
- {
- module = shl_load (filename, LT_BIND_FLAGS, 0L);
-
- if (!module)
- {
- LT__MUTEX_SETERROR (CANNOT_OPEN);
- }
- }
-
- return module;
-}
-
-static int
-sys_shl_close (lt_user_data loader_data, lt_module module)
-{
- int errors = 0;
-
- if (module && (shl_unload ((shl_t) (module)) != 0))
- {
- LT__MUTEX_SETERROR (CANNOT_CLOSE);
- ++errors;
- }
-
- return errors;
-}
-
-static void *
-sys_shl_sym (lt_user_data loader_data, lt_module module, const char *symbol)
-{
- void *address = 0;
-
- /* sys_shl_open should never return a NULL module handle */
- if (module == (lt_module) 0)
- {
- LT__MUTEX_SETERROR (INVALID_HANDLE);
- }
- else if (!shl_findsym((shl_t*) &module, symbol, TYPE_UNDEFINED, &address))
- {
- if (!address)
- {
- LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
- }
- }
-
- return address;
-}
-
-static struct lt_user_dlloader sys_shl = {
- 0, sys_shl_open, sys_shl_close, sys_shl_sym, 0, 0
-};
-
-#endif /* HAVE_SHL_LOAD */
-
-
-
-
-/* --- LOADLIBRARY() INTERFACE LOADER --- */
-
#if defined(__WINDOWS__) || defined(__CYGWIN__)
-
-/* dynamic linking for Win32 */
-
-#include <windows.h>
-
-/* Forward declaration; required to implement handle search below. */
-static lt_dlhandle handles;
-
-static lt_module
-sys_wll_open (lt_user_data loader_data, const char *filename)
-{
- lt_dlhandle cur;
- lt_module module = 0;
- const char *errormsg = 0;
- char *searchname = 0;
- char *ext;
- char self_name_buf[MAX_PATH];
-
- if (!filename)
- {
- /* Get the name of main module */
- *self_name_buf = 0;
- GetModuleFileName (NULL, self_name_buf, sizeof (self_name_buf));
- filename = ext = self_name_buf;
- }
- else
- {
- ext = strrchr (filename, '.');
- }
-
- if (ext)
- {
- /* FILENAME already has an extension. */
- searchname = lt__strdup (filename);
- }
- else
- {
- /* Append a `.' to stop Windows from adding an
- implicit `.dll' extension. */
- searchname = MALLOC (char, 2+ LT_STRLEN (filename));
- if (searchname)
- sprintf (searchname, "%s.", filename);
- }
- if (!searchname)
- return 0;
-
-#if __CYGWIN__
- {
- char wpath[MAX_PATH];
- cygwin_conv_to_full_win32_path(searchname, wpath);
- module = LoadLibrary(wpath);
- }
-#else
- module = LoadLibrary (searchname);
+LT_SCOPE struct lt_user_dlloader lt__sys_wll;
#endif
- FREE (searchname);
-
- /* libltdl expects this function to fail if it is unable
- to physically load the library. Sadly, LoadLibrary
- will search the loaded libraries for a match and return
- one of them if the path search load fails.
-
- We check whether LoadLibrary is returning a handle to
- an already loaded module, and simulate failure if we
- find one. */
- LT__MUTEX_LOCK ();
- cur = handles;
- while (cur)
- {
- if (!cur->module)
- {
- cur = 0;
- break;
- }
-
- if (cur->module == module)
- {
- break;
- }
-
- cur = cur->next;
- }
- LT__MUTEX_UNLOCK ();
-
- if (cur || !module)
- {
- LT__MUTEX_SETERROR (CANNOT_OPEN);
- module = 0;
- }
-
- return module;
-}
-
-static int
-sys_wll_close (lt_user_data loader_data, lt_module module)
-{
- int errors = 0;
-
- if (FreeLibrary(module) == 0)
- {
- LT__MUTEX_SETERROR (CANNOT_CLOSE);
- ++errors;
- }
-
- return errors;
-}
-
-static void *
-sys_wll_sym (lt_user_data loader_data, lt_module module,const char *symbol)
-{
- void * address = GetProcAddress (module, symbol);
-
- if (!address)
- {
- LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
- }
-
- return address;
-}
-
-static struct lt_user_dlloader sys_wll = {
- 0, sys_wll_open, sys_wll_close, sys_wll_sym, 0, 0
-};
-
-#endif /* __WINDOWS__ */
-
-
-
-
-/* --- LOAD_ADD_ON() INTERFACE LOADER --- */
-
-
#ifdef __BEOS__
-
-/* dynamic linking for BeOS */
-
-#include <kernel/image.h>
-
-static lt_module
-sys_bedl_open (lt_user_data loader_data, const char *filename)
-{
- image_id image = 0;
-
- if (filename)
- {
- image = load_add_on (filename);
- }
- else
- {
- image_info info;
- int32 cookie = 0;
- if (get_next_image_info (0, &cookie, &info) == B_OK)
- image = load_add_on (info.name);
- }
-
- if (image <= 0)
- {
- LT__MUTEX_SETERROR (CANNOT_OPEN);
- image = 0;
- }
-
- return (lt_module) image;
-}
-
-static int
-sys_bedl_close (lt_user_data loader_data, lt_module module)
-{
- int errors = 0;
-
- if (unload_add_on ((image_id) module) != B_OK)
- {
- LT__MUTEX_SETERROR (CANNOT_CLOSE);
- ++errors;
- }
-
- return errors;
-}
-
-static void *
-sys_bedl_sym (lt_user_data loader_data, lt_module module, const char *symbol)
-{
- void *address = 0;
- image_id image = (image_id) module;
-
- if (get_image_symbol (image, symbol, B_SYMBOL_TYPE_ANY, address) != B_OK)
- {
- LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
- address = 0;
- }
-
- return address;
-}
-
-static struct lt_user_dlloader sys_bedl = {
- 0, sys_bedl_open, sys_bedl_close, sys_bedl_sym, 0, 0
-};
-
-#endif /* __BEOS__ */
-
-
-
-
-/* --- DLD_LINK() INTERFACE LOADER --- */
-
-
+LT_SCOPE struct lt_user_dlloader lt__sys_bedl;
+#endif
#if HAVE_DLD
-
-/* dynamic linking with dld */
-
-#if HAVE_DLD_H
-#include <dld.h>
+LT_SCOPE struct lt_user_dlloader lt__sys_dld;
#endif
-
-static lt_module
-sys_dld_open (lt_user_data loader_data, const char *filename)
-{
- lt_module module = lt__strdup (filename);
-
- if (dld_link (filename) != 0)
- {
- LT__MUTEX_SETERROR (CANNOT_OPEN);
- FREE (module);
- }
-
- return module;
-}
-
-static int
-sys_dld_close (lt_user_data loader_data, lt_module module)a
-{
- int errors = 0;
-
- if (dld_unlink_by_file ((char*)(module), 1) != 0)
- {
- LT__MUTEX_SETERROR (CANNOT_CLOSE);
- ++errors;
- }
- else
- {
- FREE (module);
- }
-
- return errors;
-}
-
-static void *
-sys_dld_sym (lt_user_data loader_data, lt_module module, const char *symbol)
-{
- void *address = dld_get_func (symbol);
-
- if (!address)
- {
- LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
- }
-
- return address;
-}
-
-static struct lt_user_dlloader sys_dld = {
- 0, sys_dld_open, sys_dld_close, sys_dld_sym, 0, 0
-};
-
-#endif /* HAVE_DLD */
-
-/* --- DYLD() MACOSX/DARWIN INTERFACE LOADER --- */
#if HAVE_DYLD
-
-
-#if HAVE_MACH_O_DYLD_H
-#if !defined(__APPLE_CC__) && !defined(__MWERKS__) &&
!defined(__private_extern__)
-/* Is this correct? Does it still function properly? */
-#define __private_extern__ extern
-#endif
-# include <mach-o/dyld.h>
-#endif
-#include <mach-o/getsect.h>
-
-/* We have to put some stuff here that isn't in older dyld.h files */
-#ifndef ENUM_DYLD_BOOL
-# define ENUM_DYLD_BOOL
-# undef FALSE
-# undef TRUE
- enum DYLD_BOOL {
- FALSE,
- TRUE
- };
-#endif
-#ifndef LC_REQ_DYLD
-# define LC_REQ_DYLD 0x80000000
-#endif
-#ifndef LC_LOAD_WEAK_DYLIB
-# define LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD)
-#endif
-static const struct mach_header * (*ltdl_NSAddImage)(const char *image_name,
unsigned long options) = 0;
-static NSSymbol (*ltdl_NSLookupSymbolInImage)(const struct mach_header
*image,const char *symbolName, unsigned long options) = 0;
-static enum DYLD_BOOL (*ltdl_NSIsSymbolNameDefinedInImage)(const struct
mach_header *image, const char *symbolName) = 0;
-static enum DYLD_BOOL (*ltdl_NSMakePrivateModulePublic)(NSModule module) = 0;
-
-#ifndef NSADDIMAGE_OPTION_NONE
-#define NSADDIMAGE_OPTION_NONE 0x0
-#endif
-#ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR
-#define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1
-#endif
-#ifndef NSADDIMAGE_OPTION_WITH_SEARCHING
-#define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2
-#endif
-#ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
-#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4
-#endif
-#ifndef NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME
-#define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8
-#endif
-#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
-#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0
-#endif
-#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW
-#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1
-#endif
-#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY
-#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY 0x2
-#endif
-#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
-#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
-#endif
-
-
-static const char *
-lt_int_dyld_error(char* othererror)
-{
-/* return the dyld error string, or the passed in error string if none */
- NSLinkEditErrors ler;
- int lerno;
- const char *errstr;
- const char *file;
- NSLinkEditError(&ler,&lerno,&file,&errstr);
- if (!errstr || !strlen(errstr)) errstr = othererror;
- return errstr;
-}
-
-static const struct mach_header *
-lt_int_dyld_get_mach_header_from_nsmodule(NSModule module)
-{
-/* There should probably be an apple dyld api for this */
- int i=_dyld_image_count();
- int j;
- const char *modname=NSNameOfModule(module);
- const struct mach_header *mh=NULL;
- if (!modname) return NULL;
- for (j = 0; j < i; j++)
- {
- if (!strcmp(_dyld_get_image_name(j),modname))
- {
- mh=_dyld_get_image_header(j);
- break;
- }
- }
- return mh;
-}
-
-static const char *
-lt_int_dyld_lib_install_name(const struct mach_header *mh)
-{
-/* NSAddImage is also used to get the loaded image, but it only works if the
lib
- is installed, for uninstalled libs we need to check the install_names
against
- each other. Note that this is still broken if DYLD_IMAGE_SUFFIX is set and a
- different lib was loaded as a result
-*/
- int j;
- struct load_command *lc;
- unsigned long offset = sizeof(struct mach_header);
- const char* retStr=NULL;
- for (j = 0; j < mh->ncmds; j++)
- {
- lc = (struct load_command*)(((unsigned long)mh) + offset);
- if (LC_ID_DYLIB == lc->cmd)
- {
- retStr=(char*)(((struct
dylib_command*)lc)->dylib.name.offset +
-
(unsigned long)lc);
- }
- offset += lc->cmdsize;
- }
- return retStr;
-}
-
-static const struct mach_header *
-lt_int_dyld_match_loaded_lib_by_install_name(const char *name)
-{
- int i=_dyld_image_count();
- int j;
- const struct mach_header *mh=NULL;
- const char *id=NULL;
- for (j = 0; j < i; j++)
- {
- id=lt_int_dyld_lib_install_name(_dyld_get_image_header(j));
- if ((id) && (!strcmp(id,name)))
- {
- mh=_dyld_get_image_header(j);
- break;
- }
- }
- return mh;
-}
-
-static NSSymbol
-lt_int_dyld_NSlookupSymbolInLinkedLibs(const char *symbol,
- const struct mach_header *mh)
-{
- /* Safe to assume our mh is good */
- int j;
- struct load_command *lc;
- unsigned long offset = sizeof(struct mach_header);
- NSSymbol retSym = 0;
- const struct mach_header *mh1;
- if ((ltdl_NSLookupSymbolInImage) && NSIsSymbolNameDefined(symbol) )
- {
- for (j = 0; j < mh->ncmds; j++)
- {
- lc = (struct load_command*)(((unsigned long)mh) +
offset);
- if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB
== lc->cmd))
- {
-
mh1=lt_int_dyld_match_loaded_lib_by_install_name((char*)(((struct
dylib_command*)lc)->dylib.name.offset +
-
(unsigned long)lc));
- if (!mh1)
- {
- /* Maybe NSAddImage can find it */
- mh1=ltdl_NSAddImage((char*)(((struct
dylib_command*)lc)->dylib.name.offset +
-
(unsigned long)lc),
-
NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED +
-
NSADDIMAGE_OPTION_WITH_SEARCHING +
-
NSADDIMAGE_OPTION_RETURN_ON_ERROR );
- }
- if (mh1)
- {
- retSym = ltdl_NSLookupSymbolInImage(mh1,
-
symbol,
-
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW
-
| NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
-
);
- if (retSym) break;
- }
- }
- offset += lc->cmdsize;
- }
- }
- return retSym;
-}
-
-static int
-sys_dyld_init (void)
-{
- int retCode = 0;
- int err = 0;
- if (!_dyld_present()) {
- retCode=1;
- }
- else {
- err = _dyld_func_lookup("__dyld_NSAddImage",(unsigned
long*)<dl_NSAddImage);
- err = _dyld_func_lookup("__dyld_NSLookupSymbolInImage",(unsigned
long*)<dl_NSLookupSymbolInImage);
- err = _dyld_func_lookup("__dyld_NSIsSymbolNameDefinedInImage",(unsigned
long*)<dl_NSIsSymbolNameDefinedInImage);
- err = _dyld_func_lookup("__dyld_NSMakePrivateModulePublic",(unsigned
long*)<dl_NSMakePrivateModulePublic);
- }
- return retCode;
-}
-
-static lt_module
-sys_dyld_open (lt_user_data loader_data, const char *filename)
-{
- lt_module module = 0;
- NSObjectFileImage ofi = 0;
- NSObjectFileImageReturnCode ofirc;
-
- if (!filename)
- return (lt_module)-1;
- ofirc = NSCreateObjectFileImageFromFile(filename, &ofi);
- switch (ofirc)
- {
- case NSObjectFileImageSuccess:
- module = NSLinkModule(ofi, filename,
-
NSLINKMODULE_OPTION_RETURN_ON_ERROR
- | NSLINKMODULE_OPTION_PRIVATE
- | NSLINKMODULE_OPTION_BINDNOW);
- NSDestroyObjectFileImage(ofi);
- if (module)
- ltdl_NSMakePrivateModulePublic(module);
- break;
- case NSObjectFileImageInappropriateFile:
- if (ltdl_NSIsSymbolNameDefinedInImage &&
ltdl_NSLookupSymbolInImage)
- {
- module = (lt_module)ltdl_NSAddImage(filename,
NSADDIMAGE_OPTION_RETURN_ON_ERROR);
- break;
- }
- default:
- LT__MUTEX_SETERRORSTR
(lt_int_dyld_error(LT__STRERROR(CANNOT_OPEN)));
- return 0;
- }
- if (!module) LT__MUTEX_SETERRORSTR
(lt_int_dyld_error(LT__STRERROR(CANNOT_OPEN)));
- return module;
-}
-
-static int
-sys_dyld_close (lt_user_data loader_data, lt_module module)
-{
- int retCode = 0;
- int flags = 0;
- if (module == (lt_module)-1) return 0;
-#ifdef __BIG_ENDIAN__
- if (((struct mach_header *)module)->magic == MH_MAGIC)
-#else
- if (((struct mach_header *)module)->magic == MH_CIGAM)
-#endif
- {
- LT__MUTEX_SETERRORSTR("Can not close a dylib");
- retCode = 1;
- }
- else
- {
-#if 1
-/* Currently, if a module contains c++ static destructors and it is unloaded,
we
- get a segfault in atexit(), due to compiler and dynamic loader differences
of
- opinion, this works around that.
-*/
- if ((const struct section *)NULL !=
-
getsectbynamefromheader(lt_int_dyld_get_mach_header_from_nsmodule(module),
- "__DATA","__mod_term_func"))
- {
- flags += NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
- }
-#endif
-#ifdef __ppc__
- flags += NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
-#endif
- if (!NSUnLinkModule(module,flags))
- {
- retCode=1;
- LT__MUTEX_SETERRORSTR
(lt_int_dyld_error(LT__STRERROR(CANNOT_CLOSE)));
- }
- }
-
- return retCode;
-}
-
-static void *
-sys_dyld_sym (lt_user_data loader_data, lt_module module, const char *symbol)
-{
- void *address = 0;
- NSSymbol *nssym = 0;
- void *unused;
- const struct mach_header *mh=NULL;
- char saveError[256] = "Symbol not found";
- if (module == (lt_module)-1)
- {
- _dyld_lookup_and_bind(symbol,(unsigned long*)&address,&unused);
- return address;
- }
-#ifdef __BIG_ENDIAN__
- if (((struct mach_header *)module)->magic == MH_MAGIC)
-#else
- if (((struct mach_header *)module)->magic == MH_CIGAM)
+LT_SCOPE struct lt_user_dlloader lt__sys_dyld;
+LT_SCOPE int lt__sys_dyld_init (void);
#endif
- {
- if (ltdl_NSIsSymbolNameDefinedInImage && ltdl_NSLookupSymbolInImage)
- {
- mh=module;
- if (ltdl_NSIsSymbolNameDefinedInImage((struct
mach_header*)module,symbol))
- {
- nssym = ltdl_NSLookupSymbolInImage((struct
mach_header*)module,
-
symbol,
-
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW
-
| NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
-
);
- }
- }
-
- }
- else {
- nssym = NSLookupSymbolInModule(module, symbol);
- }
- if (!nssym)
- {
- strncpy(saveError,
lt_int_dyld_error(LT__STRERROR(SYMBOL_NOT_FOUND)), 255);
- saveError[255] = 0;
- if (!mh) mh=lt_int_dyld_get_mach_header_from_nsmodule(module);
- nssym = lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh);
- }
- if (!nssym)
- {
- LT__MUTEX_SETERRORSTR (saveError);
- return NULL;
- }
- return NSAddressOfSymbol(nssym);
-}
-
-static struct lt_user_dlloader sys_dyld =
- { "_", sys_dyld_open, sys_dyld_close, sys_dyld_sym, 0, 0 };
-
-
-#endif /* HAVE_DYLD */
-
-
-/* --- DLPREOPEN() INTERFACE LOADER --- */
-
-
-/* emulate dynamic linking using preloaded_symbols */
-
-typedef struct lt_dlsymlists_t
-{
- struct lt_dlsymlists_t *next;
- const lt_dlsymlist *syms;
-} lt_dlsymlists_t;
-
-static const lt_dlsymlist *default_preloaded_symbols = 0;
-static lt_dlsymlists_t *preloaded_symbols = 0;
-
-static int
-presym_init (lt_user_data loader_data)
-{
- int errors = 0;
-
- LT__MUTEX_LOCK ();
-
- preloaded_symbols = 0;
- if (default_preloaded_symbols)
- {
- errors = lt_dlpreload (default_preloaded_symbols);
- }
-
- LT__MUTEX_UNLOCK ();
-
- return errors;
-}
-
-static int
-presym_free_symlists (void)
-{
- lt_dlsymlists_t *lists;
-
- LT__MUTEX_LOCK ();
-
- lists = preloaded_symbols;
- while (lists)
- {
- lt_dlsymlists_t *tmp = lists;
-
- lists = lists->next;
- FREE (tmp);
- }
- preloaded_symbols = 0;
-
- LT__MUTEX_UNLOCK ();
-
- return 0;
-}
-
-static int
-presym_exit (lt_user_data loader_data)
-{
- presym_free_symlists ();
- return 0;
-}
-
-static int
-presym_add_symlist (const lt_dlsymlist *preloaded)
-{
- lt_dlsymlists_t *tmp;
- lt_dlsymlists_t *lists;
- int errors = 0;
-
- LT__MUTEX_LOCK ();
-
- lists = preloaded_symbols;
- while (lists)
- {
- if (lists->syms == preloaded)
- {
- goto done;
- }
- lists = lists->next;
- }
-
- tmp = MALLOC (lt_dlsymlists_t, 1);
- if (tmp)
- {
- memset (tmp, 0, sizeof(lt_dlsymlists_t));
- tmp->syms = preloaded;
- tmp->next = preloaded_symbols;
- preloaded_symbols = tmp;
- }
- else
- {
- ++errors;
- }
-
- done:
- LT__MUTEX_UNLOCK ();
- return errors;
-}
-
-static lt_module
-presym_open (lt_user_data loader_data, const char *filename)
-{
- lt_dlsymlists_t *lists;
- lt_module module = (lt_module) 0;
-
- LT__MUTEX_LOCK ();
- lists = preloaded_symbols;
-
- if (!lists)
- {
- LT__MUTEX_SETERROR (NO_SYMBOLS);
- goto done;
- }
-
- /* Can't use NULL as the reflective symbol header, as NULL is
- used to mark the end of the entire symbol list. Self-dlpreopened
- symbols follow this magic number, chosen to be an unlikely
- clash with a real module name. */
- if (!filename)
- {
- filename = "@PROGRAM@";
- }
-
- while (lists)
- {
- const lt_dlsymlist *syms = lists->syms;
-
- while (syms->name)
- {
- if (!syms->address && strcmp(syms->name, filename) == 0)
- {
- module = (lt_module) syms;
- goto done;
- }
- ++syms;
- }
-
- lists = lists->next;
- }
-
- LT__MUTEX_SETERROR (FILE_NOT_FOUND);
-
- done:
- LT__MUTEX_UNLOCK ();
- return module;
-}
-
-static int
-presym_close (lt_user_data loader_data, lt_module module)
-{
- /* Just to silence gcc -Wall */
- module = 0;
- return 0;
-}
-
-static void *
-presym_sym (lt_user_data loader_data, lt_module module, const char *symbol)
-{
- lt_dlsymlist *syms = (lt_dlsymlist*) module;
-
- ++syms;
- while (syms->address)
- {
- if (strcmp(syms->name, symbol) == 0)
- {
- return syms->address;
- }
-
- ++syms;
- }
-
- LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
-
- return 0;
-}
-
-static struct lt_user_dlloader presym = {
- 0, presym_open, presym_close, presym_sym, presym_exit, 0
-};
-
-
+LT_SCOPE struct lt_user_dlloader lt__presym;
+LT_SCOPE int lt__presym_init (lt_user_data loader_data);
@@ -1216,28 +230,29 @@
the next loader in the chain. */
# define LOADER_APPEND 0
- errors += lt_dlloader_add (LOADER_APPEND, &presym, "dlpreload");
+ /* All ltdl supplied loaders are in the /dl[a-z-]+/ namespace. */
+ errors += lt_dlloader_add (LOADER_APPEND, <__presym, "dlpreload");
#if HAVE_DLD
- errors += lt_dlloader_add (LOADER_APPEND, &sys_dld, "dld");
+ errors += lt_dlloader_add (LOADER_APPEND, <__sys_dld, "dld");
#endif
#if HAVE_DYLD
- errors += lt_dlloader_add (LOADER_APPEND, &sys_dyld, "dyld");
- errors += sys_dyld_init();
+ errors += lt_dlloader_add (LOADER_APPEND, <__sys_dyld, "dldyld");
+ errors += lt__sys_dyld_init();
#endif
#ifdef __BEOS__
- errors += lt_dlloader_add (LOADER_APPEND, &sys_bedl, "dlopen");
+ errors += lt_dlloader_add (LOADER_APPEND, <__sys_bedl, "dlopen");
#endif
#if HAVE_SHL_LOAD
- errors += lt_dlloader_add (LOADER_APPEND, &sys_shl, "dlopen");
+ errors += lt_dlloader_add (LOADER_APPEND, <__sys_shl, "dlopen");
#endif
#if HAVE_LIBDL
- errors += lt_dlloader_add (LOADER_APPEND, &sys_dl, "dlopen");
+ errors += lt_dlloader_add (LOADER_APPEND, <__sys_dl, "dlopen");
#endif
#if defined(__WINDOWS__) || defined(__CYGWIN__)
- errors += lt_dlloader_add (LOADER_APPEND, &sys_wll, "dlopen");
+ errors += lt_dlloader_add (LOADER_APPEND, <__sys_wll, "dlopen");
#endif
- if (presym_init (presym.dlloader_data))
+ if (lt__presym_init (lt__presym.dlloader_data))
{
LT__MUTEX_SETERROR (INIT_LOADER);
++errors;
@@ -1255,39 +270,6 @@
}
int
-lt_dlpreload (const lt_dlsymlist *preloaded)
-{
- int errors = 0;
-
- if (preloaded)
- {
- errors = presym_add_symlist (preloaded);
- }
- else
- {
- presym_free_symlists();
-
- LT__MUTEX_LOCK ();
- if (default_preloaded_symbols)
- {
- errors = lt_dlpreload (default_preloaded_symbols);
- }
- LT__MUTEX_UNLOCK ();
- }
-
- return errors;
-}
-
-int
-lt_dlpreload_default (const lt_dlsymlist *preloaded)
-{
- LT__MUTEX_LOCK ();
- default_preloaded_symbols = preloaded;
- LT__MUTEX_UNLOCK ();
- return 0;
-}
-
-int
lt_dlexit (void)
{
/* shut down libltdl */
--- orig/libltdl/ltdl.h
+++ mod/libltdl/ltdl.h
@@ -126,42 +126,6 @@
-/* --- USER MODULE LOADER API --- */
-
-
-typedef struct lt_dlloader lt_dlloader;
-typedef void * lt_user_data;
-typedef void * lt_module;
-
-/* Function pointer types for creating user defined module loaders. */
-typedef lt_module lt_module_open (lt_user_data loader_data,
- const char *filename);
-typedef int lt_module_close (lt_user_data loader_data,
- lt_module handle);
-typedef void * lt_find_sym (lt_user_data loader_data,
- lt_module handle, const char *symbol);
-typedef int lt_dlloader_exit (lt_user_data loader_data);
-
-struct lt_user_dlloader {
- const char *sym_prefix;
- lt_module_open *module_open;
- lt_module_close *module_close;
- lt_find_sym *find_sym;
- lt_dlloader_exit *dlloader_exit;
- lt_user_data dlloader_data;
-};
-
-LT_SCOPE lt_dlloader *lt_dlloader_next (lt_dlloader *place);
-LT_SCOPE lt_dlloader *lt_dlloader_find (const char *loader_name);
-LT_SCOPE const char *lt_dlloader_name (lt_dlloader *place);
-LT_SCOPE lt_user_data *lt_dlloader_data (lt_dlloader *place);
-LT_SCOPE int lt_dlloader_add (lt_dlloader *place,
- const struct lt_user_dlloader *dlloader,
- const char *loader_name);
-LT_SCOPE int lt_dlloader_remove (const char *loader_name);
-
-
-
/* --- BINARY COMPATIBILITY WITH OLD LIBLTDL --- */
LT_SCOPE void * (*lt_dlmalloc) (size_t size);
--- orig/m4/ltdl.m4
+++ mod/m4/ltdl.m4
@@ -329,39 +329,56 @@
AC_CHECK_FUNC([shl_load],
[AC_DEFINE([HAVE_SHL_LOAD], [1],
- [Define if you have the shl_load function.])],
+ [Define if you have the shl_load function.])
+ AC_LIBOBJ([loader-shl_load])],
[AC_CHECK_LIB([dld], [shl_load],
[AC_DEFINE([HAVE_SHL_LOAD], [1],
[Define if you have the shl_load function.])
- LIBADD_DL="$LIBADD_DL -ldld"],
+ LIBADD_DL="$LIBADD_DL -ldld"
+ AC_LIBOBJ([loader-shl_load])],
[AC_CHECK_LIB([dl], [dlopen],
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
- LIBADD_DL="-ldl" libltdl_cv_lib_dl_dlopen="yes"],
+ LIBADD_DL="-ldl" libltdl_cv_lib_dl_dlopen="yes"
+ AC_LIBOBJ([loader-dlopen])],
[AC_TRY_LINK([#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
],
- [dlopen(0, 0);],
+ [dlopen(0, 0);],
[AC_DEFINE([HAVE_LIBDL], [1],
- [Define if you have the libdl library or
equivalent.]) libltdl_cv_func_dlopen="yes"],
- [AC_CHECK_LIB([svld], [dlopen],
+ [Define if you have the libdl library or equivalent.])
+ libltdl_cv_func_dlopen="yes"
+ AC_LIBOBJ([loader-dlopen])],
+ [AC_CHECK_LIB([svld], [dlopen],
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
- LIBADD_DL="-lsvld" libltdl_cv_func_dlopen="yes"],
+ LIBADD_DL="-lsvld" libltdl_cv_func_dlopen="yes"
+ AC_LIBOBJ([loader-dlopen])],
[AC_CHECK_LIB([dld], [dld_link],
[AC_DEFINE([HAVE_DLD], [1],
[Define if you have the GNU dld library.])
- LIBADD_DL="$LIBADD_DL -ldld"],
- [AC_CHECK_FUNC([_dyld_func_lookup],
- [AC_DEFINE([HAVE_DYLD], [1],
- [Define if you have the _dyld_func_lookup
function.])])
- ])
- ])
- ])
- ])
- ])
-])
+ LIBADD_DL="$LIBADD_DL -ldld"
+ AC_LIBOBJ([loader-dld_link])],
+ [AC_CHECK_FUNC([_dyld_func_lookup],
+ [AC_DEFINE([HAVE_DYLD], [1],
+ [Define if you have the _dyld_func_lookup
function.])
+ AC_LIBOBJ([loader-dyld])])#_dyld_func_lookup
+ ])#dld
+ ])#svld
+ ])#dlfcn.h
+ ])#dl
+ ])#dld
+ ])#shl_load
+
+case $host_os in
+beos*)
+ AC_LIBOBJ([loader-load_add_on])
+ ;;
+cygwin* | mingw* | os2* | pw32*)
+ AC_LIBOBJ([loader-loadlibrary])
+ ;;
+esac
if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen"
= xyes
then
--- orig/tests/cdemo/Makefile.am
+++ mod/tests/cdemo/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2004 Free Software Foundation
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I ../../m4
+AM_CPPFLAGS = -I$(top_srcdir)/../..
noinst_LTLIBRARIES = libfoo.la
--- orig/tests/demo/Makefile.am
+++ mod/tests/demo/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2004 Free Software Foundation
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I ../../m4
+AM_CPPFLAGS = -I$(top_srcdir)/../..
# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
--- orig/tests/depdemo/Makefile.am
+++ mod/tests/depdemo/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2004 Free Software Foundation
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I ../../m4
+AM_CPPFLAGS = -I$(top_srcdir)/../..
SUBDIRS = l1 l2 l3 l4
--- orig/tests/f77demo/Makefile.am
+++ mod/tests/f77demo/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2004 Free Software Foundation
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I ../../m4
+AM_CPPFLAGS = -I$(top_srcdir)/../..
noinst_LTLIBRARIES = libfoo.la libmix.la
--- orig/tests/mdemo/Makefile.am
+++ mod/tests/mdemo/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2004 Free Software Foundation
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -19,8 +19,7 @@
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I ../../m4
-
-INCLUDES = $(INCLTDL)
+AM_CPPFLAGS = -I$(top_srcdir)/../.. $(INCLTDL)
lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la
--- orig/tests/mdemo2/Makefile.am
+++ mod/tests/mdemo2/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2004 Free Software Foundation
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -19,8 +19,7 @@
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I ../../m4
-
-AM_CPPFLAGS = -I$(top_srcdir)/../../libltdl
+AM_CPPFLAGS = -I$(top_srcdir)/../.. -I$(top_srcdir)/../../libltdl
bin_PROGRAMS = mdemo2 mdemo2_static
--- orig/tests/pdemo/Makefile.am
+++ mod/tests/pdemo/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2004 Free Software Foundation
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I ../../m4
+AM_CPPFLAGS = -I$(top_srcdir)/../..
# Build a libtool library, libhello.la for installation in libdir.
lib_LTLIBRARIES = libhello.la
--- orig/tests/tagdemo/Makefile.am
+++ mod/tests/tagdemo/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
##
-## Copyright (C) 2003 Free Software Foundation
+## Copyright (C) 2003, 2004 Free Software Foundation
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
AUTOMAKE_OPTIONS = no-dependencies foreign
ACLOCAL_AMFLAGS = -I ../../m4
+AM_CPPFLAGS = -I$(top_srcdir)/../..
noinst_LTLIBRARIES = libconv.la
lib_LTLIBRARIES = libfoo.la libbaz.la
* added files
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/loader-dld_link.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Tue Apr 6 16:52:44 2004 16214.0
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/loader-dlopen.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Tue Apr 6 16:52:44 2004 16214.1
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/loader-dyld.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Tue Apr 6 16:52:44 2004 16214.2
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/loader-load_add_on.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Tue Apr 6 16:52:44 2004 16214.3
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/loader-loadlibrary.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Tue Apr 6 16:52:44 2004 16214.4
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/loader-preopen.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Tue Apr 6 16:52:44 2004 16214.5
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/loader-shl_load.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Tue Apr 6 16:52:44 2004 16214.6
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/lt_dlloader.h.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Mon Apr 5 16:27:18 2004 27718.0
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/loader-dld_link.c
@@ -0,0 +1,84 @@
+/* loader-dld_link.c -- dynamic linking with dld
+ Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+ Originally by Thomas Tanner <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#include "lt__private.h"
+#include "lt_dlloader.h"
+
+#if HAVE_DLD_H
+#include <dld.h>
+#endif
+
+static lt_module
+sys_dld_open (lt_user_data loader_data, const char *filename)
+{
+ lt_module module = lt__strdup (filename);
+
+ if (dld_link (filename) != 0)
+ {
+ LT__MUTEX_SETERROR (CANNOT_OPEN);
+ FREE (module);
+ }
+
+ return module;
+}
+
+static int
+sys_dld_close (lt_user_data loader_data, lt_module module)a
+{
+ int errors = 0;
+
+ if (dld_unlink_by_file ((char*)(module), 1) != 0)
+ {
+ LT__MUTEX_SETERROR (CANNOT_CLOSE);
+ ++errors;
+ }
+ else
+ {
+ FREE (module);
+ }
+
+ return errors;
+}
+
+static void *
+sys_dld_sym (lt_user_data loader_data, lt_module module, const char *symbol)
+{
+ void *address = dld_get_func (symbol);
+
+ if (!address)
+ {
+ LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
+ }
+
+ return address;
+}
+
+struct lt_user_dlloader lt__sys_dld = {
+ 0, sys_dld_open, sys_dld_close, sys_dld_sym, 0, 0
+};
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/loader-dlopen.c
@@ -0,0 +1,121 @@
+/* loader-dlopen.c -- dynamic linking with dlopen/dlsym
+ Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+ Originally by Thomas Tanner <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#include "lt__private.h"
+#include "lt_dlloader.h"
+
+#if HAVE_DLFCN_H
+# include <dlfcn.h>
+#endif
+
+#if HAVE_SYS_DL_H
+# include <sys/dl.h>
+#endif
+
+/* We may have to define LT_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_LAZY_OR_NOW DL_LAZY
+# endif
+# endif /* !RTLD_LAZY */
+#endif
+#ifndef LT_LAZY_OR_NOW
+# ifdef RTLD_NOW
+# define LT_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_LAZY_OR_NOW DL_NOW
+# endif
+# endif /* !RTLD_NOW */
+#endif
+#ifndef LT_LAZY_OR_NOW
+# define LT_LAZY_OR_NOW 0
+#endif /* !LT_LAZY_OR_NOW */
+
+#if HAVE_DLERROR
+# define DLERROR(arg) dlerror ()
+#else
+# define DLERROR(arg) LT__STRERROR (arg)
+#endif
+
+#define DL__MUTEX_SETERROR(errorcode) \
+ LT__MUTEX_SETERRORSTR (DLERROR (errorcode))
+
+static lt_module
+sys_dl_open (lt_user_data loader_data, const char *filename)
+{
+ lt_module module = dlopen (filename, LT_LAZY_OR_NOW);
+
+ if (!module)
+ {
+ DL__MUTEX_SETERROR (CANNOT_OPEN);
+ }
+
+ return module;
+}
+
+static int
+sys_dl_close (lt_user_data loader_data, lt_module module)
+{
+ int errors = 0;
+
+ if (dlclose (module) != 0)
+ {
+ DL__MUTEX_SETERROR (CANNOT_CLOSE);
+ ++errors;
+ }
+
+ return errors;
+}
+
+static void *
+sys_dl_sym (lt_user_data loader_data, lt_module module, const char *symbol)
+{
+ void *address = dlsym (module, symbol);
+
+ if (!address)
+ {
+ DL__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
+ }
+
+ return address;
+}
+
+struct lt_user_dlloader lt__sys_dl =
+ {
+# ifdef NEED_USCORE
+ "_",
+# else
+ 0,
+# endif
+ sys_dl_open, sys_dl_close, sys_dl_sym, 0, 0 };
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/loader-dyld.c
@@ -0,0 +1,417 @@
+/* loader-dyld.c -- dynamic linking on darwin and OS X
+ Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+ Originally by Thomas Tanner <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#include "lt__private.h"
+#include "lt_dlloader.h"
+
+#if HAVE_MACH_O_DYLD_H
+# if !defined(__APPLE_CC__) && !defined(__MWERKS__) &&
!defined(__private_extern__)
+ /* Is this correct? Does it still function properly? */
+# define __private_extern__ extern
+# endif
+# include <mach-o/dyld.h>
+#endif
+
+#include <mach-o/getsect.h>
+
+/* We have to put some stuff here that isn't in older dyld.h files */
+#ifndef ENUM_DYLD_BOOL
+# define ENUM_DYLD_BOOL
+# undef FALSE
+# undef TRUE
+ enum DYLD_BOOL {
+ FALSE,
+ TRUE
+ };
+#endif
+#ifndef LC_REQ_DYLD
+# define LC_REQ_DYLD 0x80000000
+#endif
+#ifndef LC_LOAD_WEAK_DYLIB
+# define LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD)
+#endif
+
+typedef struct mach_header mach_header;
+typedef struct dylib_command dylib_command;
+
+static const mach_header *(*lt__addimage) (const char *image_name,
+ unsigned long options) = 0;
+static NSSymbol (*lt__image_symbol) (const mach_header
*image,
+ const char *symbolName,
+ unsigned long options) = 0;
+static enum DYLD_BOOL (*lt__image_symbol_p) (const mach_header *image,
+ const char *symbolName) = 0;
+static enum DYLD_BOOL (*lt__module_export) (NSModule module) = 0;
+
+static int dyld_cannot_close = 0;
+
+#ifndef NSADDIMAGE_OPTION_NONE
+# define NSADDIMAGE_OPTION_NONE 0x0
+#endif
+#ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR
+# define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1
+#endif
+#ifndef NSADDIMAGE_OPTION_WITH_SEARCHING
+# define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2
+#endif
+#ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
+# define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4
+#endif
+#ifndef NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME
+# define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8
+#endif
+
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
+# define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0
+#endif
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW
+# define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1
+#endif
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY
+# define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY 0x2
+#endif
+#ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
+# define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
+#endif
+
+#define LT__SYMLOOKUP_OPTS (NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW \
+ | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR)
+
+#ifdef __BIG_ENDIAN__
+# define LT__MAGIC MH_MAGIC
+#else
+# define LT__MAGIC MH_CIGAM
+#endif
+
+#define DYLD__MUTEX_SETERROR(errorcode) \
+ LT__MUTEX_SETERRORSTR (lt__dylderror (errorcode))
+
+/* Return the dyld error string, or the passed in error string if none. */
+static const char *
+lt__dylderror (int errnum)
+{
+ NSLinkEditErrors ler;
+ int lerno;
+ const char *file;
+ const char *errstr;
+
+ NSLinkEditError (&ler, &lerno, &file, &errstr);
+
+ if (! (errstr && *errstr))
+ {
+ errstr = LT__STRERROR (errnum);
+ }
+
+ return errstr;
+}
+
+/* There should probably be an apple dyld api for this. */
+static const mach_header *
+lt__nsmodule_get_header (NSModule module)
+{
+ int i = _dyld_image_count();
+ const char *modname = NSNameOfModule (module);
+ const mach_header *mh = 0;
+
+ if (!modname)
+ return NULL;
+
+ while (i > 0)
+ {
+ --i;
+ if (strcmp (_dyld_get_image_name (i), modname) != 0)
+ {
+ mh = _dyld_get_image_header (i);
+ break;
+ }
+ }
+
+ return mh;
+}
+
+/* NSAddImage is also used to get the loaded image, but it only works if
+ the lib is installed, for uninstalled libs we need to check the
+ install_names against each other. Note that this is still broken if
+ DYLD_IMAGE_SUFFIX is set and a different lib was loaded as a result. */
+static const char *
+lt__header_get_instnam (const mach_header *mh)
+{
+ unsigned long offset = sizeof(mach_header);
+ const char* result = 0;
+ int j;
+
+ for (j = 0; j < mh->ncmds; j++)
+ {
+ struct load_command *lc;
+
+ lc = (struct load_command*) (((unsigned long) mh) + offset);
+ if (LC_ID_DYLIB == lc->cmd)
+ {
+ result=(char*)(((dylib_command*) lc)->dylib.name.offset +
+ (unsigned long) lc);
+ }
+ offset += lc->cmdsize;
+ }
+
+ return result;
+}
+
+static const mach_header *
+lt__match_loadedlib (const char *name)
+{
+ const mach_header *mh = 0;
+ int i = _dyld_image_count();
+
+ while (i > 0)
+ {
+ const char *id;
+
+ --i;
+ id = lt__header_get_instnam (_dyld_get_image_header (i));
+ if (id && (strcmp (id, name) != 0))
+ {
+ mh = _dyld_get_image_header (i);
+ break;
+ }
+ }
+
+ return mh;
+}
+
+/* Safe to assume our mh is good. */
+static NSSymbol
+lt__linkedlib_symbol (const char *symname, const mach_header *mh)
+{
+ NSSymbol symbol = 0;
+
+ if (lt__image_symbol && NSIsSymbolNameDefined (symname))
+ {
+ unsigned long offset = sizeof(mach_header);
+ struct load_command *lc;
+ int j;
+
+ for (j = 0; j < mh->ncmds; j++)
+ {
+ lc = (struct load_command*) (((unsigned long) mh) + offset);
+ if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == lc->cmd))
+ {
+ unsigned long base = ((dylib_command *) lc)->dylib.name.offset;
+ char *name = (char *) (base + (unsigned long) lc);
+ const mach_header *mh1 = lt__match_loadedlib (name);
+
+ if (!mh1)
+ {
+ /* Maybe NSAddImage can find it */
+ mh1 = lt__addimage (name,
+ NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
+ | NSADDIMAGE_OPTION_WITH_SEARCHING
+ | NSADDIMAGE_OPTION_RETURN_ON_ERROR);
+ }
+
+ if (mh1)
+ {
+ symbol = lt__image_symbol (mh1, symname, LT__SYMLOOKUP_OPTS);
+ if (symbol)
+ break;
+ }
+ }
+
+ offset += lc->cmdsize;
+ }
+ }
+
+ return symbol;
+}
+
+int
+lt__sys_dyld_init (void)
+{
+ int errors = 0;
+
+ LT__MUTEX_LOCK ();
+
+ if (! dyld_cannot_close)
+ {
+ if (!_dyld_present ())
+ {
+ ++errors;
+ }
+ else
+ {
+ (void) _dyld_func_lookup ("__dyld_NSAddImage",
+ (unsigned long*) <__addimage);
+ (void) _dyld_func_lookup ("__dyld_NSLookupSymbolInImage",
+ (unsigned long*)<__image_symbol);
+ (void) _dyld_func_lookup ("__dyld_NSIsSymbolNameDefinedInImage",
+ (unsigned long*) <__image_symbol_p);
+ (void) _dyld_func_lookup ("__dyld_NSMakePrivateModulePublic",
+ (unsigned long*) <__module_export);
+ dyld_cannot_close = lt_dladderror ("can't close a dylib");
+ }
+ }
+
+ LT__MUTEX_UNLOCK ();
+
+ return errors;
+}
+
+static lt_module
+sys_dyld_open (lt_user_data loader_data, const char *filename)
+{
+ lt_module module = 0;
+ NSObjectFileImage ofi = 0;
+
+ if (!filename)
+ {
+ return (lt_module) -1;
+ }
+
+ switch (NSCreateObjectFileImageFromFile (filename, &ofi))
+ {
+ case NSObjectFileImageSuccess:
+ module = NSLinkModule (ofi, filename, NSLINKMODULE_OPTION_RETURN_ON_ERROR
+ | NSLINKMODULE_OPTION_PRIVATE
+ | NSLINKMODULE_OPTION_BINDNOW);
+ NSDestroyObjectFileImage (ofi);
+
+ if (module)
+ {
+ lt__module_export (module);
+ }
+ break;
+
+ case NSObjectFileImageInappropriateFile:
+ if (lt__image_symbol_p && lt__image_symbol)
+ {
+ module = (lt_module) lt__addimage(filename,
+ NSADDIMAGE_OPTION_RETURN_ON_ERROR);
+ }
+ break;
+ }
+
+ if (!module)
+ {
+ DYLD__MUTEX_SETERROR (CANNOT_OPEN);
+ }
+
+ return module;
+}
+
+static int
+sys_dyld_close (lt_user_data loader_data, lt_module module)
+{
+ int errors = 0;
+
+ if (module != (lt_module) -1)
+ {
+ const mach_header *mh = (const mach_header *) module;
+ int flags = 0;
+ if (mh->magic == LT__MAGIC)
+ {
+ DYLD__MUTEX_SETERROR(dyld_cannot_close);
+ ++errors;
+ }
+ else
+ {
+#if 1
+ /* Currently, if a module contains c++ static destructors and it
+ is unloaded, we get a segfault in atexit(), due to compiler and
+ dynamic loader differences of opinion, this works around that. */
+ if ((const struct section *) NULL !=
+ getsectbynamefromheader (lt__nsmodule_get_header (module),
+ "__DATA", "__mod_term_func"))
+ {
+ flags |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
+ }
+#endif
+#ifdef __ppc__
+ flags |= NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
+#endif
+ if (!NSUnLinkModule (module, flags))
+ {
+ DYLD__MUTEX_SETERRORSTR (CANNOT_CLOSE);
+ ++errors;
+ }
+ }
+ }
+
+ return errors;
+}
+
+static void *
+sys_dyld_sym (lt_user_data loader_data, lt_module module, const char *symbol)
+{
+ NSSymbol *nssym = 0;
+ mach_header *mh = (mach_header *) module;
+ char saveError[256] = "Symbol not found";
+
+ if (module == (lt_module)-1)
+ {
+ void *address, *unused;
+ _dyld_lookup_and_bind(symbol, (unsigned long*) &address, &unused);
+ return address;
+ }
+
+ if (mh->magic == LT__MAGIC)
+ {
+ if (lt__image_symbol_p && lt__image_symbol)
+ {
+ if (lt__image_symbol_p (mh, symbol))
+ {
+ nssym = lt__image_symbol (mh, symbol, LT__SYMLOOKUP_OPTS);
+ }
+ }
+
+ }
+ else
+ {
+ nssym = NSLookupSymbolInModule (module, symbol);
+ }
+
+ if (!nssym)
+ {
+ strncpy (saveError, lt__dylderror (SYMBOL_NOT_FOUND), 255);
+ saveError[255] = 0;
+ if (!mh)
+ {
+ mh = lt__nsmodule_get_header (module);
+ }
+ nssym = lt__linkedlib_symbol (symbol, mh);
+ }
+
+ if (!nssym)
+ {
+ LT__MUTEX_SETERRORSTR (saveError);
+ }
+
+ return nssym ? NSAddressOfSymbol (nssym) : 0;
+}
+
+struct lt_user_dlloader lt__sys_dyld =
+ { "_", sys_dyld_open, sys_dyld_close, sys_dyld_sym, 0, 0 };
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/loader-load_add_on.c
@@ -0,0 +1,92 @@
+/* loader-load_add_on.c -- dynamic linking for BeOS
+ Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+ Originally by Thomas Tanner <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#include "lt__private.h"
+#include "lt_dlloader.h"
+
+#include <kernel/image.h>
+
+static lt_module
+sys_bedl_open (lt_user_data loader_data, const char *filename)
+{
+ image_id image = 0;
+
+ if (filename)
+ {
+ image = load_add_on (filename);
+ }
+ else
+ {
+ image_info info;
+ int32 cookie = 0;
+ if (get_next_image_info (0, &cookie, &info) == B_OK)
+ image = load_add_on (info.name);
+ }
+
+ if (image <= 0)
+ {
+ LT__MUTEX_SETERROR (CANNOT_OPEN);
+ image = 0;
+ }
+
+ return (lt_module) image;
+}
+
+static int
+sys_bedl_close (lt_user_data loader_data, lt_module module)
+{
+ int errors = 0;
+
+ if (unload_add_on ((image_id) module) != B_OK)
+ {
+ LT__MUTEX_SETERROR (CANNOT_CLOSE);
+ ++errors;
+ }
+
+ return errors;
+}
+
+static void *
+sys_bedl_sym (lt_user_data loader_data, lt_module module, const char *symbol)
+{
+ void *address = 0;
+ image_id image = (image_id) module;
+
+ if (get_image_symbol (image, symbol, B_SYMBOL_TYPE_ANY, address) != B_OK)
+ {
+ LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
+ address = 0;
+ }
+
+ return address;
+}
+
+struct lt_user_dlloader lt__sys_bedl = {
+ 0, sys_bedl_open, sys_bedl_close, sys_bedl_sym, 0, 0
+};
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/loader-loadlibrary.c
@@ -0,0 +1,152 @@
+/* loader-loadlibrary.c -- dynamic linking for Win32
+ Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+ Originally by Thomas Tanner <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#include "lt__private.h"
+#include "lt_dlloader.h"
+
+#include <windows.h>
+
+/* Forward declaration; required to implement handle search below. */
+static lt_dlhandle handles;
+
+static lt_module
+sys_wll_open (lt_user_data loader_data, const char *filename)
+{
+ lt_dlhandle cur;
+ lt_module module = 0;
+ const char *errormsg = 0;
+ char *searchname = 0;
+ char *ext;
+ char self_name_buf[MAX_PATH];
+
+ if (!filename)
+ {
+ /* Get the name of main module */
+ *self_name_buf = 0;
+ GetModuleFileName (NULL, self_name_buf, sizeof (self_name_buf));
+ filename = ext = self_name_buf;
+ }
+ else
+ {
+ ext = strrchr (filename, '.');
+ }
+
+ if (ext)
+ {
+ /* FILENAME already has an extension. */
+ searchname = lt__strdup (filename);
+ }
+ else
+ {
+ /* Append a `.' to stop Windows from adding an
+ implicit `.dll' extension. */
+ searchname = MALLOC (char, 2+ LT_STRLEN (filename));
+ if (searchname)
+ sprintf (searchname, "%s.", filename);
+ }
+ if (!searchname)
+ return 0;
+
+#if __CYGWIN__
+ {
+ char wpath[MAX_PATH];
+ cygwin_conv_to_full_win32_path(searchname, wpath);
+ module = LoadLibrary(wpath);
+ }
+#else
+ module = LoadLibrary (searchname);
+#endif
+ FREE (searchname);
+
+ /* libltdl expects this function to fail if it is unable
+ to physically load the library. Sadly, LoadLibrary
+ will search the loaded libraries for a match and return
+ one of them if the path search load fails.
+
+ We check whether LoadLibrary is returning a handle to
+ an already loaded module, and simulate failure if we
+ find one. */
+ LT__MUTEX_LOCK ();
+ cur = handles;
+ while (cur)
+ {
+ if (!cur->module)
+ {
+ cur = 0;
+ break;
+ }
+
+ if (cur->module == module)
+ {
+ break;
+ }
+
+ cur = cur->next;
+ }
+ LT__MUTEX_UNLOCK ();
+
+ if (cur || !module)
+ {
+ LT__MUTEX_SETERROR (CANNOT_OPEN);
+ module = 0;
+ }
+
+ return module;
+}
+
+static int
+sys_wll_close (lt_user_data loader_data, lt_module module)
+{
+ int errors = 0;
+
+ if (FreeLibrary(module) == 0)
+ {
+ LT__MUTEX_SETERROR (CANNOT_CLOSE);
+ ++errors;
+ }
+
+ return errors;
+}
+
+static void *
+sys_wll_sym (lt_user_data loader_data, lt_module module,const char *symbol)
+{
+ void * address = GetProcAddress (module, symbol);
+
+ if (!address)
+ {
+ LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
+ }
+
+ return address;
+}
+
+struct lt_user_dlloader lt__sys_wll = {
+ 0, sys_wll_open, sys_wll_close, sys_wll_sym, 0, 0
+};
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/loader-preopen.c
@@ -0,0 +1,241 @@
+/* loader-preopen.c -- emulate dynamic linking using preloaded_symbols
+ Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+ Originally by Thomas Tanner <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#include "lt__private.h"
+#include "lt_dlloader.h"
+
+
+typedef struct lt_dlsymlists_t
+{
+ struct lt_dlsymlists_t *next;
+ const lt_dlsymlist *syms;
+} lt_dlsymlists_t;
+
+static lt_dlsymlists_t *preloaded_symbols = 0;
+static const lt_dlsymlist *default_preloaded_symbols = 0;
+
+
+int
+lt__presym_init (lt_user_data loader_data)
+{
+ int errors = 0;
+
+ LT__MUTEX_LOCK ();
+
+ preloaded_symbols = 0;
+ if (default_preloaded_symbols)
+ {
+ errors = lt_dlpreload (default_preloaded_symbols);
+ }
+
+ LT__MUTEX_UNLOCK ();
+
+ return errors;
+}
+
+static int
+presym_free_symlists (void)
+{
+ lt_dlsymlists_t *lists;
+
+ LT__MUTEX_LOCK ();
+
+ lists = preloaded_symbols;
+ while (lists)
+ {
+ lt_dlsymlists_t *tmp = lists;
+
+ lists = lists->next;
+ FREE (tmp);
+ }
+ preloaded_symbols = 0;
+
+ LT__MUTEX_UNLOCK ();
+
+ return 0;
+}
+
+int
+lt__presym_add_symlist (const lt_dlsymlist *preloaded)
+{
+ lt_dlsymlists_t *tmp;
+ lt_dlsymlists_t *lists;
+ int errors = 0;
+
+ LT__MUTEX_LOCK ();
+
+ lists = preloaded_symbols;
+ while (lists)
+ {
+ if (lists->syms == preloaded)
+ {
+ goto done;
+ }
+ lists = lists->next;
+ }
+
+ tmp = MALLOC (lt_dlsymlists_t, 1);
+ if (tmp)
+ {
+ memset (tmp, 0, sizeof(lt_dlsymlists_t));
+ tmp->syms = preloaded;
+ tmp->next = preloaded_symbols;
+ preloaded_symbols = tmp;
+ }
+ else
+ {
+ ++errors;
+ }
+
+ done:
+ LT__MUTEX_UNLOCK ();
+ return errors;
+}
+
+static lt_module
+presym_open (lt_user_data loader_data, const char *filename)
+{
+ lt_dlsymlists_t *lists;
+ lt_module module = (lt_module) 0;
+
+ LT__MUTEX_LOCK ();
+ lists = preloaded_symbols;
+
+ if (!lists)
+ {
+ LT__MUTEX_SETERROR (NO_SYMBOLS);
+ goto done;
+ }
+
+ /* Can't use NULL as the reflective symbol header, as NULL is
+ used to mark the end of the entire symbol list. Self-dlpreopened
+ symbols follow this magic number, chosen to be an unlikely
+ clash with a real module name. */
+ if (!filename)
+ {
+ filename = "@PROGRAM@";
+ }
+
+ while (lists)
+ {
+ const lt_dlsymlist *syms = lists->syms;
+
+ while (syms->name)
+ {
+ if (!syms->address && strcmp(syms->name, filename) == 0)
+ {
+ module = (lt_module) syms;
+ goto done;
+ }
+ ++syms;
+ }
+
+ lists = lists->next;
+ }
+
+ LT__MUTEX_SETERROR (FILE_NOT_FOUND);
+
+ done:
+ LT__MUTEX_UNLOCK ();
+ return module;
+}
+
+static int
+presym_close (lt_user_data loader_data, lt_module module)
+{
+ /* Just to silence gcc -Wall */
+ module = 0;
+ return 0;
+}
+
+static void *
+presym_sym (lt_user_data loader_data, lt_module module, const char *symbol)
+{
+ lt_dlsymlist *syms = (lt_dlsymlist*) module;
+
+ ++syms;
+ while (syms->address)
+ {
+ if (strcmp(syms->name, symbol) == 0)
+ {
+ return syms->address;
+ }
+
+ ++syms;
+ }
+
+ LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
+
+ return 0;
+}
+
+static int
+presym_exit (lt_user_data loader_data)
+{
+ presym_free_symlists ();
+ return 0;
+}
+
+struct lt_user_dlloader lt__presym = {
+ 0, presym_open, presym_close, presym_sym, presym_exit, 0
+};
+
+
+int
+lt_dlpreload (const lt_dlsymlist *preloaded)
+{
+ int errors = 0;
+
+ if (preloaded)
+ {
+ errors = lt__presym_add_symlist (preloaded);
+ }
+ else
+ {
+ presym_free_symlists();
+
+ LT__MUTEX_LOCK ();
+ if (default_preloaded_symbols)
+ {
+ errors = lt_dlpreload (default_preloaded_symbols);
+ }
+ LT__MUTEX_UNLOCK ();
+ }
+
+ return errors;
+}
+
+int
+lt_dlpreload_default (const lt_dlsymlist *preloaded)
+{
+ LT__MUTEX_LOCK ();
+ default_preloaded_symbols = preloaded;
+ LT__MUTEX_UNLOCK ();
+ return 0;
+}
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/loader-shl_load.c
@@ -0,0 +1,147 @@
+/* loader-shl_load.c -- dynamic linking with shl_load (HP-UX)
+ Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+ Originally by Thomas Tanner <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#include "lt__private.h"
+#include "lt_dlloader.h"
+
+#ifdef HAVE_DL_H
+# include <dl.h>
+#endif
+
+/* some flags are missing on some systems, so we provide
+ * harmless defaults.
+ *
+ * Mandatory:
+ * BIND_IMMEDIATE - Resolve symbol references when the library is loaded.
+ * BIND_DEFERRED - Delay code symbol resolution until actual reference.
+ *
+ * Optionally:
+ * BIND_FIRST - Place the library at the head of the symbol search
+ * order.
+ * BIND_NONFATAL - The default BIND_IMMEDIATE behavior is to treat all
+ * unsatisfied symbols as fatal. This flag allows
+ * binding of unsatisfied code symbols to be deferred
+ * until use.
+ * [Perl: For certain libraries, like DCE, deferred
+ * binding often causes run time problems. Adding
+ * BIND_NONFATAL to BIND_IMMEDIATE still allows
+ * unresolved references in situations like this.]
+ * BIND_NOSTART - Do not call the initializer for the shared library
+ * when the library is loaded, nor on a future call to
+ * shl_unload().
+ * BIND_VERBOSE - Print verbose messages concerning possible
+ * unsatisfied symbols.
+ *
+ * hp9000s700/hp9000s800:
+ * BIND_RESTRICTED - Restrict symbols visible by the library to those
+ * present at library load time.
+ * DYNAMIC_PATH - Allow the loader to dynamically search for the
+ * library specified by the path argument.
+ */
+
+#ifndef DYNAMIC_PATH
+# define DYNAMIC_PATH 0
+#endif
+#ifndef BIND_RESTRICTED
+# define BIND_RESTRICTED 0
+#endif
+
+#define LT_BIND_FLAGS (BIND_IMMEDIATE | BIND_NONFATAL | DYNAMIC_PATH)
+
+lt_module
+lt__sys_shl_open (lt_user_data loader_data, const char *filenam)
+{
+ static shl_t self = (shl_t) 0;
+ lt_module module = shl_load (filename, LT_BIND_FLAGS, 0L);
+
+ /* Since searching for a symbol against a NULL module handle will also
+ look in everything else that was already loaded and exported with
+ the -E compiler flag, we always cache a handle saved before any
+ modules are loaded. */
+ if (!self)
+ {
+ void *address;
+ shl_findsym (&self, "main", TYPE_UNDEFINED, &address);
+ }
+
+ if (!filename)
+ {
+ module = self;
+ }
+ else
+ {
+ module = shl_load (filename, LT_BIND_FLAGS, 0L);
+
+ if (!module)
+ {
+ LT__MUTEX_SETERROR (CANNOT_OPEN);
+ }
+ }
+
+ return module;
+}
+
+int
+lt__sys_shl_close (lt_user_data loader_data, lt_module module)
+{
+ int errors = 0;
+
+ if (module && (shl_unload ((shl_t) (module)) != 0))
+ {
+ LT__MUTEX_SETERROR (CANNOT_CLOSE);
+ ++errors;
+ }
+
+ return errors;
+}
+
+static void *
+sys_shl_sym (lt_user_data loader_data, lt_module module, const char *symbol)
+{
+ void *address = 0;
+
+ /* sys_shl_open should never return a NULL module handle */
+ if (module == (lt_module) 0)
+ {
+ LT__MUTEX_SETERROR (INVALID_HANDLE);
+ }
+ else if (!shl_findsym((shl_t*) &module, symbol, TYPE_UNDEFINED, &address))
+ {
+ if (!address)
+ {
+ LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
+ }
+ }
+
+ return address;
+}
+
+struct lt_user_dlloader lt__sys_shl = {
+ 0, sys_shl_open, sys_shl_close, sys_shl_sym, 0, 0
+};
--- /dev/null
+++
/Users/gary/devel/savannah/libtool--gary--1.0/,,address@hidden/new-files-archive/./libltdl/lt_dlloader.h
@@ -0,0 +1,71 @@
+/* lt_dlloader.h -- dynamic library loader interface
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Originally by Gary V. Vaughan <address@hidden>
+
+ NOTE: The canonical source of this file is maintained with the
+ GNU Libtool package. Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA
+
+*/
+
+#ifndef LT_DLLOADER_H
+#define LT_DLLOADER_H 1
+
+#include <libltdl/lt_system.h>
+
+LT_BEGIN_C_DECLS
+
+typedef struct lt_dlloader lt_dlloader;
+typedef void * lt_user_data;
+typedef void * lt_module;
+
+/* Function pointer types for creating user defined module loaders. */
+typedef lt_module lt_module_open (lt_user_data loader_data,
+ const char *filename);
+typedef int lt_module_close (lt_user_data loader_data,
+ lt_module handle);
+typedef void * lt_find_sym (lt_user_data loader_data,
+ lt_module handle, const char *symbol);
+typedef int lt_dlloader_exit (lt_user_data loader_data);
+
+struct lt_user_dlloader {
+ const char *sym_prefix;
+ lt_module_open *module_open;
+ lt_module_close *module_close;
+ lt_find_sym *find_sym;
+ lt_dlloader_exit *dlloader_exit;
+ lt_user_data dlloader_data;
+};
+
+LT_SCOPE lt_dlloader *lt_dlloader_next (lt_dlloader *place);
+LT_SCOPE lt_dlloader *lt_dlloader_find (const char *loader_name);
+LT_SCOPE const char *lt_dlloader_name (lt_dlloader *place);
+LT_SCOPE lt_user_data *lt_dlloader_data (lt_dlloader *place);
+LT_SCOPE int lt_dlloader_add (lt_dlloader *place,
+ const struct lt_user_dlloader *dlloader,
+ const char *loader_name);
+LT_SCOPE int lt_dlloader_remove (const char *loader_name);
+
+
+LT_END_C_DECLS
+
+#endif /*!LT_DLLOADER_H*/
- libtool--gary--1.0--patch-7,
Gary V. Vaughan <=