| 1 |
|
/* loader-dlopen.c -- dynamic linking with dlopen/dlsym |
| 2 |
|
|
| 3 |
< |
Copyright (C) 1998, 1999, 2000, 2004, 2006, |
| 4 |
< |
2007, 2008 Free Software Foundation, Inc. |
| 3 |
> |
Copyright (C) 1998-2000, 2004, 2006-2008, 2011-2014 Free Software |
| 4 |
> |
Foundation, Inc. |
| 5 |
|
Written by Thomas Tanner, 1998 |
| 6 |
|
|
| 7 |
|
NOTE: The canonical source of this file is maintained with the |
| 68 |
|
if (vtable && !vtable->name) |
| 69 |
|
{ |
| 70 |
|
vtable->name = "lt_dlopen"; |
| 71 |
< |
#if defined(DLSYM_USCORE) |
| 71 |
> |
#if defined DLSYM_USCORE |
| 72 |
|
vtable->sym_prefix = "_"; |
| 73 |
|
#endif |
| 74 |
|
vtable->module_open = vm_open; |
| 93 |
|
/* --- IMPLEMENTATION --- */ |
| 94 |
|
|
| 95 |
|
|
| 96 |
< |
#if defined(HAVE_DLFCN_H) |
| 96 |
> |
#if defined HAVE_DLFCN_H |
| 97 |
|
# include <dlfcn.h> |
| 98 |
|
#endif |
| 99 |
|
|
| 100 |
< |
#if defined(HAVE_SYS_DL_H) |
| 100 |
> |
#if defined HAVE_SYS_DL_H |
| 101 |
|
# include <sys/dl.h> |
| 102 |
|
#endif |
| 103 |
|
|
| 104 |
|
|
| 105 |
|
/* We may have to define LT_LAZY_OR_NOW in the command line if we |
| 106 |
|
find out it does not work in some platform. */ |
| 107 |
< |
#if !defined(LT_LAZY_OR_NOW) |
| 108 |
< |
# if defined(RTLD_LAZY) |
| 107 |
> |
#if !defined LT_LAZY_OR_NOW |
| 108 |
> |
# if defined RTLD_LAZY |
| 109 |
|
# define LT_LAZY_OR_NOW RTLD_LAZY |
| 110 |
|
# else |
| 111 |
< |
# if defined(DL_LAZY) |
| 111 |
> |
# if defined DL_LAZY |
| 112 |
|
# define LT_LAZY_OR_NOW DL_LAZY |
| 113 |
|
# endif |
| 114 |
|
# endif /* !RTLD_LAZY */ |
| 115 |
|
#endif |
| 116 |
< |
#if !defined(LT_LAZY_OR_NOW) |
| 117 |
< |
# if defined(RTLD_NOW) |
| 116 |
> |
#if !defined LT_LAZY_OR_NOW |
| 117 |
> |
# if defined RTLD_NOW |
| 118 |
|
# define LT_LAZY_OR_NOW RTLD_NOW |
| 119 |
|
# else |
| 120 |
< |
# if defined(DL_NOW) |
| 120 |
> |
# if defined DL_NOW |
| 121 |
|
# define LT_LAZY_OR_NOW DL_NOW |
| 122 |
|
# endif |
| 123 |
|
# endif /* !RTLD_NOW */ |
| 124 |
|
#endif |
| 125 |
< |
#if !defined(LT_LAZY_OR_NOW) |
| 125 |
> |
#if !defined LT_LAZY_OR_NOW |
| 126 |
|
# define LT_LAZY_OR_NOW 0 |
| 127 |
|
#endif /* !LT_LAZY_OR_NOW */ |
| 128 |
|
|
| 129 |
|
/* We only support local and global symbols from modules for loaders |
| 130 |
|
that provide such a thing, otherwise the system default is used. */ |
| 131 |
< |
#if !defined(RTLD_GLOBAL) |
| 132 |
< |
# if defined(DL_GLOBAL) |
| 131 |
> |
#if !defined RTLD_GLOBAL |
| 132 |
> |
# if defined DL_GLOBAL |
| 133 |
|
# define RTLD_GLOBAL DL_GLOBAL |
| 134 |
|
# endif |
| 135 |
|
#endif /* !RTLD_GLOBAL */ |
| 136 |
< |
#if !defined(RTLD_LOCAL) |
| 137 |
< |
# if defined(DL_LOCAL) |
| 136 |
> |
#if !defined RTLD_LOCAL |
| 137 |
> |
# if defined DL_LOCAL |
| 138 |
|
# define RTLD_LOCAL DL_LOCAL |
| 139 |
|
# endif |
| 140 |
|
#endif /* !RTLD_LOCAL */ |
| 141 |
|
|
| 142 |
< |
#if defined(HAVE_DLERROR) |
| 142 |
> |
#if defined HAVE_DLERROR |
| 143 |
|
# define DLERROR(arg) dlerror () |
| 144 |
|
#else |
| 145 |
|
# define DLERROR(arg) LT__STRERROR (arg) |