+Tue Jul 29 11:52:10 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
+
+ * ltmain.sh.in: Add NLS environment variable handling copied from
+ ltconfig.in. Reported by Akim Demaille.
+
+ * demo/dlmain.c (main): Use dld_preloaded_symbol_count to display
+ a message about the sortedness of the symbol table.
+
+ * ltconfig.in (nlist): Use an nlist convenience variable, so that
+ code can be shared directly with ltmain.sh.in.
+
+ * ltconfig.in, ltmain.sh.in (dld_preloaded_symbol_count): Count up
+ the number of symbols in the dld_preloaded_symbols. Set to `-1'
+ if the list wasn't both sorted and counted. This allows
+ applications to do a quick binary search, if they are so inclined.
+
Fri Jul 25 10:13:49 1997 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
* ltmain.sh.in (link): Remove code for `-version-file', since it
- has been long-deprecated.
- Disable static linking if hardcode_direct is unsupported.
+ has been long-deprecated.
+
+ Disable static linking if hardcode_direct is unsupported and there
+ is no working link_static_flag. This provides correct behaviour
+ for all cases on AIX 3, regardless of whether collect2 is broken
+ or not. Reported by Mark Kettenis.
* ltconfig.in: Fix typo in test polarity. From Mark Kettenis.
NEWS - list of user-visible changes between releases of GNU libtool.
-New in 1.0a:
+New in 1.0b:
* Bug fixes.
-* Full support for dynamically loaded modules, even on static-only
- platforms, via new `-dlopen' and `-pre-dlopen' link flags.
-* New tests for a BSD-compatible `nm' program, required for dlopened
- modules.
+* Full support for broken collect2 on AIX 3. Now, shared libraries
+ can be built with all working versions of GCC.
* Deleted `dlname' mode. Dlopen applications should only use the
runtime search method described in (libtool)Finding the dlname.
+* Experimental support for dynamically loaded modules, even on
+ static-only platforms, via new `-dlopen' and `-pre-dlopen' link
+ flags.
+* New tests for a BSD-compatible `nm' program, required for dlopened
+ modules.
\f
New in 1.0:
* Bug fixes.
};
extern struct dld_symlist dld_preloaded_symbols[];
+extern int dld_preloaded_symbol_count;
int
main (argc, argv)
printf ("Welcome to *modular* GNU Hell!\n");
+ if (dld_preloaded_symbol_count < 0)
+ printf ("Sorry, the symbol list is not sorted and unique.\n");
+ else
+ printf ("Yippee! The symbol list is both sorted and unique.\n");
+
/* Look up the symbols we require for this demonstration. */
s = dld_preloaded_symbols;
while (s->name)
Dlopened modules
-* Exporting dynamic symbols:: Preparing files to be dlopened.
+* Building modules:: Creating dlopenable objects and libraries.
+* Dlpreopening::
* Finding the dlname:: Choosing the right file to @code{dlopen(3)}.
* Dlopen issues:: Unresolved problems that need your attention.
language interpreters to provide an efficient way to extend the
language.
-On most operating systems, dlopened modules must be compiled as PIC.
-This restriction simplifies the implementation of the @code{dlopen(3)}
-family of functions by avoiding symbol relocation. ``True'' dlopen
-implementations, such as the unportable GNU DLD 3 implementation
-(@pxref{Top,, Introduction, dld, The DLD Manual}), don't have this
-restriction, as they can perform relocation at runtime.
-
-As of version @value{VERSION}, libtool provides only minimal support for
-dlopened modules, and this support is guaranteed to change and be
-redesigned in the near future. Because there is not a very high
-proportion of applications that use dlopening, adding this support to
-libtool was not deemed a priority for the 1.0 release.
+As of version @value{VERSION}, libtool provides experimental support for
+dlopened modules, which does not radically simplify the development of
+dlopening applications. However, this support is designed to be a
+portable foundation for generic, higher-level dlopen functions.
This chapter discusses the preliminary support that libtool offers, and
how you as a dlopen application developer might use libtool to generate
problems associated with dlopened modules.
@menu
-* Exporting dynamic symbols:: Preparing files to be dlopened.
+* Building modules:: Creating dlopenable objects and libraries.
+* Dlpreopening::
* Finding the dlname:: Choosing the right file to @code{dlopen(3)}.
* Dlopen issues:: Unresolved problems that need your attention.
@end menu
-@node Exporting dynamic symbols
-@section Exporting dynamic symbols
+@node Building modules
+@section Building modules to dlopen
-In order for a symbol to be dynamically resolved (typically using the
-@code{dlsym(3)} function), it must be specially declared in the object
-module where it is defined.
+On some operating systems, a program symbol must be specially declared
+in order to be dynamically resolved with the @code{dlsym(3)} (or
+equivalent) function.
Libtool provides the @samp{-export-dynamic} link flag (@pxref{Link
mode}), which does this declaration. You need to use this flag if you
-are linking a shared library that will be dlopened.
+are linking an application program that dlopens other modules or a
+libtool library that will also be dlopened.
For example, if we wanted to build a shared library, @file{libhello},
that would later be dlopened by an application, we would add
burger$
@end example
+@node Dlpreopening
+@section Dlpreopening
+
+Libtool provides special support for dlopening libtool object and
+libtool library files, so that their symbols can be resolved @emph{even
+on platforms without any @code{dlopen(3)} and @code{dlsym(3)}
+functions.}.
+
+Consider the following alternative ways of loading code into your
+program, in order of increasing ``laziness'':
+
+@enumerate 1
+@item
+Linking against object files that become part of the program executable,
+whether or not they are referenced. If an object file cannot be found,
+then the linker refuses to create the executable.
+
+@item
+Declaring a static library to the linker, so that it is searched at link
+time in order to satisfy any undefined references in the above object
+files. If the static library cannot be found, then the linker refuses
+to link the executable.
+
+@item
+Declaring a shared library to the runtime linker, so that it is searched
+at runtime in order to satisfy any undefined references in the above
+files. If the shared library cannot be found, then the dynamic linker
+aborts the program before it runs.
+
+@item
+Dlopening a module, so that the application can resolve its own,
+dynamically-computed references. If there is an error opening the
+module, then the application can
+@end enumerate
+
+
@node Finding the dlname
@section Finding the correct name to dlopen
@cindex Names of dynamic modules
mipsel-unknown-openbsd2.1 gcc 1.0 ok
powerpc-ibm-aix4.1.4.0 xlc 1.0 ok
powerpc-ibm-aix4.1.4.0 gcc 1.0 ok
-rs6000-ibm-aix3.2.5 xlc 0.9h ok
-rs6000-ibm-aix3.2.5 gcc 0.9h ok*
+rs6000-ibm-aix3.2.5 xlc 1.0a ok
+rs6000-ibm-aix3.2.5 gcc 1.0a ok*
sparc-sun-linux2.1.23 gcc 0.9h ok
sparc-sun-sunos4.1.4 cc 1.0 ok
sparc-sun-sunos4.1.4 gcc 1.0 ok
sparc-sun-solaris2.5 gcc 1.0a ok
--------------------------------------------------------
-* Libtool will not build shared libraries because of a bug in
-GCC 2.7.2.2's collect2 linker program.
+* Some versions of GCC's collect2 linker program cannot link trivial
+static binaries on AIX 3. For these configurations, libtool's `-static'
+flag has no effect.
old_NM="$NM"
old_RANLIB="$RANLIB"
-test -z "$AR" && AR=ar
-
# Parse the command line options.
args=
prev=
old_archive_cmds='$AR cru $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
+# Set a sane default for `AR'.
+test -z "$AR" && AR=ar
+
# If RANLIB is not set, then run the test.
if test "${RANLIB+set}" != "set"; then
result=no
# LINENO
if { (eval echo $progname:771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then
# Now try to grab the symbols. LINENO
- if { echo "$progname:773: eval \"$NM conftest.o | $global_symbol_pipe > conftest.nm\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > conftest.nm 2>&5"; } && test -s conftest.nm; then
+ nlist=conftest.nm
+ if { echo "$progname:773: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
# Try sorting and uniquifying the output.
- sort conftest.nm | uniq > conftest.nmT && mv -f conftest.nmT conftest.nm
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ wcout=`wc "$nlist" 2>/dev/null`
+ count=`echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
+ test "$wcout" = "$count" && count=-1
+ else
+ rm -f "$nlist"T
+ count=-1
+ fi
# Make sure that we snagged all the symbols we need.
- if egrep ' nm_test_var$' conftest.nm >/dev/null; then
- if egrep ' nm_test_func$' conftest.nm >/dev/null; then
+ if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then
# Now generate the symbol file.
- sed 's/^.* \(.*\)$/extern char \1;/' < conftest.nm > conftest.c
- cat <<\EOF >> conftest.c
+ sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" > conftest.c
+
+ cat <<EOF >> conftest.c
#if defined (__STDC__) && __STDC__
# define __ptr_t void *
#else
# define __ptr_t char *
#endif
+/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
+int dld_preloaded_symbol_count = $count;
+
/* The mapping between symbol names and symbols. */
struct {
char *name;
dld_preloaded_symbols[] =
{
EOF
- sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < conftest.nm >> conftest.c
+ sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < "$nlist" >> conftest.c
cat <<\EOF >> conftest.c
{0},
};
LIBS="$save_LIBS"
fi
else
- echo "cannot find nm_test_func in conftest.nm" >&5
+ echo "cannot find nm_test_func in $nlist" >&5
fi
else
- echo "cannot find nm_test_var in conftest.nm" >&5
+ echo "cannot find nm_test_var in $nlist" >&5
fi
else
echo "$progname: failed program was:" >&5
objdir=.libs
rm="rm -f"
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+
if test "$LTCONFIG_VERSION" != "$VERSION"; then
echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
# Parse the name list into a C file.
echo "creating $dlsyms"
if test -z "$run"; then
- # Try sorting and uniquifying the output.
- sort "$nlist" | uniq > "$nlist"T && mv -f "$nlist"T "$nlist"
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ wcout=`wc "$nlist" 2>/dev/null`
+ count=`echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
+ test "$wcout" = "$count" && count=-1
+ else
+ rm -f "$nlist"T
+ count=-1
+ fi
cat <<EOF > "$dlsyms"
/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
/* External symbol declarations for the compiler. */
EOF
if test -f "$nlist"; then
- # Prevent the only kind of circular reference mistake we can make.
- sed -e '/ dld_preloaded_symbols$/d' -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$dlsyms"
+ # Prevent the only kind of circular reference mistakes we can make.
+ sed -e '/ dld_preloaded_symbol\(s\|_count\)$/d' -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$dlsyms"
else
echo "/* NONE */" >> "$dlsyms"
fi
- cat <<\EOF >> "$dlsyms"
+ cat <<EOF >> "$dlsyms"
#if defined (__STDC__) && __STDC__
# define __ptr_t void *
# define __ptr_t char *
#endif
+/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
+int dld_preloaded_symbol_count = $count;
+
/* The mapping between symbol names and symbols. */
struct {
char *name;