On systems without weak, debug mode tests will fail. This causes some unpleasantness on AIX, for instance. This can be verified on x86/linux using -fno-weak. What needs to happen is that the debug mode tests should be smart enough to tell if the underlying system doesn't support weak, so that the test case cannot be run. There are several other things that work like this ("C" locale, etc) so adding one more shouldn't be a big deal.
Created attachment 9162 [details] libstdc++.log for AIX, demonstrating issue
This is a regression in that you no longer can use the debug mode with -fno-weak.
AIX 5.2 does support weak, so I believe that there is something wrong with the analysis.
Actually if you look into the email which David sent, you would see: # 0 "<built-in>" #define __GXX_WEAK__ Which means there is weak support.
Humm, I wonder whether the problem isn't *really* trivial :) In include/bits/c++config we have: #ifdef _GLIBCXX_DEBUG # if __GXX_WEAK__ # define _GLIBCXX_STD __gnu_norm # define _GLIBCXX_EXTERN_TEMPLATE 0 ... ... # else # warning debug mode disabled due to lack of weak symbol support # endif Should be, instead, 'ifdef __GXX_WEAK__' ?!?
Or, wrt Andrew's comment, AIX should really have, consistently with the docs: #define __GXX_WEAK__ 1 ??
I do not understand the comment about GCC for AIX setting GXX_WEAK consistently. The value is set by GCC itself, not overridden by AIX. GXX_WEAK is defined by c-cppbuiltin.c: if (flag_weak && SUPPORTS_ONE_ONLY) cpp_define (pfile, "__GXX_WEAK__=1"); else cpp_define (pfile, "__GXX_WEAK__=0"); and depends on SUPPORTS_ONE_ONLY, not just weak support. I will test if setting MAKE_DECL_ONE_ONLY works on AIX.
A clarification about __GXX_WEAK__: Andrew reports that, on AIX we have: #define __GXX_WEAK__ If that is really the case (I cannot check, sorry), then the library is not checking correctly the macro, because uses: # if __GXX_WEAK__ which should be changed to: # ifdef __GXX_WEAK__ Alternately, on AIX we should have: #define __GXX_WEAK__ 1 I'm saying everywhere "on AIX" because for sure many other "weak" targets are ok as they are. Agreed?
I tried overriding libstdc++'s definition of __GXX_WEAK__ and GCC's definition of ONE_ONLY. Both caused additional C++ testsuite failures. AIX does support weak, but not exactly the way that G++ is expecting.
A real good question is why does debug mode need link once at all?
It was discovered that to use string, you have to do all this magic with the debug mode that involves not using extern template and a bunch of the other linkage optimizations. There were some PRs about this. That's why systems without weak will no longer support the debug mode. That's not going to change. However, fixing this so that debug mode is not tested (marked unsupported) instead of failing seems reasonable. Working on a patch...
Subject: Bug 22205 CVSROOT: /cvs/gcc Module name: gcc Changes by: bkoz@gcc.gnu.org 2005-09-15 18:58:04 Modified files: libstdc++-v3 : ChangeLog libstdc++-v3/include/bits: c++config libstdc++-v3/testsuite/21_strings/basic_string/element_access/char: 21674.cc libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t: 21674.cc libstdc++-v3/testsuite/lib: dg-options.exp libstdc++.exp Log message: 2005-09-15 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/21674 PR libstdc++/22205 PR libstdc++/22222 * include/bits/c++config: Set _GLIBCXX_STD regardless of __GXX_WEAK__. Add in check for __NO_INLINE__ for warning. * testsuite/lib/dg-options.exp (dg-require-debug-mode): New. * testsuite/lib/libstdc++.exp (check_v3_target_debug_mode): New. * testsuite/21_strings/basic_string/element_access/char/21674.cc: Use it. * testsuite/21_strings/basic_string/element_access/wchar_t/21674.cc: Use it. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.3107&r2=1.3108 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/c++config.diff?cvsroot=gcc&r1=1.1408&r2=1.1409 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/21674.cc.diff?cvsroot=gcc&r1=1.1&r2=1.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/21674.cc.diff?cvsroot=gcc&r1=1.1&r2=1.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/lib/dg-options.exp.diff?cvsroot=gcc&r1=1.5&r2=1.6 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/lib/libstdc++.exp.diff?cvsroot=gcc&r1=1.48&r2=1.49
Fixed.