From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29047 invoked by alias); 8 Feb 2018 11:42:21 -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 29031 invoked by uid 89); 8 Feb 2018 11:42:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=complaining, indifferent X-HELO: mail-wr0-f174.google.com Received: from mail-wr0-f174.google.com (HELO mail-wr0-f174.google.com) (209.85.128.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Feb 2018 11:42:16 +0000 Received: by mail-wr0-f174.google.com with SMTP id h9so4345374wre.12 for ; Thu, 08 Feb 2018 03:42:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language; bh=ZK3oZygz/LkPbP7NAboimsOBJ3f746d5wpguGK8sbaw=; b=l/3I6VshWYwtQiV8fsHl5lwfTIcP6Oj6shLyawQ+K6PBwx4BJsrhC0r8r+pmEgkwto lRqZfc8XiuzeJm51ggkfbeOugqO+CHDkEzg/QBl2fiUiMbGbJj98rxaDpu6DAZjhg1ok 2uiYmfRvjnzpMAP8dFgvDJ7fLZwVgh6vP6trId8UkrvoTqyGOiT3TSPl7xNdSRKfjEWV Zc13MziRwoImzGvfjgJWc/uegXc+3fNF5yaCIabvXDAxnGTjSzq+pAxSXsz+Mmvs0o0G bEa3aRSvbJN+4IQrR9CK1yH6kpM7eqA5uRY2xbVnbqTNa+ucGtlKIG5sOtphyPaeDOlr g3YA== X-Gm-Message-State: APf1xPAZ+wZKEsXd5oR9Ml0Duz+m5kLV6slacVhlW3pZPFu/Fpd+hXN4 flNBOzxxuDTtV5peuUBo2j2GsQ== X-Google-Smtp-Source: AH8x2276LZqbL2ZziB0MzcP3CnDKLiw7BCXKTK2WC+zKnCtfLi5xreGqardGtvXWeASmyt9zPaSjcw== X-Received: by 10.223.134.237 with SMTP id 42mr474692wry.283.1518090133899; Thu, 08 Feb 2018 03:42:13 -0800 (PST) Received: from abulafia.quesejoda.com (55.red-88-8-76.dynamicip.rima-tde.net. [88.8.76.55]) by smtp.gmail.com with ESMTPSA id a53sm2138310wrc.52.2018.02.08.03.42.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 03:42:13 -0800 (PST) To: gcc-patches Cc: ebotcazou@libertysurf.fr From: Aldy Hernandez Subject: [PR bootstrap/56750] implement --disable-stage1-static-libs Message-ID: <4d4e66a4-73c2-50bb-48d0-9319effb6830@redhat.com> Date: Thu, 08 Feb 2018 11:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------BC9E6DFE0AF544C934D814D9" X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg00403.txt.bz2 This is a multi-part message in MIME format. --------------BC9E6DFE0AF544C934D814D9 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1208 In this PR, the reporter is complaining that forcing -static-libstdc++ and -static-libgcc during stage1 will also force it down to all subdirectories (gdb for instance). There is some back and forth in the PR whether this is good or not. I'm indifferent, but an alternative is to provide a flag --disable-stage1-static-libs to disable this behavior. Tested on an x86-64 Linux system with static libraries and verifying that with --disable-stage1-static-libs we get an xgcc linked against shared libraries of libstdc++ and libgcc: $ ldd xgcc linux-vdso.so.1 (0x00007ffe92084000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fec11a06000) libm.so.6 => /lib64/libm.so.6 (0x00007fec116fd000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fec114e6000) libc.so.6 => /lib64/libc.so.6 (0x00007fec11120000) /lib64/ld-linux-x86-64.so.2 (0x0000557117206000) I also verified that without the flag or with --enable-stage1-static-libs we get no such shared libraries. Again, I'm agnostic here. We can just as easily close the PR and tell users to specify --with-stage1-libs to override the static linking, as I've mentioned in the PR. OK for trunk? --------------BC9E6DFE0AF544C934D814D9 Content-Type: text/x-patch; name="curr.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="curr.patch" Content-length: 2650 PR bootstrap/56750 * configure.ac (stage1-static-libs): New option. * configure: Regenerate. gcc/ PR bootstrap/56750 * doc/install.texi (--enable-stage1-static-libs): New. diff --git a/configure.ac b/configure.ac index aae94501e48..94b540226cc 100644 --- a/configure.ac +++ b/configure.ac @@ -465,6 +465,12 @@ ENABLE_LIBSTDCXX=default) noconfigdirs="$noconfigdirs target-libstdc++-v3" fi] +AC_ARG_ENABLE(stage1-static-libs, +AS_HELP_STRING([--disable-stage1-static-libs], + [do not statically link libstdc++ and libgcc into stage1 binaries]), +ENABLE_STAGE1_STATIC_LIBS=$enableval, +ENABLE_STAGE1_STATIC_LIBS=yes) + # If this is accelerator compiler and its target is intelmic we enable # target liboffloadmic by default. If this is compiler with offloading # for intelmic we enable host liboffloadmic by default. Otherwise @@ -1619,7 +1625,7 @@ 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 "$ENABLE_STAGE1_STATIC_LIBS" = "yes" -a "$stage1_libs" = "" -a "$have_static_libs" = yes; then stage1_ldflags="-static-libstdc++ -static-libgcc" fi]) AC_SUBST(stage1_ldflags) diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 64ad2445a33..5567daad957 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1958,10 +1958,23 @@ include and lib options directly. These flags are applicable to the host platform only. When building a cross compiler, they will not be used to configure target libraries. +@item --enable-stage1-static-libs +@itemx --disable-stage1-static-libs + +Enable linking stage1 binaries with @samp{-static-libstdc++ +-static-libgcc} if available on your system. This also enables +linking stage1 binaries statically when not bootstrapping. The +default is enabled. + +Even with this option enabled, static libraries will only be used when +@option{--with-stage1-libs} is not set to a value. See option +@option{--with-stage1-ldflags} below. + @item --with-stage1-ldflags=@var{flags} This option may be used to set linker flags to be used when linking stage 1 of GCC. These are also used when linking GCC if configured with -@option{--disable-bootstrap}. If @option{--with-stage1-libs} is not set to a +@option{--disable-bootstrap}. If @option{--enable-stage1-static-libs} +is enabled and @option{--with-stage1-libs} is not set to a value, then the default is @samp{-static-libstdc++ -static-libgcc}, if supported. --------------BC9E6DFE0AF544C934D814D9--