+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
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.
\f
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.
/* 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 */
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))
{
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)
{
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@")))
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);
#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(<_preloaded_symbols); \
+ extern const lt_dlsymlist lt_preloaded_symbols[]; \
+ lt_dlpreload_default(lt_preloaded_symbols); \
}LT_STMT_END
/* 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 */