]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
*** empty log message *** release-1-0a
authorGordon Matzigkeit <gord@gnu.ai.mit.edu>
Sat, 12 Jul 1997 21:39:00 +0000 (21:39 +0000)
committerGordon Matzigkeit <gord@gnu.org>
Sat, 12 Jul 1997 21:39:00 +0000 (21:39 +0000)
15 files changed:
ChangeLog
Makefile.am
NEWS
TODO
configure.in
demo/Makefile.am
doc/libtool.texi
doc/platforms.texi
libtool.m4
libtool.spec
ltconfig.in
ltmain.sh.in
tests/ChangeLog
tests/demo-exec.test
tests/demo-inst.test

index 373f482f96d1c2b935614f4277e6a0d500b321d9..afcf774fc6818c2f2cd91158a0b2b323c0357624 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Sat Jul 12 10:07:28 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
+
+       * demo/Makefile.am: Add helldl, made from dlmain.c, to demostrate
+       `-dlopen' usage.
+
+       * demo/dlmain.c: New file to demonstrate preloaded modules.
+
+       * ltmain.sh.in (link): Add `-dlopen' flag to preload dynamic
+       modules, even on static platforms.  Use `$NM' and
+       `$global_symbol_cmd' to extract symbols from required files.
+       (dlname): Delete dlname mode entirely.  It is rendered obsolete
+       because the `.la' file format is now a public interface.
+
+       * ltconfig.in (NM): New variable for BSD-compatible nm program.
+       (global_symbol_cmd): Pipeline to extract global symbols from the
+       nm output.
+
+       * ltmain.sh.in: The .la file header should depend on `ltmain.sh',
+       not `$PROGRAM'.
+       (link): Make sure $export_dynamic_flag is eval'ed before it is
+       used.
+
 Fri Jul 11 19:33:02 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
 
        * libtool.spec: New Red Hat Package Manager specification file in
index 90af84aa28ff8a281d524ce8cbcde5ff99c277fd..81641895fffedc43f015e904d20127314b235f6a 100644 (file)
@@ -34,7 +34,7 @@ bin_SCRIPTS = libtool libtoolize
 libtool: ltconfig
        @echo 'WARNING: Warnings from ltconfig can be ignored. :-)'
        CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
-       LD="$(LD)" LN_S="$(LN_S)" RANLIB="$(RANLIB)" \
+       LD="$(LD)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
        $(srcdir)/ltconfig --srcdir=$(srcdir) $(pkgdatadir)/ltmain.sh
 
 libtoolize: libtoolize.in $(top_builddir)/config.status
diff --git a/NEWS b/NEWS
index 7754f7a96a405ff57b0642095800bf46a263e060..151c1c29260f51449653454a65f724726278f89b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,14 @@
 NEWS - list of user-visible changes between releases of GNU libtool.
 
+New in 1.0a:
+* Bug fixes.
+* Full support for dynamically loaded modules, even on static-only
+  platforms, via a new `-dlopen' link flag.
+* New tests for a BSD-compatible `nm' program, required for dlopened
+  modules.
+* FIXME: Deleted `dlname' mode, now that the internal structure of `.la'
+  files is a public interface.
+\f
 New in 1.0:
 * Bug fixes.
 * Better configuration test to find the system linker.  The old test
diff --git a/TODO b/TODO
index 4c433c8527d9a9bfb2938c4d63d7c7160f999bb5..2239f42c34496ea62b4bb3aea68d48ebef535c55 100644 (file)
--- a/TODO
+++ b/TODO
@@ -17,6 +17,22 @@ symbols to be included in a libtool archive.
 different major versions of the same .la to coexist.  This also
 involves writing a better uninstall mode, so that nothing breaks.
 
+Semantics:
+
+# Just link a library normally.
+./libtool gcc -o testld testld.o libhello.la -lm
+
+# Again, link normally.
+./libtool gcc -o testld -export-dynamic testld.o libhello.la -lm
+
+# This time, preload the symbols from the specified library (or
+# object), as well as normal linking.
+./libtool gcc -o testld -export-dynamic testld.o -dlopen libhello.la -lm
+dlfiles="$dlfiles libhello.la"
+
+This defines an array called `dld_preloaded_symbols', that can be used
+to lookup symbols already present in the running executable.
+
 * Implement full multi-language support.  Currently, this is only for
 C++, but there are beginnings of this in the manual (Other Languages).
 This includes writing libtool not to be so dependent on the compiler
index 52f41c83c8cfdd9bcb5c4d4074ff61061fafea12..d6ab96078347ccc58d96d7bbf554fb8d246d0fbb 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to create configure.
 AC_INIT(ltmain.sh.in)
-AM_INIT_AUTOMAKE(libtool,1.0)
+AM_INIT_AUTOMAKE(libtool,1.0a)
 
 pkgdatadir='${datadir}/libtool'
 AC_SUBST(pkgdatadir)
@@ -11,6 +11,7 @@ dnl Use the specified CC, RANLIB, and LD while running ltconfig.
 AC_PROG_CC
 AC_PROG_RANLIB
 AM_PROG_LD
+AM_PROG_NM
 AC_PROG_LN_S
 
 AC_OUTPUT([Makefile doc/Makefile tests/Makefile])
index c7d7a9ed8bbc493faa9c287dd27d0b82a511c5e2..d673842039eb26c1e41d829f5b0a915e9af905bd 100644 (file)
@@ -13,7 +13,7 @@ libhello_la_LDFLAGS = -version-info 3:12:1
 
 include_HEADERS = foo.h
 
-bin_PROGRAMS = hell hell.static
+bin_PROGRAMS = hell hell.static helldl
 
 # Build hell from main.c and libhello.la
 hell_SOURCES = main.c
@@ -24,6 +24,10 @@ hell_static_SOURCES = main.c
 hell_static_LDADD = libhello.la
 hell_static_LDFLAGS = -static
 
+# Create a version of hell that does its own dlopening.
+helldl_SOURCES = dlmain.c
+helldl_LDFLAGS = -dlopen libhello.la
+
 TESTS = run.test
 
 # The following rules are only for the libtool demo and tests.
index 149b905d79712c7c67ae84abeb9d7e76a99a642e..b26a076b195803b54fdaa1df6a7a11c7296c9465 100644 (file)
@@ -2425,6 +2425,10 @@ within @code{ltmain.sh}:
 The name of the system library archiver.
 @end defvar
 
+@defvar CC
+The name of the C compiler used to configure libtool.
+@end defvar
+
 @defvar LD
 The name of the linker that libtool should use internally for reloadable
 linking and possibly shared libraries.
@@ -2436,6 +2440,17 @@ prevent mismatches between the configuration information in
 @code{libtool}, and how that information is used in @code{ltmain.sh}.
 @end defvar
 
+@defvar NM
+The name of a BSD-compatible @code{nm} program, which produces listings
+of global symbols in one the following formats:
+
+@example
+@var{address} C @var{global-variable-name}
+@var{address} D @var{global-variable-name}
+@var{address} T @var{global-function-name}
+@end example
+@end defvar
+
 @defvar RANLIB
 Set to the name of the ranlib program, if any.
 @end defvar
@@ -2473,6 +2488,20 @@ Commands to tell the dynamic linker how to find shared libraries in a
 specific directory.
 @end defvar
 
+@defvar global_symbol_cmd
+A pipeline that takes the output of @var{NM}, and produces a listing of
+raw symbols followed by their C names.  For example:
+
+@example
+$ @kbd{$NM | $global_symbol_cmd}
+@var{symbol1} @var{C-symbol1}
+@var{symbol2} @var{C-symbol2}
+@var{symbol3} @var{C-symbol3}
+@dots{}
+$
+@end example
+@end defvar
+
 @defvar hardcode_action
 Either @samp{immediate} or @samp{relink}, depending on whether shared
 library paths can be hardcoded into executables before they are installed,
index 9505907bef25f8a7637407a29c1a44d8330807f2..bdae826dd7cb0b9060fc56c23d2ef51d065f909e 100644 (file)
@@ -15,7 +15,7 @@ i386-unknown-freebsd2.1.5    gcc       0.5       ok
 i386-unknown-gnu0.0          gcc       0.5       ok
 i386-unknown-netbsd1.2       gcc       0.9g      ok
 i586-pc-linux-gnu1.3.20      gcc       1.0       ok
-i586-pc-linux-gnu2.0.16      gcc       1.0       ok
+i586-pc-linux-gnu2.0.16      gcc       1.0a      ok
 mips-sgi-irix5.3             cc        0.8       ok
 mips-sgi-irix5.3             gcc       0.8       ok
 mips-sgi-irix6.2             cc -32    0.9       ok
index f7d1d9b44cdf16d9987cc1714ccf712c595c9a07..e449e9a7f02ea00fa30c5cfde7ae5a8e5e4239bf 100644 (file)
 # serial 9 AM_PROG_LIBTOOL
 AC_DEFUN(AM_PROG_LIBTOOL,
 [AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([AC_PROG_CC])
 AC_REQUIRE([AC_PROG_RANLIB])
+AC_REQUIRE([AC_PROG_CC])
 AC_REQUIRE([AM_PROG_LD])
+AC_REQUIRE([AM_PROG_NM])
 AC_REQUIRE([AC_PROG_LN_S])
 
 # Always use our own libtool.
@@ -69,7 +70,7 @@ esac]
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" RANLIB="$RANLIB" LN_S="$LN_S" \
+LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
 || AC_MSG_ERROR([libtool configure failed])
@@ -129,3 +130,36 @@ else
   ac_cv_prog_gnu_ld=no
 fi])
 ])
+
+# AM_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AM_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[case "$NM" in
+/*)
+  ac_cv_path_NM="$NM" # Let the user override the test with a path.
+  ;;
+*)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in /usr/ucb:$PATH:/bin; do
+    test -z "$ac_dir" && dir=.
+    if test -f $ac_dir/nm; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
+        ac_cv_path_NM="$ac_dir/nm -B"
+      elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
+        ac_cv_path_NM="$ac_dir/nm -p"
+      else
+        ac_cv_path_NM="$ac_dir/nm"
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+  ;;
+esac])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+AC_SUBST(NM)
+])
index 4ca76281b39af34d1f1d2ad1d16c6f36f40ab179..ab5e1c715dc7d956c655ad4954e6f5da96c8018d 100644 (file)
@@ -1,6 +1,6 @@
 Summary: GNU libtool - shared library support for source packages
 Name: libtool
-Version: 1.0
+Version: 1.1
 Release: 1
 Copyright: GPL
 Group: Development/Build
index 37b367dbfdbac87b53717d913ac6ba7012bf1ff2..19b5ba3d8ddf64c4453ce72cf37eb58276508d6f 100755 (executable)
@@ -61,6 +61,7 @@ old_CFLAGS="$CFLAGS"
 old_CPPFLAGS="$CPPFLAGS"
 old_LD="$LD"
 old_LN_S="$LN_S"
+old_NM="$NM"
 old_RANLIB="$RANLIB"
 
 test -z "$AR" && AR=ar
@@ -607,7 +608,7 @@ else
   case "$host_os" in
   aix3*)
     allow_undefined_flag=unsupported
-    archive_cmds='/usr/ucb/nm$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname'
+    archive_cmds='$NM$libobjs | $global_symbol_pipe | sed \"s/.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname'
     # Note: this linker hardcodes the directories in LIBPATH if there
     # are no directories specified by -L.
     hardcode_minus_L=yes
@@ -615,7 +616,7 @@ else
 
   aix4*)
     allow_undefined_flag=unsupported
-    archive_cmds='/bin/nm -B$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
+    archive_cmds='$NM$libobjs | $global_symbol_pipe | sed \"s/.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
     hardcode_direct=yes
     hardcode_minus_L=yes
     ;;
@@ -708,6 +709,57 @@ else
 fi
 echo $ac_t "$ld_shlibs" 1>&6
 
+if test -z "$NM"; then
+  echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
+  case "$NM" in
+  /*) ;; # Let the user override the test with a path.
+  *)
+    IFS="${IFS=        }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+    for ac_dir in /usr/ucb:$PATH:/bin; do
+      test -z "$ac_dir" && dir=.
+      if test -f $ac_dir/nm; then
+        # Check to see if the nm accepts a BSD-compat flag.
+        if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
+          NM="$ac_dir/nm -B"
+        elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
+          NM="$ac_dir/nm -p"
+       else
+          NM="$ac_dir/nm"
+       fi
+        break
+      fi
+    done
+    IFS="$ac_save_ifs"
+    test -z "$NM" && NM=nm
+    ;;
+  esac
+  echo "$ac_t$NM" 1>&6
+fi
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
+global_symbol_pipe=
+# WARNING: these filters need to be compatible with GNU nm, so they should
+# accept at least [BDT].
+case "$host_os" in
+aix*)
+  global_symbol_pipe="sed '/^.* [BCDT] [^.]/!d; s/^.* [BCDT] \(.*\)$/\1 \1/'"
+  ;;
+
+# These platforms may need to strip leading underscores from C symbols.
+linux-gnuoldld*) ;;
+
+linux*)
+  global_symbol_pipe="sed '/^.* [BCDT] /!d; s/^.* [BCDT] \(.*\)$/\1 \1/'"
+  ;;
+esac
+
+if test -z "$global_symbol_pipe"; then
+  echo "$ac_t"no
+else
+  echo "$ac_t"yes
+fi
+
 # Check hardcoding attributes.
 echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
 hardcode_action=
@@ -925,7 +977,7 @@ cat <<EOF > $ofile
 # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 #
 # CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\
-# LD="$old_LD" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
+# LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
 #   $0$ltconfig_args
 #
 # Compiler and other test output produced by $progname, useful for
@@ -947,12 +999,18 @@ host="$host"
 # The archiver.
 AR='$AR'
 
+# The default C compiler.
+CC='$CC'
+
 # The linker used to build libraries.
 LD='$LD'
 
 # Whether we need hard or soft links.
 LN_S='$LN_S'
 
+# A BSD-compatible nm program.
+NM='$NM'
+
 # How to create reloadable object files.
 reload_flag='$reload_flag'
 reload_cmds='$reload_cmds'
@@ -997,6 +1055,9 @@ allow_undefined_flag='$allow_undefined_flag'
 # Commands used to finish a libtool library installation in a directory.
 finish_cmds='$finish_cmds'
 
+# Take the output of nm and produce a listing of raw symbols and C names
+global_symbol_pipe="$global_symbol_pipe"
+
 # How to strip a library file.
 striplib='$striplib'
 old_striplib='$old_striplib'
index e43820473a04763aeed98c1443058aad07ed984b..27b2433367fce7b10679545c3f3ad29e0dd4962e 100644 (file)
@@ -158,9 +158,6 @@ if test -z "$show_help"; then
     *rm)
       mode=uninstall
       ;;
-    *.la)
-      mode=dlname
-      ;;
     *)
       # Just use the default operation mode.
       if test -z "$mode"; then
@@ -295,6 +292,7 @@ if test -z "$show_help"; then
     compile_shlibpath=
     finalize_shlibpath=
     deplibs=
+    dlfiles=
     export_dynamic=no
     hardcode_libdirs=
     install_libdir=
@@ -333,10 +331,22 @@ if test -z "$show_help"; then
          ;;
        esac
 
-       eval "$prev=\$arg"
-       prev=
-
-       continue
+       case "$prev" in
+        dlopen)
+         if test -z "$dlfiles"; then
+           # Add the symbol object into the linking commands.
+           compile_command="$compile_command @SYMFILE@"
+           finalize_command="$compile_command @SYMFILE@"
+         fi
+         dlfiles="$dlfiles $arg"
+          prev=
+          ;;
+        *)
+         eval "$prev=\$arg"
+         prev=
+         continue
+          ;;
+        esac
       fi
 
       args="$args $arg"
@@ -345,10 +355,15 @@ if test -z "$show_help"; then
       case "$arg" in
       -allow-undefined) allow_undefined=yes ;;
 
+      -dlopen)
+       prev=dlopen
+       continue
+       ;;
+
       -export-dynamic)
        export_dynamic=yes
-       compile_command="$compile_command $export_dynamic_flag"
-       finalize_command="$finalize_command $export_dynamic_flag"
+       compile_command="$compile_command "`eval echo "$export_dynamic_flag"`
+       finalize_command="$finalize_command "`eval echo "$export_dynamic_flag"`
        continue
        ;;
 
@@ -421,7 +436,7 @@ if test -z "$show_help"; then
        old_library=
 
        # Check to see that this really is a libtool archive.
-       if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
+       if egrep "^# Generated by ltmain.sh" $arg >/dev/null 2>&1; then :
        else
          echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
          exit 1
@@ -621,6 +636,13 @@ if test -z "$show_help"; then
        exit 1
       fi
 
+      if test -n "$dlfiles"; then
+       echo "$progname: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
+       # Nullify the symbol file.
+       compile_command=`echo "$compile_command" | sed "s%@SYMFILE@%%"`
+       finalize_command=`echo "$finalize_command" | sed "s%@SYMFILE@%%"`
+      fi
+
       if test -z "$install_libdir"; then
        echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
        exit 1
@@ -794,6 +816,13 @@ if test -z "$show_help"; then
        echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
       fi
 
+      if test -n "$dlfiles"; then
+       echo "$progname: warning: \`-dlopen' is ignored while creating objects" 1>&2
+       # Nullify the symbol file.
+       compile_command=`echo "$compile_command" | sed "s%@SYMFILE@%%"`
+       finalize_command=`echo "$finalize_command" | sed "s%@SYMFILE@%%"`
+      fi
+
       if test -n "$install_libdir"; then
         echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
       fi
@@ -878,6 +907,116 @@ if test -z "$show_help"; then
        # Transform all the library objects into standard objects.
        compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
        finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'`
+       dlfiles=`echo "$dlfiles " | sed 's/\.lo /.o /g; s/ $//'`
+      fi
+
+      if test -n "$dlfiles"; then
+       if test -z "$global_symbol_pipe" || test -z "$NM"; then
+         echo "$progname: not configured to extract global symbols from \`-dlopen' files" 1>&2
+         exit 1
+       fi
+
+        # Discover the nlist of each of the dlfiles.
+       dlsyms="$objdir/${output}S.c"
+       nlist="$objdir/${output}.syms"
+
+       $run rm -f $nlist
+       for arg in $dlfiles; do
+         pre_dlname=
+         case "$arg" in
+         *.a | *.o) pre_dlname="$arg" ;;
+         *.la)
+           # We already checked for libtool archive validity above.
+
+           # Find the directory that the archive lives in.
+           ltlib=`echo "$arg" | sed 's%^.*/%%'`
+           dir=`echo "$arg" | sed 's%/[^/]*$%%'`
+           test "X$dir" = "X$arg" && dir=.
+
+           # Read the libtool archive.
+           old_library=
+           library_names=
+           . $dir/$ltlib
+
+           # Prefer the new library to the old one.
+           if test -n "$library_names"; then
+             set dummy $library_names
+             pre_dlname="$2"
+           else
+             pre_dlname="$old_library"
+           fi
+
+           if test -f "$dir/$objdir/$pre_dlname"; then
+             pre_dlname="$dir/$objdir/$pre_dlname"
+           elif test -f "$dir/$pre_dlname"; then
+             pre_dlname="$dir/$pre_dlname"
+           else
+             echo "$progname: cannot find \`$pre_dlname' in \`$dir/$objdir' or \`$dir'" 1>&2
+             pre_dlname=
+           fi
+           ;;
+         esac
+
+         if test -z "$pre_dlname"; then
+           echo "$progname: \`$arg' is not a dlopenable file" 1>&2
+           exit 1
+         fi
+
+         echo "extracting global symbols from \`$pre_dlname'"
+         $run eval "$NM $pre_dlname | $global_symbol_pipe >> $nlist"
+       done
+
+       # Parse the name list into a C file.
+       echo "creating $dlsyms"
+       if test -z "$run"; then
+          cat <<EOF > $dlsyms
+/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
+
+/* External symbol declarations for the compiler. */
+EOF
+         if test -f "$nlist"; then
+           # Prevent the only kind of circular reference mistake we can make.
+           sed '/ dld_preloaded_symbols$/d; s/^.* \(.*\)$/extern char \1;/' < $nlist >> $dlsyms
+         else
+           echo "/* NONE */" >> $dlsyms
+         fi
+
+         cat <<\EOF >> $dlsyms
+
+#if defined (__STDC__) && __STDC__
+# define __ptr_t void *
+#else
+# define __ptr_t char *
+#endif
+
+/* The mapping between symbol names and symbols. */
+struct {
+  char *name;
+  __ptr_t address;
+}
+dld_preloaded_symbols[] =
+{
+EOF
+
+         if test -f "$nlist"; then
+           sed 's/^\(.*\) \(.*\)$/  {"\1", \&\1},/' < $nlist >> $dlsyms
+         fi
+
+          cat <<\EOF >> $dlsyms
+  {0},
+};
+EOF
+       fi
+       $run rm -f "$nlist"
+
+       # Now compile the dynamic symbol file.
+       $show "(cd $objdir && $CC -c ${output}S.c)"
+       $run eval "(cd $objdir && $CC -c ${output}S.c)" || exit $?
+
+       # Transform the symbol file into the correct name.
+       compile_command=`echo "$compile_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
+       finalize_command=`echo "$finalize_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
       fi
 
       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
@@ -973,7 +1112,7 @@ if test -z "$show_help"; then
 #! /bin/sh
 
 # $output - temporary wrapper script for $objdir/$output
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION
+# Generated by ltmain.sh - GNU $PACKAGE $VERSION
 #
 # The $output program cannot be directly executed until all the libtool
 # libraries that it depends on are installed.
@@ -1087,7 +1226,7 @@ EOF
       if test -z "$run"; then
        cat > $output <<EOF
 # $output - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION
+# Generated by ltmain.sh - GNU $PACKAGE $VERSION
 
 # The name that we can dlopen(3).
 dlname='$dlname'
@@ -1238,7 +1377,7 @@ EOF
 
       *.la)
        # Check to see that this really is a libtool archive.
-       if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then :
+       if egrep "^# Generated by ltmain.sh" $file >/dev/null 2>&1; then :
        else
          echo "$progname: \`$file' is not a valid libtool archive" 1>&2
          echo "$help" 1>&2
@@ -1385,7 +1524,7 @@ EOF
 
       *)
        # Do a test to see if this is really a libtool program.
-       if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
+       if egrep "^# Generated by ltmain.sh" $file >/dev/null 2>&1; then
          # This variable tells wrapper scripts just to set variables rather
          # than running their programs.
          libtool_install_magic="$magic"
@@ -1499,58 +1638,6 @@ EOF
     exit 0
     ;;
 
-  # libtool dlname mode
-  dlname)
-    progname="$progname: dlname"
-    ltlibs="$nonopt"
-    for lib
-    do
-      ltlibs="$ltlibs $lib"
-    done
-
-    if test -z "$ltlibs"; then
-      echo "$progname: you must specify at least one LTLIBRARY" 1>&2
-      echo "$help" 1>&2
-      exit 1
-    fi
-
-    # Now check to make sure each one is a valid libtool library.
-    status=0
-    for lib in $ltlibs; do
-      dlname=
-      libdir=
-      library_names=
-
-      # Check to see that this really is a libtool archive.
-      if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
-      else
-        echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
-       status=1
-       continue
-      fi
-
-      # If there is no directory component, then add one.
-      case "$arg" in
-      */*) . $arg ;;
-      *) . ./$arg ;;
-      esac
-
-      if test -z "$libdir"; then
-        echo "$progname: \`$arg' contains no -rpath information" 1>&2
-        status=1
-      elif test -n "$dlname"; then
-       echo "$libdir/$dlname"
-      elif test -z "$library_names"; then
-        echo "$progname: \`$arg' is not a shared library" 1>&2
-        status=1
-      else
-        echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
-        status=1
-      fi
-    done
-    exit $status
-    ;;
-
   # libtool finish mode
   finish)
     progname="$progname: finish"
@@ -1613,7 +1700,7 @@ EOF
       case "$name" in
       *.la)
        # Possibly a libtool archive, so verify it.
-       if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
+       if egrep "^# Generated by ltmain.sh" $file >/dev/null 2>&1; then
          . $dir/$name
 
          # Delete the libtool libraries and symlinks.
@@ -1671,7 +1758,6 @@ Provide generalized library-building support services.
 MODE must be one of the following:
 
       compile         compile a source file into a libtool object
-      dlname          print filenames to use to \`dlopen' libtool libraries
       finish          complete the installation of libtool libraries
       install         install libraries or executables
       link            create a library or an executable
@@ -1697,19 +1783,6 @@ library object suffix, \`.lo'.
 EOF
   ;;
 
-dlname)
-  cat <<EOF
-Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
-
-Print filenames to use to \`dlopen' libtool libraries.
-
-Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
-was linked using the \`-export-dynamic' option).
-
-The names to use are printed to standard output, one per line.
-EOF
-  ;;
-
 finish)
   cat <<EOF
 Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
@@ -1750,6 +1823,7 @@ a program from several object files.
 The following components of LINK-COMMAND are treated specially:
 
   -allow-undefined  allow a libtool library to reference undefined symbols
+  -dlopen FILE      link in FILE and add its symbols to dld_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
index 9a78ca532c0ea4addf0b77963e5c1b4d02f539ef..92c9e2ca3796547b27dc4536e247cb47f1bf503d 100644 (file)
@@ -1,3 +1,8 @@
+Sat Jul 12 15:38:25 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
+
+       * demo-exec.test, demo-inst.test: Check the new helldl program,
+       too.
+
 Fri Jul 11 19:31:43 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
 
        * nomode.test: New test to make sure there is correct behaviour
index 841e149d7ae19fae67f303b9b53872baa2237b93..286e8c5c4bbbf96d33d84a890dfdb458998ad6ff 100755 (executable)
@@ -21,13 +21,19 @@ echo "Executing uninstalled programs in ../demo"
 
 if ../demo/hell.static | grep 'Welcome to GNU Hell'; then :
 else
-  echo "$0: cannot execute ./hell.static" 1>&2
+  echo "$0: cannot execute ../demo/hell.static" 1>&2
   exit 1
 fi
 
 if ../demo/hell | grep 'Welcome to GNU Hell'; then :
 else
-  echo "$0: cannot execute ./hell" 1>&2
+  echo "$0: cannot execute ../demo/hell" 1>&2
+  exit 1
+fi
+
+if ../demo/helldl | grep 'Welcome to GNU Hell'; then :
+else
+  echo "$0: cannot execute ../demo/helldl" 1>&2
   exit 1
 fi
 
index ac2309d8e511aba3ecbcb979557b52799380188f..57e05517d37fde964def06e79bc3b6088373a296 100755 (executable)
@@ -42,4 +42,17 @@ else
   fi
   status=1
 fi
+
+if $prefix/bin/helldl | grep 'Welcome to GNU Hell'; then :
+else
+  echo "$0: cannot execute $prefix/bin/helldl" 1>&2
+
+  # Simple check to see if they are superuser.
+  if test -w /; then :
+  else
+    echo "You may need to run $0 as the superuser."
+  fi
+  status=1
+fi
+
 exit $status