]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Uniform const'ness of symlist variable lt_preloaded_symbols.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 4 Apr 2010 08:56:47 +0000 (10:56 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 28 Aug 2010 12:51:36 +0000 (14:51 +0200)
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.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12 files changed:
ChangeLog
NEWS
doc/libtool.texi
libltdl/config/ltmain.m4sh
libltdl/libltdl/lt_system.h
libltdl/ltdl.c
libltdl/ltdl.h
libltdl/m4/libtool.m4
tests/demo/dlmain.c
tests/demo/foo.h
tests/pdemo/foo.h
tests/pdemo/longer_file_name_dlmain.c

index 5df42d403d25add1b28299942eaa0f47ece9c6a6..6537ede6af76859742c0f6a4ff5cf477b4362528 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+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.
diff --git a/NEWS b/NEWS
index ba7ce0025d5dee31e8523436f722cce2b0213823..688bdca6bb1b8fb99a922c1717c6c1642f5ddc8a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -83,6 +83,9 @@ New in 2.2.7b 2010-05-20: git version 2.2.7a, Libtool team:
     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:
 
index be7d3bfa0b2b4d587696f3f054b066fbddc4d31c..a3f1c59e686211d75a8865ea8e4f6a3055e32ccb 100644 (file)
@@ -3421,6 +3421,9 @@ The last element of all has a @var{name} and @var{address} of
 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
index 746718ab8af3d6e0a1e026732c27053e9ac62273..a7da74ffbcc5c5c0c6d91752312162abb6eebea1 100644 (file)
@@ -2004,6 +2004,18 @@ extern \"C\" {
 #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. */\
 "
 
@@ -2145,26 +2157,9 @@ typedef struct {
   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 },"
index dab2ab6b39fdae21a9c30868565124c99ed66304..a8481d667b50fbc89edcb237ed61bac5d44c648d 100644 (file)
@@ -1,6 +1,6 @@
 /* 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
@@ -76,6 +76,18 @@ or obtained by writing to the Free Software Foundation, Inc.,
 #  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!  */
index 992584c9c483c733d01511d8a8ffc70596050d46..be1e4c093b01b73aa82bcad774a260fd3ee7acf6 100644 (file)
@@ -213,7 +213,7 @@ LT_BEGIN_C_DECLS
 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. */
index 8b516ad64c48f74ea6c6bfb33008ff5f62621cec..5154da1aa83f5ecd10b5f2b139981fd5c526ee1e 100644 (file)
@@ -103,7 +103,7 @@ 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[];               \
+       extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];      \
        lt_dlpreload_default(lt_preloaded_symbols);                     \
                                                        }LT_STMT_END
 
index 305e2d84c70feb7c8d907d8fa89d1297f35a0a1e..2f626910709dd585b525fb3a274509f8a961511e 100644 (file)
@@ -3647,6 +3647,18 @@ _LT_EOF
       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
@@ -3658,7 +3670,7 @@ _LT_EOF
          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;
 }
index c970998d4cb0db9574f4fb92c9ad6c9429e4164f..8c8be09e75f85b5c412b009af611e66d4f442263 100644 (file)
@@ -34,7 +34,7 @@ typedef struct
   lt_ptr_t address;
 } lt_dlsymlist;
 
-extern const lt_dlsymlist lt_preloaded_symbols[];
+extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[];
 
 int
 main ()
index 287f9c318b7d80ea2c8433b4b9f2cb08267078be..838264ea3a872b12a621a679914745376489c3a6 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
@@ -62,6 +62,18 @@ or obtained by writing to the Free Software Foundation, Inc.,
 # 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
index f09db19f8150b756161e6de0ebe522813e5bd0b4..dd4e86d0454f7d7852494218aeba05a65365314a 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
@@ -61,6 +61,18 @@ or obtained by writing to the Free Software Foundation, Inc.,
 # 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
index ef1e4c5b44937c55b8300ba8251870da0f1291bb..ad223dcec72f9a1798aa6819a6e377efd24eface 100644 (file)
@@ -34,7 +34,7 @@ typedef struct
   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)