This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix PR/18997 weak symbol bug on cygwin


On Thu, Dec 16, 2004 at 03:35:36PM +1300, Danny Smith wrote:
>PR/18997 is a target bug caused by the enablement of weak-linkage
>support on windows targets by this patch:
>
>http://gcc.gnu.org/ml/gcc-cvs/2004-11/msg00265.html
>
>2004-11-06  Aaron W. LaFramboise  <aaronavay62@aaronwl.com>
>
>	PR target/18106
>	* config/i386/cygming.h
>	[HAVE_GAS_WEAK] (ASM_WEAKEN_LABEL): Macro defined.
>
>Reverting that patch fixes this PR and also makes a huge difference to
>the cygwin g++ testsuite results. 
>
>Cygwin's pthread functions live in the cygwin1.dll shared system
>library, They are alway available, so weak linkage is not necessary.
>Weak linkage doesn't actually work with these dll symbols. Even though
>the symbols are in a shared libary, they are accessed through an "import
>lib" which BFD sees as an archive (because it has the same format as a
>static archive). Binutils follows the SVR4 ABI wrt weak symbols in
>archives: An undefined weak symbol is not considered to be a reference
>when pulling files out of an archive. Thus, all these weak pthread
>symbols are left as null pointers. Although GCC says
>SUPPORTS_WEAK is true, the actual support in bintils is still a work in
>progress. 
>
>I would be disappointed if we are forced to revert the patch that
>enabled weak linkage on the gcc side, because once weak works correctly
>it opens ups new opportunities. I would prefer that the unnecessary weak
>attribute just be removed from the pthread functions for cygwin. This
>has to be done both within GCC build itself and in libstdc++. Since
>cygwin uses newlib as its C library, the override of
>_GLIBCXX_GTHREAD_USE_WEAK would go in config/os/newlib/os_defines.h.
>Probably not a good place, but where else (a builtin predefine?).
>
>The followin patch fixes the regression. Bootstrapped and tested on
>i686-pc-cygwin (c,c++). 
>
>gcc/ChangeLog
>
>	* config/i386/cygwin.h (GTHREAD_USE_WEAK): Define to 0.
>
>libstdc++-v3/ChangeLog
>
>	* config/os/newlib/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK):
>	Define to 0 for __CYGWIN__.

Ok.  For now.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]