mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-03-19 15:50:25 +08:00
*** empty log message ***
This commit is contained in:
parent
40802126fd
commit
2a246ffc0d
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
1999-01-09 Thomas Tanner <tanner@gmx.de>
|
||||
|
||||
* NEWS: support for BSD/OS 4.x was not documented
|
||||
* demo/Makefile.am: link against libm only if available
|
||||
* mdemo/Makefile.am: likewise, use -avoid-versioning flag
|
||||
instead of -avoid-version (typo)
|
||||
* demo/configure.in: check for libm, string.h and math.h
|
||||
* mdemo/configure.in: likewise
|
||||
* depdemo/configure.in: check for libm and math.h
|
||||
* libltdl/ltdl.c: check for buffer overflows
|
||||
|
||||
1999-01-07 Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
|
||||
|
||||
* ltmain.sh (cygwin, allow_undefined): Unfortunately, there are
|
||||
|
2
NEWS
2
NEWS
@ -2,7 +2,7 @@ NEWS - list of user-visible changes between releases of GNU Libtool
|
||||
|
||||
New in 1.2e: CVS version:
|
||||
* Support for BeOS
|
||||
* Improved support for Win32, SysV 4.3 and NetBSD
|
||||
* Improved support for Win32, SysV 4.3, BSD/OS 4.x and NetBSD
|
||||
* Various bugfixes
|
||||
|
||||
New in 1.2c: CVS version; 1.2d: 1998-12-16, Libtool team:
|
||||
|
@ -10,7 +10,7 @@ CLEANFILES = $(hardcode_tests)
|
||||
# Build a libtool library, libhello.la for installation in libdir.
|
||||
lib_LTLIBRARIES = libhello.la
|
||||
libhello_la_SOURCES = hello.c foo.c
|
||||
libhello_la_LDFLAGS = -version-info 3:12:1 -lm
|
||||
libhello_la_LDFLAGS = -version-info 3:12:1 $(LIBADD_M)
|
||||
|
||||
include_HEADERS = foo.h
|
||||
|
||||
|
@ -9,5 +9,10 @@ AM_PROG_LIBTOOL
|
||||
AM_CONDITIONAL(BINARY_HELLDL, [dnl
|
||||
grep '^global_symbol_pipe=..*$' ./libtool >/dev/null])
|
||||
|
||||
AC_CHECK_HEADERS(string.h math.h)
|
||||
|
||||
AC_CHECK_LIB(m, cos, LIBADD_M="-lm", LIBADD_M=)
|
||||
AC_SUBST(LIBADD_M)
|
||||
|
||||
dnl Output the makefile
|
||||
AC_OUTPUT(Makefile)
|
||||
|
@ -19,7 +19,10 @@ USA. */
|
||||
|
||||
#include "foo.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
struct dld_symlist
|
||||
{
|
||||
|
@ -23,7 +23,10 @@ USA. */
|
||||
#undef _LIBFOO_COMPILATION
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
/* Give a global variable definition. */
|
||||
int nothing = FOO_RET;
|
||||
|
@ -9,7 +9,7 @@ libl2_la_LIBADD = libl1.la
|
||||
libl3_la_SOURCES = l3.c l3.h sysdep.h
|
||||
libl3_la_LIBADD = libl1.la libl2.la
|
||||
libl4_la_SOURCES = l4.c l4.h sysdep.h
|
||||
libl4_la_LIBADD = libl3.la -lm
|
||||
libl4_la_LIBADD = libl3.la $(LIBADD_M)
|
||||
|
||||
bin_PROGRAMS = depdemo depdemo.static
|
||||
|
||||
|
@ -6,7 +6,10 @@ AC_PROG_CC
|
||||
AC_EXEEXT
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
AC_CHECK_HEADERS(math.h)
|
||||
|
||||
AC_CHECK_LIB(m, cos, LIBADD_M="-lm", LIBADD_M=)
|
||||
AC_SUBST(LIBADD_M)
|
||||
|
||||
dnl Output the makefile
|
||||
AC_OUTPUT(Makefile)
|
||||
|
@ -21,7 +21,10 @@ USA. */
|
||||
|
||||
#include "l3.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
int var_l4;
|
||||
|
||||
|
116
libltdl/ltdl.c
116
libltdl/ltdl.c
@ -628,7 +628,7 @@ tryall_dlopen (handle, filename)
|
||||
}
|
||||
|
||||
#undef MAX_FILENAME
|
||||
#define MAX_FILENAME 1024
|
||||
#define MAX_FILENAME 2048
|
||||
|
||||
static int
|
||||
find_module (handle, dir, libdir, dlname, old_name)
|
||||
@ -638,26 +638,32 @@ find_module (handle, dir, libdir, dlname, old_name)
|
||||
const char *dlname;
|
||||
const char *old_name;
|
||||
{
|
||||
char fullname[MAX_FILENAME]; /* FIXME: unchecked buffer */
|
||||
char fullname[MAX_FILENAME];
|
||||
|
||||
/* search a module */
|
||||
if (*dlname) {
|
||||
/* try to open the installed module */
|
||||
strcpy(fullname, libdir);
|
||||
strcat(fullname, "/");
|
||||
strcat(fullname, dlname);
|
||||
if (tryall_dlopen(handle, fullname) == 0)
|
||||
return 0;
|
||||
if (strlen(libdir)+strlen(dlname)+1 < MAX_FILENAME) {
|
||||
strcpy(fullname, libdir);
|
||||
strcat(fullname, "/");
|
||||
strcat(fullname, dlname);
|
||||
if (tryall_dlopen(handle, fullname) == 0)
|
||||
return 0;
|
||||
}
|
||||
/* try to open the not-installed module */
|
||||
strcpy(fullname, dir);
|
||||
strcat(fullname, ".libs/");
|
||||
strcat(fullname, dlname);
|
||||
if (tryall_dlopen(handle, fullname) == 0)
|
||||
return 0;
|
||||
strcpy(fullname, dir);
|
||||
strcat(fullname, dlname);
|
||||
if (tryall_dlopen(handle, fullname) == 0)
|
||||
return 0;
|
||||
if (strlen(dir)+strlen(dlname)+6 < MAX_FILENAME) {
|
||||
strcpy(fullname, dir);
|
||||
strcat(fullname, ".libs/");
|
||||
strcat(fullname, dlname);
|
||||
if (tryall_dlopen(handle, fullname) == 0)
|
||||
return 0;
|
||||
}
|
||||
if (strlen(dir)+strlen(dlname) < MAX_FILENAME) {
|
||||
strcpy(fullname, dir);
|
||||
strcat(fullname, dlname);
|
||||
if (tryall_dlopen(handle, fullname) == 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (*old_name && tryall_dlopen(handle, old_name) == 0)
|
||||
return 0;
|
||||
@ -678,25 +684,23 @@ lt_dlopen (filename)
|
||||
{
|
||||
lt_dlhandle handle;
|
||||
FILE *file;
|
||||
char dir[MAX_FILENAME]; /* FIXME: unchecked buffer */
|
||||
char tmp[MAX_FILENAME]; /* FIXME: unchecked buffer */
|
||||
char dir[MAX_FILENAME];
|
||||
char tmp[MAX_FILENAME];
|
||||
const char *basename, *ext, *search_path;
|
||||
|
||||
handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
|
||||
if (!handle)
|
||||
return 0;
|
||||
basename = strrchr(filename, '/');
|
||||
if (basename)
|
||||
basename++;
|
||||
else
|
||||
basename = filename;
|
||||
if (basename - filename >= MAX_FILENAME)
|
||||
return 0;
|
||||
strncpy(dir, filename, basename - filename);
|
||||
dir[basename - filename] = '\0';
|
||||
search_path = getenv("LTDL_LIBRARY_PATH"); /* get the search path */
|
||||
/* check whether we open a libtool module (.la extension) */
|
||||
ext = strrchr(basename, '.');
|
||||
if (ext && strcmp(ext, ".la") == 0) {
|
||||
/* FIXME: unchecked buffers */
|
||||
char dlname[MAX_FILENAME], old_name[MAX_FILENAME];
|
||||
char libdir[MAX_FILENAME], preload[MAX_FILENAME];
|
||||
int i;
|
||||
@ -708,29 +712,35 @@ lt_dlopen (filename)
|
||||
/* try other directories */
|
||||
const char *p, *next;
|
||||
|
||||
/* search_path is a colon-separated
|
||||
list of search directories */
|
||||
p = search_path;
|
||||
while (!file && p) {
|
||||
next = strchr(p, ':');
|
||||
if (next) {
|
||||
if (next - p + 1 >= MAX_FILENAME)
|
||||
return 0;
|
||||
strncpy(dir, p, next - p);
|
||||
dir[next - p] = '\0';
|
||||
p = next+1;
|
||||
} else {
|
||||
if (strlen(p)+1 >= MAX_FILENAME)
|
||||
return 0;
|
||||
strcpy(dir, p);
|
||||
p = 0;
|
||||
}
|
||||
if (!*dir)
|
||||
continue;
|
||||
strcat(dir, "/");
|
||||
strcpy(tmp, dir);
|
||||
strcat(tmp, basename);
|
||||
file = fopen(tmp, READTEXT_MODE);
|
||||
if (strlen(dir)+strlen(basename) < MAX_FILENAME) {
|
||||
strcpy(tmp, dir);
|
||||
strcat(tmp, basename);
|
||||
file = fopen(tmp, READTEXT_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!file) {
|
||||
free(handle);
|
||||
if (!file)
|
||||
return 0;
|
||||
}
|
||||
while (!feof(file)) {
|
||||
if (!fgets(tmp, MAX_FILENAME, file))
|
||||
break;
|
||||
@ -747,13 +757,18 @@ lt_dlopen (filename)
|
||||
trim(preload, &tmp[13]);
|
||||
}
|
||||
fclose(file);
|
||||
/* TODO: preload required libraries */
|
||||
/* FIXME: preload required libraries */
|
||||
|
||||
handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
|
||||
if (!handle)
|
||||
return 0;
|
||||
if (find_module(&handle, dir, libdir, dlname, old_name)) {
|
||||
free(handle);
|
||||
return 0;
|
||||
}
|
||||
/* extract the module name from the file name */
|
||||
if (basename >= MAX_FILENAME)
|
||||
return 0;
|
||||
strcpy(tmp, basename);
|
||||
tmp[ext - basename] = '\0';
|
||||
/* canonicalize the modul name */
|
||||
@ -763,6 +778,10 @@ lt_dlopen (filename)
|
||||
handle->name = strdup(tmp);
|
||||
} else {
|
||||
/* not a libtool module */
|
||||
handle = (lt_dlhandle) malloc(sizeof(lt_dlhandle_t));
|
||||
if (!handle)
|
||||
return 0;
|
||||
|
||||
if (tryall_dlopen(*handle, filename)) {
|
||||
int error = 1;
|
||||
|
||||
@ -770,23 +789,31 @@ lt_dlopen (filename)
|
||||
/* try other directories */
|
||||
const char *p, *next;
|
||||
|
||||
p = search_path;
|
||||
/* search_path is a colon-separated
|
||||
list of search directories */
|
||||
p = search_path;
|
||||
while (error && p) {
|
||||
next = strchr(p, ':');
|
||||
if (next) {
|
||||
if (next - p + 1 >= MAX_FILENAME)
|
||||
return 0;
|
||||
strncpy(dir, p, next - p);
|
||||
dir[next - p] = '\0';
|
||||
p = next+1;
|
||||
} else {
|
||||
if (strlen(p)+1 >= MAX_FILENAME)
|
||||
return 0;
|
||||
strcpy(dir, p);
|
||||
p = 0;
|
||||
}
|
||||
if (!*dir)
|
||||
continue;
|
||||
strcat(dir, "/");
|
||||
strcpy(tmp, dir);
|
||||
strcat(tmp, basename);
|
||||
error = tryall_dlopen(*handle, tmp);
|
||||
if (strlen(dir)+strlen(basename) < MAX_FILENAME) {
|
||||
strcpy(tmp, dir);
|
||||
strcat(tmp, basename);
|
||||
error = tryall_dlopen(*handle, tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (error) {
|
||||
@ -834,33 +861,42 @@ lt_dlclose (handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define MAX_SYMBOL_LENGTH 128
|
||||
|
||||
lt_ptr_t
|
||||
lt_dlsym (handle, symbol)
|
||||
lt_dlhandle handle;
|
||||
const char *symbol;
|
||||
{
|
||||
char sym[128]; /* FIXME: unchecked buffer */
|
||||
char sym[MAX_SYMBOL_LENGTH];
|
||||
lt_ptr_t address;
|
||||
|
||||
if (handle->name) { /* this is a libtool module */
|
||||
#ifdef NEED_USCORE
|
||||
if (handle->name && strlen(handle->name) < MAX_SYMBOL_LENGTH-6) {
|
||||
/* this is a libtool module */
|
||||
/* prefix symbol with leading underscore */
|
||||
strcpy(sym, "_");
|
||||
strcat(sym, handle->name);
|
||||
#else
|
||||
if (handle->name && strlen(handle->name) < MAX_SYMBOL_LENGTH-5) {
|
||||
/* this is a libtool module */
|
||||
strcpy(sym, handle->name);
|
||||
#endif
|
||||
strcat(sym, "_LTX_");
|
||||
strcat(sym, symbol);
|
||||
/* try "modulename_LTX_symbol" */
|
||||
address = handle->type->find_sym(handle, sym);
|
||||
if (address)
|
||||
return address;
|
||||
if (strlen(sym)+strlen(symbol) < MAX_SYMBOL_LENGTH) {
|
||||
strcat(sym, symbol);
|
||||
/* try "modulename_LTX_symbol" */
|
||||
address = handle->type->find_sym(handle, sym);
|
||||
if (address)
|
||||
return address;
|
||||
}
|
||||
}
|
||||
/* otherwise try "symbol" */
|
||||
#ifdef NEED_USCORE
|
||||
/* prefix symbol with leading underscore */
|
||||
strcpy(sym, "_");
|
||||
if (strlen(symbol) >= MAX_SYMBOL_LENGTH)
|
||||
return 0;
|
||||
strcat(sym, symbol);
|
||||
return handle->type->find_sym(handle, sym);
|
||||
#else
|
||||
|
@ -9,10 +9,10 @@ EXTRA_DIST = acinclude.m4
|
||||
lib_LTLIBRARIES = libfoo1.la libfoo2.la
|
||||
|
||||
libfoo1_la_SOURCES = foo1.c
|
||||
libfoo1_la_LDFLAGS = -lm -module -avoid-version
|
||||
libfoo1_la_LDFLAGS = $(LIBADD_M) -module -avoid-versioning
|
||||
|
||||
libfoo2_la_SOURCES = foo2.c
|
||||
libfoo2_la_LDFLAGS = -lm -module
|
||||
libfoo2_la_LDFLAGS = $(LIBADD_M) -module
|
||||
|
||||
noinst_HEADERS = foo.h
|
||||
|
||||
@ -21,7 +21,7 @@ bin_PROGRAMS = mdemo mdemo.debug
|
||||
# Create a version of mdemo that does dlopen.
|
||||
mdemo_SOURCES = main.c
|
||||
mdemo_LDADD = ../libltdl/libltdl.la \
|
||||
-lm # We won't need this when libltdl takes care of dependencies
|
||||
$(LIBADD_M) # We won't need this when libltdl takes care of dependencies
|
||||
mdemo_LDFLAGS = -export-dynamic -dlopen libfoo1.la -dlopen libfoo2.la
|
||||
mdemo_DEPENDENCIES = ../libltdl/libltdl.la libfoo1.la libfoo2.la
|
||||
|
||||
|
@ -6,5 +6,10 @@ AC_PROG_CC
|
||||
AC_EXEEXT
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_CHECK_HEADERS(string.h math.h)
|
||||
|
||||
AC_CHECK_LIB(m, cos, LIBADD_M="-lm", LIBADD_M=)
|
||||
AC_SUBST(LIBADD_M)
|
||||
|
||||
dnl Output the makefile
|
||||
AC_OUTPUT(Makefile)
|
||||
|
@ -20,7 +20,10 @@ USA. */
|
||||
|
||||
#include "foo.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#define nothing libfoo1_LTX_nothing
|
||||
#define foo1 libfoo1_LTX_foo1
|
||||
|
@ -20,7 +20,10 @@ USA. */
|
||||
|
||||
#include "foo.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#define nothing libfoo2_LTX_nothing
|
||||
#define foo2 libfoo2_LTX_foo2
|
||||
|
@ -21,8 +21,14 @@ USA. */
|
||||
#include "foo.h"
|
||||
#include "ltdl.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
/* import sin and cos (used by the modules) */
|
||||
extern double sin (double x);
|
||||
|
Loading…
x
Reference in New Issue
Block a user