[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Cygwin/Mingw -- make -export-symbols work properly
From: |
Charles Wilson |
Subject: |
Cygwin/Mingw -- make -export-symbols work properly |
Date: |
Mon, 30 Dec 2002 13:42:26 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 |
[resend; previous email never appeared in the archives...]
There were some useful bits of code for -export-symbols on cygwin/mingw
in the 1.4.x branch, that we excised from libtool after migrating
libtool to use the auto-import functionality of ld. However, some of
those bits need to return, in modified form, so that "-export-symbols <a
def file>" can continue to work.
Tested on cygwin, no test suite regressions, AND solves the problem (as
tested by building glib-2.0.7). This patch is against CVS HEAD (as of
2002-12-27). Please apply.
--Chuck
2002-12-27 Charles Wilson <address@hidden>
* libtool.m4 (AC_LIBTOOL_LANG_CXX_CONFIG): modify
$archive_expsym_cmds to restore support for using
.def files via the -export-symbols switch.
(AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]): in both the [CXX]
branch and the default branch, improve $export_symbols_cmds
so that DATA symbols are properly labelled. In the default
branch, duplicate the _CXX_CONFIG correction for
$archive_expsym_cmds.
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.281
diff -u -r1.281 libtool.m4
--- libtool.m4 18 Dec 2002 21:04:45 -0000 1.281
+++ libtool.m4 26 Dec 2002 15:40:58 -0000
@@ -2708,7 +2708,15 @@
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects
$libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname
${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib
$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o
$output_objdir/$soname ${wl}-retain-symbols-file $wl$export_symbols
${wl}--out-implib,$lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q
$export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects
$libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname
${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
else
_LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
@@ -4656,6 +4664,9 @@
pw32*)
_LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
;;
+ cygwin* | mingw*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience |
$global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' |
$SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
*)
_LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience |
$global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
@@ -4764,10 +4775,19 @@
_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_AC_TAGVAR(always_export_symbols, $1)=no
_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience |
$global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' |
$SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs
$compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000
${wl}--out-implib,$lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs
$compiler_flags -o $output_objdir/$soname ${wl}-retain-symbols-file
$wl$export_symbols ${wl}--out-implib,$lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q
$export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs
$compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000
${wl}--out-implib,$lib'
else
ld_shlibs=no
fi