From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125927 invoked by alias); 5 Aug 2019 18:02:44 -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 125919 invoked by uid 89); 5 Aug 2019 18:02:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.50.119) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Aug 2019 18:02:33 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 658ED11F2A for ; Mon, 5 Aug 2019 13:02:32 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id uhJYhZa2q2PzOuhJYhdYWN; Mon, 05 Aug 2019 13:02:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=S6MntaQajBpXIUEAhweYV68G3vKRyofYwDowzRpO3Ew=; b=f8DZfprxDXKUFUCAUEQP/8r8SD FpNX1Bw/lUX83H/QJP91ADDEOsyaOkh7T62b6o/ZZJC/4ZGPDyI6z6BlGEN6xijr0m6yn+/zqTq4h DnzzSy3LPuPshRDK63cNgb2YE; Received: from 97-122-178-82.hlrn.qwest.net ([97.122.178.82]:44346 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1huhJY-000UWD-4B; Mon, 05 Aug 2019 13:02:32 -0500 From: Tom Tromey To: GCC Patches Subject: [PATCH] Add --with-static-standard-libraries to the top level Date: Mon, 05 Aug 2019 18:02:00 -0000 Message-ID: <87y307bidk.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-08/txt/msg00287.txt.bz2 gdb should normally not be linked with -static-libstdc++. Currently this has not caused problems, but it's incompatible with catching an exception thrown from a shared library -- and a subsequent patch changes gdb to do just this. This patch adds a new --with-static-standard-libraries flag to the top-level configure. It defaults to "auto", which means enabled if gcc is being built, and disabled otherwise. Tom 2019-07-27 Tom Tromey * configure: Rebuild. * configure.ac: Add --with-static-standard-libraries. diff --git a/configure.ac b/configure.ac index 854f71a34e5..7433badc217 100644 --- a/configure.ac +++ b/configure.ac @@ -1602,6 +1602,19 @@ AC_ARG_WITH(stage1-libs, [stage1_libs=]) AC_SUBST(stage1_libs) +# Whether or not to use -static-libstdc++ and -static-libgcc. The +# default is yes if gcc is being built; no otherwise. The reason for +# this default is that gdb is sometimes linked against GNU Source +# Highlight, which is a shared library that uses C++ exceptions. In +# this case, -static-libstdc++ will cause crashes. +AC_ARG_WITH(static-standard-libraries, +[AS_HELP_STRING([--with-static-standard-libraries], + [use -static-libstdc++ and -static-libgcc (default=auto)])], +[], [with_static_standard_libraries=auto]) +if test "$with_static_standard_libraries" = auto; then + with_static_standard_libraries=$have_compiler +fi + # Linker flags to use for stage1 or when not bootstrapping. AC_ARG_WITH(stage1-ldflags, [AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])], @@ -1614,7 +1627,8 @@ AC_ARG_WITH(stage1-ldflags, # In stage 1, default to linking libstdc++ and libgcc statically with GCC # if supported. But if the user explicitly specified the libraries to use, # trust that they are doing what they want. - if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then + if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \ + -a "$have_static_libs" = yes; then stage1_ldflags="-static-libstdc++ -static-libgcc" fi]) AC_SUBST(stage1_ldflags) -- 2.20.1