From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12986 invoked by alias); 12 Jul 2015 23:20:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 12976 invoked by uid 89); 12 Jul 2015 23:20:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 12 Jul 2015 23:20:30 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZEQXq-000157-9H from Iain_Sandoe@mentor.com ; Sun, 12 Jul 2015 16:20:26 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Mon, 13 Jul 2015 00:20:24 +0100 Subject: Re: [PATCH g++ driver] Push -static-libstdc++ back onto the command line to allow spec substitutions to use it. MIME-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset="us-ascii" From: Iain Sandoe In-Reply-To: <6AF41B3F-BB52-4B75-9336-54A9587CD627@codesourcery.com> Date: Sun, 12 Jul 2015 23:20:00 -0000 CC: gcc-patches List , Jonathan Wakely Content-Transfer-Encoding: quoted-printable Message-ID: <7F25A251-094A-471D-A3BD-A7B805E85287@codesourcery.com> References: <6AF41B3F-BB52-4B75-9336-54A9587CD627@codesourcery.com> To: Jason Merrill X-SW-Source: 2015-07/txt/msg00986.txt.bz2 Ping On 18 Jun 2015, at 09:12, Iain Sandoe wrote: > Hi, >=20 > This came up in a User question last night and reminded me that I had a p= atch for it in my Q. >=20 > ---- >=20 > Usually g++ driver support for -static-libstdc++ is provided by "-Bstatic= -lstdc++ -Bdynamic" and is currently disabled for targets without that lin= ker support. However, actually, there is still an opportunity for those ta= rgets to implement the functionality with a spec substituation like: >=20 > %{static-libstdc++:%:replace-outfile(-lstdc++ libstdc++.a%s)} >=20 > However, this doesn't currently work because the g++ driver swallows "-st= atic-libstdc++" so it's never seen by the specs. > The patch below pushes -static-libstdc++ onto the output command line (fo= r targets without -Bstatic/dynamic) so that such specs have an opportunity= to fire. >=20 > OK for trunk? > Iain >=20 > gcc/cp: > * g++spec.c (lang_specific_driver): Push "-static-libstdc++" back to the= output > command line when the target linker does not support -Bstatic/dynamic so= that it > is available for spec substitions to act on. >=20 >=20 > --- > gcc/cp/g++spec.c | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c > index 6536d7e..48a9708 100644 > --- a/gcc/cp/g++spec.c > +++ b/gcc/cp/g++spec.c > @@ -363,6 +363,15 @@ lang_specific_driver (struct cl_decoded_option **in_= decoded_options, > &new_decoded_options[j]); > j++; > } > +#else > + /* For linkers that don't support Bstatic/dynamic push the flag ba= ck > + so that spec substitution can see it. */ > + if (library > 1 && !static_link) > + { > + generate_option (OPT_static_libstdc__, NULL, 0, CL_DRIVER, > + &new_decoded_options[j]); > + j++; > + } > #endif > } > if (saw_math) > --=20 > 2.2.1 >=20