[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix mdemo on cygwin
From: |
Charles Wilson |
Subject: |
[PATCH] Fix mdemo on cygwin |
Date: |
Wed, 04 Feb 2004 12:58:24 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 |
On Apr 1, 2003, binutils/ld was updated so that an .edata (export)
section are added to executables (as they are for dlls) if a .def file
is included in the "object" list. Without this, cygwin's dlopen()
emulation [as well as the native LoadLibrary() used by mingw] can't
dlopen itself.
All that's missing is for libtool to create and add a .def file to the
executable link command when appropriate. This patch does that; it is
against the stock 1.5.2 distribution.
--
Chuck
2004-02-04 Charles Wilson <address@hidden>
* ltmain.in: when creating a .exp file for an executable,
also create a .def file (on cygwin|mingw), and add that
file to the link command via SYMFILES.
* ltmain.sh: ditto
* libltdl/ltmain.sh: ditto
diff -urN -x .build -x .inst -x .sinst libtool-1.5.2-orig/libltdl/ltmain.sh
libtool-1.5.2/libltdl/ltmain.sh
--- libtool-1.5.2-orig/libltdl/ltmain.sh 2004-01-25 07:40:26.000000000
-0500
+++ libtool-1.5.2/libltdl/ltmain.sh 2004-02-04 02:28:39.578713600 -0500
@@ -4278,8 +4278,18 @@
export_symbols="$output_objdir/$output.exp"
$run $rm $export_symbols
$run eval "${SED} -n -e '/^: @address@hidden/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
@@ -4383,12 +4393,25 @@
$run eval '(cd $output_objdir && $LTCC
-c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
# Clean up the generated files.
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
# Transform the symbol file into the correct name.
- compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}.def
$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}.def
$output_objdir/${outputname}S.${objext}%"`
+ else
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ esac
;;
*)
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
diff -urN -x .build -x .inst -x .sinst libtool-1.5.2-orig/ltmain.in
libtool-1.5.2/ltmain.in
--- libtool-1.5.2-orig/ltmain.in 2004-01-25 01:50:41.000000000 -0500
+++ libtool-1.5.2/ltmain.in 2004-02-04 02:28:16.305248000 -0500
@@ -4278,8 +4278,18 @@
export_symbols="$output_objdir/$output.exp"
$run $rm $export_symbols
$run eval "${SED} -n -e '/^: @address@hidden/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
@@ -4383,12 +4393,25 @@
$run eval '(cd $output_objdir && $LTCC
-c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
# Clean up the generated files.
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
# Transform the symbol file into the correct name.
- compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}.def
$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}.def
$output_objdir/${outputname}S.${objext}%"`
+ else
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ esac
;;
*)
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
diff -urN -x .build -x .inst -x .sinst libtool-1.5.2-orig/ltmain.sh
libtool-1.5.2/ltmain.sh
--- libtool-1.5.2-orig/ltmain.sh 2004-01-25 07:40:26.000000000 -0500
+++ libtool-1.5.2/ltmain.sh 2004-02-04 02:28:31.727424000 -0500
@@ -4278,8 +4278,18 @@
export_symbols="$output_objdir/$output.exp"
$run $rm $export_symbols
$run eval "${SED} -n -e '/^: @address@hidden/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
@@ -4383,12 +4393,25 @@
$run eval '(cd $output_objdir && $LTCC
-c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
# Clean up the generated files.
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
# Transform the symbol file into the correct name.
- compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}.def
$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}.def
$output_objdir/${outputname}S.${objext}%"`
+ else
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e
"address@hidden@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ esac
;;
*)
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Fix mdemo on cygwin,
Charles Wilson <=