libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cygwin: patch resend


From: Charles Wilson
Subject: cygwin: patch resend
Date: Wed, 22 Sep 2004 02:40:30 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 MultiZilla/1.6.4.0b

...updated to CVS HEAD.

Originally entitled "[PATCH] Fix mdemo on cygwin"
http://lists.gnu.org/archive/html/libtool-patches/2004-02/msg00040.html

On cygwin, binutils only adds an .edata section to an executable if a .def file is included on the link command -- and without an .edata section, neither cygwin's dlopen() emulation nor windows native LoadLibrary can open "itself".

This patch teaches libtool to create and include a .def file when linking an executable for which a .exp file is used (e.g. when "exporting" symbols from an .exe, make sure binutils creates a .edata section).

--
Chuck

2004-09-21  Charles Wilson  <address@hidden>

        * ltmain.in (func_generate_dlsyms): 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.
        (func_mode_link): handle thinko caused by complex 
        build paths.
Index: config/ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.in,v
retrieving revision 1.24
diff -u -r1.24 ltmain.in
--- config/ltmain.in    17 Sep 2004 17:12:17 -0000      1.24
+++ config/ltmain.in    22 Sep 2004 05:23:32 -0000
@@ -1019,8 +1019,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
@@ -1120,13 +1130,26 @@
        $run eval '(cd $output_objdir && $LTCC $LTCFLAGS 
-c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $?
 
        # Clean up the generated files.
-       $show "$RM $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T"
-       $run $RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+       #$show "$RM $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T"
+       #$run $RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"
 
        # Transform the symbol file into the correct name.
        symfileobj="$output_objdir/${my_outputname}S.$objext"
-       compile_command=`$echo "X$compile_command" | $Xsed -e 
"address@hidden@%$symfileobj%"`
-       finalize_command=`$echo "X$finalize_command" | $Xsed -e 
"address@hidden@%$symfileobj%"`
+       case $host in
+       *cygwin* | *mingw* )
+         if test -f "$output_objdir/${my_outputname}.def" ; then
+           compile_command=`$echo "X$compile_command" | $Xsed -e 
"address@hidden@%$output_objdir/${outputname}.def $symfileobj%"`
+           finalize_command=`$echo "X$finalize_command" | $Xsed -e 
"address@hidden@%$output_objdir/${my_outputname}.def $symfileobj%"`
+         else
+           compile_command=`$echo "X$compile_command" | $Xsed -e 
"address@hidden@%$symfileobj%"`
+           finalize_command=`$echo "X$finalize_command" | $Xsed -e 
"address@hidden@%$symfileobj%"`
+         fi
+         ;;
+       * )
+         compile_command=`$echo "X$compile_command" | $Xsed -e 
"address@hidden@%$symfileobj%"`
+         finalize_command=`$echo "X$finalize_command" | $Xsed -e 
"address@hidden@%$symfileobj%"`
+         ;;
+       esac
        ;;
       *)
        func_fatal_error "unknown suffix for \`$my_dlsyms'"
@@ -5667,8 +5690,9 @@
 
        # Delete the generated files.
        if test -f "$output_objdir/${outputname}S.${objext}"; then
-         $show "$RM $output_objdir/${outputname}S.${objext}"
-         $run $RM "$output_objdir/${outputname}S.${objext}"
+         #$show "$RM $output_objdir/${outputname}S.${objext}"
+         #$run $RM "$output_objdir/${outputname}S.${objext}"
+         :
        fi
 
        exit $status
@@ -5811,8 +5835,10 @@
        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
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]