+2010-08-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Uniform const'ness of symlist variable lt_preloaded_symbols.
+ On some systems, lt_preloaded_symbols may not be declared
+ const due to relocation issues. C99 requires qualification to
+ match for compatible declarations, so ensure we declare
+ const'ness in the same way everywhere; link-time optimization
+ may otherwise rightfully complain about inconsistencies.
+ Since ltdl.h may not depend upon config.h, rely on system
+ defines for choosing const'ness.
+ * NEWS: Update.
+ * doc/libtool.texi (Dlpreopening): Document this issue.
+ * libltdl/config/ltmain.m4sh (func_generate_dlsyms):
+ [__WINDOWS__, __CYGWIN__, _WIN32_WCE]: Define LT_DLSYM_CONST
+ according to system defines. Remove old shell cruft. Use
+ LT_DLSYM_CONST for lt_${my_prefix}_LTX_preloaded_symbols.
+ * libltdl/libltdl/lt_system.h (LT_DLSYM_CONST): Likewise,
+ define LT_DLSYM_CONST according to system defines.
+ * tests/demo/foo.h (LT_DLSYM_CONST): Likewise.
+ * tests/pdemo/foo.h (LT_DLSYM_CONST): Likewise.
+ * tests/demo/dlmain.c (lt_dlsymlist): Use LT_DLSYM_CONST.
+ * tests/pdemo/longer_file_name_dlmain.c (lt_dlsymlist):
+ Likewise.
+ * libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Likewise
+ for configure test code.
+ * libltdl/ltdl.c (preloaded_symbols): Use LT_DLSYM_CONST.
+ * libltdl/ltdl.h (LTDL_SET_PRELOADED_SYMBOLS): Likewise.
+
2010-08-28 Dave Korn <dave.korn.cygwin@googlemail.com>
Ensure cwrapper magic string is not optimized away.
options that begin with '--lt-*' from the argument list before launching
(uninstalled) programs. Any '--lt-*' option on the command line not
recognized by the wrapper will result in an error.
+ - The type of the symbol lists variables (lt_*_LTX_preloaded_symbols) has
+ been fixed in the manual and in a couple of tests to match the actual
+ implementation.
* Changes in supported systems or compilers:
To facilitate inclusion of symbol lists into libraries,
@code{lt_preloaded_symbols} is @samp{#define}d to a suitably unique name
in @file{ltdl.h}.
+
+This variable may not be declared @code{const} on some systems due to
+relocation issues.
@end deftypevar
Some compilers may allow identifiers that are not valid in ANSI C, such
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
#endif
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(__WINDOWS__) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
/* External symbol declarations for the compiler. */\
"
const char *name;
void *address;
} lt_dlsymlist;
-"
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- echo >> "$output_objdir/$my_dlsyms" "\
-/* DATA imports from DLLs on WIN32 con't be const, because
- runtime relocations are performed -- see ld's documentation
- on pseudo-relocs. */"
- lt_dlsym_const= ;;
- *osf5*)
- echo >> "$output_objdir/$my_dlsyms" "\
-/* This system does not cope well with relocations in const data */"
- lt_dlsym_const= ;;
- *)
- lt_dlsym_const=const ;;
- esac
-
- echo >> "$output_objdir/$my_dlsyms" "\
-extern $lt_dlsym_const lt_dlsymlist
+extern LT_DLSYM_CONST lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[];
-$lt_dlsym_const lt_dlsymlist
+LT_DLSYM_CONST lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[] =
{\
{ \"$my_originator\", (void *) 0 },"
/* lt_system.h -- system portability abstraction layer
- Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc.
Written by Gary V. Vaughan, 2004
NOTE: The canonical source of this file is maintained with the
# endif
#endif
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(__WINDOWS__) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
/* Canonicalise Windows and Cygwin recognition macros.
To match the values set by recent Cygwin compilers, make sure that if
__CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */
LT_SCOPE const lt_dlvtable * get_vtable (lt_user_data data);
LT_END_C_DECLS
#ifdef HAVE_LIBDLLOADER
-extern lt_dlsymlist preloaded_symbols[];
+extern LT_DLSYM_CONST lt_dlsymlist preloaded_symbols[];
#endif
/* Initialize libltdl. */
#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols
#define LTDL_SET_PRELOADED_SYMBOLS() LT_STMT_START{ \
- extern const lt_dlsymlist lt_preloaded_symbols[]; \
+ extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[]; \
lt_dlpreload_default(lt_preloaded_symbols); \
}LT_STMT_END
if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(__WINDOWS__) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
cat <<_LT_EOF >> conftest.$ac_ext
/* The mapping between symbol names and symbols. */
-const struct {
+LT@&t@_DLSYM_CONST struct {
const char *name;
void *address;
}
lt_ptr_t address;
} lt_dlsymlist;
-extern const lt_dlsymlist lt_preloaded_symbols[];
+extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];
int
main ()
/* foo.h -- interface to the libfoo library
- Copyright (C) 1996-1999 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999, 2010 Free Software Foundation, Inc.
Written by Gord Matzigkeit, 1996
This file is part of GNU Libtool.
# define lt_ptr_t char*
#endif
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(__WINDOWS__) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
/* Silly constants that the functions return. */
#define HELLO_RET 0xe110
#define FOO_RET 0xf00
/* foo.h -- interface to the libfoo library
- Copyright (C) 1996-1999 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999, 2010 Free Software Foundation, Inc.
Written by Gord Matzigkeit, 1996
This file is part of GNU Libtool.
# define lt_ptr_t char*
#endif
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(__WINDOWS__) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
#ifdef __CYGWIN32__
# ifdef LIBFOO_DLL
/* need some (as yet non-existant) automake magic to tell
lt_ptr_t address;
} lt_dlsymlist;
-extern const lt_dlsymlist lt_preloaded_symbols[];
+extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];
int
main (int argc, char **argv)