]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in (func_generate_dlsyms) [cygwin, mingw]: when creating
authorCharles Wilson <libtool@cwilson.fastmail.fm>
Wed, 22 Sep 2004 08:50:34 +0000 (08:50 +0000)
committerGary V. Vaughan <gary@gnu.org>
Wed, 22 Sep 2004 08:50:34 +0000 (08:50 +0000)
a .exp file for an executable, also create a .def file, and add
that file to the link command via SYMFILES.  This causes binutils
to generate an .edata section, and allows self dlopening to work.
* NEWS: Updated.

ChangeLog
NEWS
config/ltmain.in

index c9ea85f282d6a265ca86e0f002ffd678d71c4a08..418885f3bbb8873cbcf7141e66d9609662c63c1f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2004-09-22  Charles Wilson  <cwilson@spam.protected>
 
+       * ltmain.in (func_generate_dlsyms) [cygwin, mingw]: when creating
+       a .exp file for an executable, also create a .def file, and add
+       that file to the link command via SYMFILES.  This causes binutils
+       to generate an .edata section, and allows self dlopening to work.
+       * NEWS: Updated.
+
        * m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER): better quoting for
        postinstall_cmds and postuninstall_cmds to allow spaces in install
        paths.
diff --git a/NEWS b/NEWS
index b1118c391d30fdaa652e76882e1be068da268bbd..5fee1426f893c0de6ba089398a3bf8c306987786 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ New in 1.9d: 2004-??-??; CVS version 1.9c, Libtool team:
   types have been exchanged.  See libltdl/slist.c for documentation.
 * libltdl is C89 compatible again.  lt_dlsymbol type removed, and lt_dlsymlist
   structure changed to avoid using C99 flexible arrays.
+* Support self dlopening for executables on cygwin and mingw.
 * Improved support for linux-gnu/ia64.
 * Fixed some memory leaks in libltdl.
 \f
index 6566c7258ab2951e655f66b19800ebdcad831b49..69ed2f04650e7decba287e8bc9749b2e649dc7ec 100644 (file)
@@ -1019,8 +1019,18 @@ extern \"C\" {
            export_symbols="$output_objdir/$output.exp"
            $run $RM $export_symbols
            $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+           case $host in
+           *cygwin* | *mingw* )
+             $run eval "${SED} -e '1iEXPORTS'"' < "$export_symbols" > "$output_objdir/$output.def"'
+             ;;
+           esac
          else
            $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+           case $host in
+           *cygwin | *mingw* )
+             $run eval "${SED} -e '1iEXPORTS'"' < "$output_objdir/$output.exp" > "$output_objdir/$output.def"'
+             ;;
+           esac
            $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
            $run eval '$MV "$nlist"T "$nlist"'
          fi
@@ -1142,8 +1152,21 @@ static const void *lt_preloaded_setup() {
 
        # Transform the symbol file into the correct name.
        symfileobj="$output_objdir/${my_outputname}S.$objext"
-       compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+       case $host in
+       *cygwin* | *mingw* )
+         if test -f "$output_objdir/$my_outputname.def"; then
+           compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+           finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+         else
+           compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+           finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+         fi
+         ;;
+       *)
+         compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+         ;;
+       esac
        ;;
       *)
        func_fatal_error "unknown suffix for \`$my_dlsyms'"
@@ -5828,8 +5851,10 @@ EOF
        esac
        case $host in
          *cygwin* | *mingw* )
-           cwrappersource=`$echo ${objdir}/lt-${output}.c`
-           cwrapper=`$echo ${output}.exe`
+           output_name=`basename $output`
+           output_path=`dirname $output`
+           cwrappersource=`$echo "$output_path/$objdir/lt-$output_name.c"`
+           cwrapper=`$echo "$output_path/$output_name.exe"`
            $RM $cwrappersource $cwrapper
            trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15