diff mbox

Follow-up to PR bootstrap/54820

Message ID 1659365.rXFWKSb4nS@polaris
State New
Headers show

Commit Message

Eric Botcazou Oct. 23, 2012, 9:11 p.m. UTC
As reported by Ian and Peter in the audit trail, the check I added to detect 
whether -static-libstdc++ is supported by g++ doesn't work because the option 
is silently rejected by versions prior to 4.5.

The attached patch forces an error for these versions so as to make the check 
always fail.  Tested with GCC 4.3 and GCC 4.5, OK for mainline?


2012-10-23  Eric Botcazou  <ebotcazou@adacore.com>

	PR bootstrap/54820
	* configure.ac (have_static_libs): Force 'no' for GCC version < 4.5.
	* configure: Regenerate.

Comments

Ian Lance Taylor Oct. 23, 2012, 9:54 p.m. UTC | #1
On Tue, Oct 23, 2012 at 2:11 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>
> 2012-10-23  Eric Botcazou  <ebotcazou@adacore.com>
>
>         PR bootstrap/54820
>         * configure.ac (have_static_libs): Force 'no' for GCC version < 4.5.
>         * configure: Regenerate.

This is OK.

Thanks.

Ian
Cary Coutant Dec. 20, 2012, 2:13 a.m. UTC | #2
Two test cases, debug_msg_so.err and debug_msg_ndebug.err, are still
broken by the original patch, because (a) debug_msg.so has a DT_NEEDED
entry for libstdc++.so, (b) the use of -static-libstdc++ means that
that DT_NEEDED entry is unknown when we link the executable, and (c)
the undefined symbols in debug_msg.so will not be printed.

The obvious solution would be to add an option to cancel
-static-libstdc++, but there doesn't seem to be one. (There is a
-shared-libgcc option, but no -shared-libstdc++.) I've tested two
alternatives that work:

(1) Force the issue by explicitly adding -Bdynamic -lstdc++ to the
link flags for debug_msg_so and debug_msg_ndebug.

(2) Remove the DT_NEEDED entry from debug_msg.so by linking it with
-static-libstdc++ also.

Which one seems preferable? Any better ideas?

-cary

On Tue, Oct 23, 2012 at 2:54 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Tue, Oct 23, 2012 at 2:11 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>
>> 2012-10-23  Eric Botcazou  <ebotcazou@adacore.com>
>>
>>         PR bootstrap/54820
>>         * configure.ac (have_static_libs): Force 'no' for GCC version < 4.5.
>>         * configure: Regenerate.
>
> This is OK.
>
> Thanks.
>
> Ian
Ian Lance Taylor Dec. 20, 2012, 5:39 a.m. UTC | #3
On Wed, Dec 19, 2012 at 6:13 PM, Cary Coutant <ccoutant@google.com> wrote:
> Two test cases, debug_msg_so.err and debug_msg_ndebug.err, are still
> broken by the original patch, because (a) debug_msg.so has a DT_NEEDED
> entry for libstdc++.so, (b) the use of -static-libstdc++ means that
> that DT_NEEDED entry is unknown when we link the executable, and (c)
> the undefined symbols in debug_msg.so will not be printed.
>
> The obvious solution would be to add an option to cancel
> -static-libstdc++, but there doesn't seem to be one. (There is a
> -shared-libgcc option, but no -shared-libstdc++.) I've tested two
> alternatives that work:
>
> (1) Force the issue by explicitly adding -Bdynamic -lstdc++ to the
> link flags for debug_msg_so and debug_msg_ndebug.
>
> (2) Remove the DT_NEEDED entry from debug_msg.so by linking it with
> -static-libstdc++ also.
>
> Which one seems preferable? Any better ideas?

Adding -Bdynamic seems fine to me.

And I guess GCC should have a -shared-libstdc++ option.

Ian
diff mbox

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 192666)
+++ configure.ac	(working copy)
@@ -1190,7 +1190,11 @@  if test "$GCC" = yes; then
   LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
   AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
   AC_LANG_PUSH(C++)
-  AC_LINK_IFELSE([int main() {}],
+  AC_LINK_IFELSE([
+#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+#error -static-libstdc++ not implemented
+#endif
+int main() {}],
     [AC_MSG_RESULT([yes]); have_static_libs=yes],
     [AC_MSG_RESULT([no])])
   AC_LANG_POP(C++)