delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/25/18:39:23

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <49CAC092.8030600@users.sourceforge.net>
Date: Wed, 25 Mar 2009 18:38:58 -0500
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: libtool: two cygwin patches
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------050208060305060907030306
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Chuck,

I attached two patches for libtool for your consideration:

1) 2.2-export-all-symbols.patch:

On Cygwin, the --export-all-symbols linker flag is required;
- --export-dynamic has no effect (see
http://sourceware.org/bugzilla/show_bug.cgi?id=6744).

This patch fixes two problems:

1) LT_SYS_DLOPEN_SELF returns a false negative;
2) Using the -export-dynamic libtool flag does not affect the resulting
binary.

2) 2.2-gcc4-libs.patch:

With gcc4 providing shared libs, it should now perfectly legitimate to
add any of these libs to the libtool link command.  Right now, though,
libtool can't find these libraries because $sys_lib_search_path_spec is
hard-coded to ignore it, and libtool will refuse to link against any
library it can't find (even though the linker itself can).

Instead, this patch simply adds /usr/lib/w32api to the default
gcc-specific search path.  The m4_if() makes sure that w32api is added
only once, as is done with Darwin a few lines later.


Yaakov
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREIAAYFAknKwJIACgkQpiWmPGlmQSPW5gCg/GZFiM5txCIWxu45tSFY+bi+
NSsAn0W0YaD3m+Casxtc/yH1OlVmQtIa
=9w+D
-----END PGP SIGNATURE-----

--------------050208060305060907030306
Content-Type: text/x-patch;
 name="2.2-export-all-symbols.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="2.2-export-all-symbols.patch"

On Cygwin, the --export-all-symbols linker flag is required; --export-dynamic
has no effect (see http://sourceware.org/bugzilla/show_bug.cgi?id=6744).

This patch fixes two problems:

1) LT_SYS_DLOPEN_SELF returns a false negative;
2) Using the -export-dynamic libtool flag does not affect the resulting binary.

	* libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) [cygwin*|mingw*|pw32*|cegcc*]:
	Define export_dynamic_flag_spec as -Wl,--export-all-symbols, as required
	by GNU ld for PE-COFF.

--- origsrc/libtool-2.2.6/libltdl/m4/libtool.m4	2008-09-05 06:54:41.000000000 -0500
+++ src/libtool-2.2.6/libltdl/m4/libtool.m4	2009-03-25 16:25:45.239000000 -0500
@@ -4322,6 +4322,7 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=no
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes

--------------050208060305060907030306
Content-Type: text/x-patch;
 name="2.2-gcc4-libs.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="2.2-gcc4-libs.patch"

With gcc4 providing shared libs, it should now perfectly legitimate to 
add any of these libs to the libtool link command.  Right now, though, 
libtool can't find these libraries because $sys_lib_search_path_spec is 
hard-coded to ignore it, and libtool will refuse to link against any 
library it can't find (even though the linker itself can).

Instead, this patch simply adds /usr/lib/w32api to the default 
gcc-specific search path.  The m4_if() makes sure that w32api is added 
only once, as is done with Darwin a few lines later.

	* libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER) [cygwin*]:
	Add w32api to sys_lib_search_path_spec without overriding gcc's
	own search path.

--- origsrc/libtool-2.2.6/libltdl/m4/libtool.m4	2008-09-05 06:54:41.000000000 -0500
+++ src/libtool-2.2.6/libltdl/m4/libtool.m4	2009-03-25 16:25:45.239000000 -0500
@@ -2228,7 +2228,8 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix


--------------050208060305060907030306
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--------------050208060305060907030306--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019