From patchwork Thu May 10 09:36:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 911335 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-477472-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="M818ATUr"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40hSrs0Zd6z9s37 for ; Thu, 10 May 2018 19:40:44 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=Zh0/kKnr8MSNbXSl uya9l5m8oLmWPHG2zno4J0m6Fu1pSDZwD9if2zhNMlwUWGGpZsgeVjrHoEFzmTz3 MB3x33/VqXWHFmYOGgdcQ3qoNDw4lxBROwJpMac1NPep4fHVA0DZGeGdXEgzSS1o uLFOZ+Avdd07A1nzrOgDE4xCkak= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=BoNPjYks7N4PXH3H3jtkw5 UQmQE=; b=M818ATUr47y65979/MhvevdvptQjETQXPTxlZ2up3yyE8qLE7V5V4u ONAGd7gtFHd8K0c3MP/4YE66918ztVlrmdklC5ggq6l3IurBtJlNddj8HOB0Ro30 kFe3n7O5MyAwZUsCLuXSh+OaJG5o62KswvfyplD4rSRi34NeGCI88= Received: (qmail 56334 invoked by alias); 10 May 2018 09:40:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 56322 invoked by uid 89); 10 May 2018 09:40:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=acinclude.m4, UD:acinclude.m4, Hx-languages-length:2809, translated X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 May 2018 09:40:29 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id AF13D81399 for ; Thu, 10 May 2018 11:40:26 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HdLXeoa6Zsou for ; Thu, 10 May 2018 11:40:26 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 87EB48139F for ; Thu, 10 May 2018 11:40:26 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix bad interaction between sysroot and C++ include dir Date: Thu, 10 May 2018 11:36:01 +0200 Message-ID: <1946944.q1On1cTmB7@polaris> MIME-Version: 1.0 This fixes an annyoing regression introduced in 2012 by this change: https://codereview.appspot.com/5394041 The idea of the change is to interpolate the value passed to --with-sysroot in the value passed to --with-gxx-include-dir, so that you can change the sysroot at run time, i.e. pass --sysroot to the compiler, and have the gxx-include-dir automatically translated relatively to the new sysroot. The original submission did just that: https://gcc.gnu.org/ml/gcc-patches/2011-11/msg01751.html but it was probably done against a branch so the version eventually installed does the interpolation unconditionally, i.e. even when gxx-include-dir is the default C++ include path in the install tree. The result is that, if you configure --with-sysroot with a value that happens to be identical to the start of the default C++ path in the install tree, the mechanism triggers and the C++ include path is completely broken if you pass --sysroot to the compiler. IOW the same issue as the one meant to be fixed, but this time when --with-gxx-include-dir is not passed. So the attached patch restores the original implementation by doing the interpolation only when both --with-sysroot and --with-gxx-include-dir are specified on the configure line. Tested on x86-64/Linux, applied on the mainline as obvious. 2018-05-10 Eric Botcazou * configure.ac (gcc_gxx_include_dir_add_sysroot): Set it to 1 only when --with-gxx-include-dir is also specified. * configure: Regenerate. Index: configure.ac =================================================================== --- configure.ac (revision 260071) +++ configure.ac (working copy) @@ -205,6 +205,11 @@ no) ;; *) gcc_gxx_include_dir=$with_gxx_include_dir ;; esac]) +# If both --with-sysroot and --with-gxx-include-dir are passed, we interpolate +# the former in the latter and, upon success, compute gcc_gxx_include_dir as +# relative to the sysroot. +gcc_gxx_include_dir_add_sysroot=0 + # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO. if test x${gcc_gxx_include_dir} = x; then if test x${enable_version_specific_runtime_libs} = xyes; then @@ -216,15 +221,10 @@ if test x${gcc_gxx_include_dir} = x; the fi gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir" fi -fi - -gcc_gxx_include_dir_add_sysroot=0 -if test "${with_sysroot+set}" = set; then +elif test "${with_sysroot+set}" = set; then gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'` if test "${gcc_gxx_without_sysroot}"; then - if test x${with_sysroot} != x/; then - gcc_gxx_include_dir="${gcc_gxx_without_sysroot}" - fi + gcc_gxx_include_dir="${gcc_gxx_without_sysroot}" gcc_gxx_include_dir_add_sysroot=1 fi fi