Don't use C99 flexible array types as we want to be C89

compatible.  Instead, revert to the old way of doing things with
an array of symbol name vs. address, and adding the originator as
the first symbol but with a NULL address:

* config/ltmain.in (func_extract_dlsyms): Store originator as a
NULL address symbol.
* libltdl/ltdl.h (lt_dlsymbol): Removed.
(lt_dlsymlist): Remove originator field.
(LTDL_SET_PRELOADED_SYMBOLS): Adjust.
* libltdl/loaders/preopen.c (vm_open, lt_dlpreload_open): Adjust
for new types.
(vm_sym): Skip the new originator symbol when scanning symbol
names.
* m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Adjust preloaded symbols
test file to match.
* NEWS: Updated.
This commit is contained in:
Gary V. Vaughan 2004-09-01 01:22:26 +00:00
parent 1e6bed0fb7
commit 53f09b2d98
6 changed files with 41 additions and 34 deletions

View File

@ -1,3 +1,23 @@
2004-09-01 Gary V. Vaughan <gary@gnu.org>
Don't use C99 flexible array types as we want to be C89
compatible. Instead, revert to the old way of doing things with
an array of symbol name vs. address, and adding the originator as
the first symbol but with a NULL address:
* config/ltmain.in (func_extract_dlsyms): Store originator as a
NULL address symbol.
* libltdl/ltdl.h (lt_dlsymbol): Removed.
(lt_dlsymlist): Remove originator field.
(LTDL_SET_PRELOADED_SYMBOLS): Adjust.
* libltdl/loaders/preopen.c (vm_open, lt_dlpreload_open): Adjust
for new types.
(vm_sym): Skip the new originator symbol when scanning symbol
names.
* m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Adjust preloaded symbols
test file to match.
* NEWS: Updated.
2004-09-01 Gary V. Vaughan <gary@gnu.org>
Libtool currently assumes that certain characteristics, such as

2
NEWS
View File

@ -2,6 +2,8 @@ NEWS - list of user-visible changes between releases of GNU Libtool
New in 1.9d: 2004-??-??; CVS version 1.9c, Libtool team:
* Return type of lt_dlloader_remove is no longer `const'.
* libltdl is C89 compatible again. lt_dlsymbol type removed, and lt_dlsymlist
structure changed to avoid using C99 flexible arrays.
New in 1.9b: 2004-08-29; CVS version 1.5a, Libtool team:
* The /^_?LT_[A-Z_]+$/ namespace is now reserved for Libtool's own macros.

View File

@ -962,23 +962,18 @@ extern \"C\" {
/* The mapping between symbol names and symbols. */
const struct {
const char *originator;
const struct {
const char *name;
void *address;
} symbols[];
const char *name;
void *address;
}
lt_${my_prefix}_LTX_preloaded_symbols =
lt_${my_prefix}_LTX_preloaded_symbols[] =
{\
\"$my_originator\",
{
{ \"$my_originator\", (void *) 0 },
"
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
$echo >> "$output_objdir/$my_dlsyms" "\
{0, (void *) 0}
}
};
/* This works around a problem in FreeBSD linker */

View File

@ -158,8 +158,8 @@ vm_open (lt_user_data loader_data, const char *filename)
for (lists = preloaded_symlists; lists; lists = lists->next)
{
const lt_dlsymbol *symbol;
for (symbol= lists->symlist->symbols; symbol->name; ++symbol)
const lt_dlsymlist *symbol;
for (symbol= lists->symlist; symbol->name; ++symbol)
{
if (!symbol->address && streq (symbol->name, filename))
{
@ -192,10 +192,9 @@ vm_close (lt_user_data loader_data, lt_module module)
static void *
vm_sym (lt_user_data loader_data, lt_module module, const char *name)
{
lt_dlsymlist *symlist = (lt_dlsymlist*) module;
const lt_dlsymbol *symbol = symlist->symbols;
lt_dlsymlist *symbol = (lt_dlsymlist*) module;
++symbol; /* Skip header. */
symbol +=2; /* Skip header (originator then libname). */
while (symbol->name)
{
@ -320,15 +319,16 @@ lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func)
for (list = preloaded_symlists; list; list = list->next)
{
/* ...that was preloaded by the requesting ORIGINATOR... */
if (streq (list->symlist->originator, originator))
if (streq (list->symlist->name, originator))
{
const lt_dlsymbol *symbol;
const lt_dlsymlist *symbol;
unsigned int idx = 0;
++found;
/* ...load the symbols per source compilation unit: */
while ((symbol = &list->symlist->symbols[idx++])->name != 0)
/* ...load the symbols per source compilation unit:
(we preincrement the index to skip over the originator entry) */
while ((symbol = &list->symlist[++idx])->name != 0)
{
if ((symbol->address == 0)
&& (strneq (symbol->name, "@PROGRAM@")))

View File

@ -84,11 +84,6 @@ LT_SCOPE int lt_dlisresident (lt_dlhandle handle);
typedef struct {
const char *name;
void *address;
} lt_dlsymbol;
typedef struct {
const char *originator;
const lt_dlsymbol symbols[];
} lt_dlsymlist;
typedef int lt_dlpreload_callback_func (lt_dlhandle handle);
@ -100,8 +95,8 @@ LT_SCOPE int lt_dlpreload_open (const char *originator,
#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols
#define LTDL_SET_PRELOADED_SYMBOLS() LT_STMT_START{ \
extern const lt_dlsymlist lt_preloaded_symbols; \
lt_dlpreload_default(&lt_preloaded_symbols); \
extern const lt_dlsymlist lt_preloaded_symbols[]; \
lt_dlpreload_default(lt_preloaded_symbols); \
}LT_STMT_END

13
m4/libtool.m4 vendored
View File

@ -2793,21 +2793,16 @@ _LT_EOF
/* The mapping between symbol names and symbols. */
const struct {
const char *originator;
const struct {
const char *name;
void *address;
} symbols[[]];
const char *name;
void *address;
}
lt__PROGRAM__LTX_preloaded_symbols =
lt__PROGRAM__LTX_preloaded_symbols[[]] =
{
"@PROGRAM@",
{
{ "@PROGRAM@", (void *) 0 },
_LT_EOF
$SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
cat <<\_LT_EOF >> conftest.$ac_ext
{0, (void *) 0}
}
};
/* This works around a problem in FreeBSD linker */