From patchwork Wed Oct 27 20:05:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 46717 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 53F8D385842D for ; Wed, 27 Oct 2021 20:08:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 53F8D385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635365308; bh=G7DgvujSidMdo4W4ha9dwcYsgpycIzWU3VGuTDH2+SU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YaSD3SncxfIa5sRxyUb4UtdNCV3ozFatuyIKSSXXmB1EWNWaAKOQJ3GQUQh+gcl3m 8qcuJiEjI1OnYHvjIlasNHYXjoapLIiVqYyUtayq/JS17Vm+d46FH8Z+aartFBnDn2 4x0XGLPw20nvD14gW75WQNabNYjVgV4Kb2oFDGt8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id A26103858410 for ; Wed, 27 Oct 2021 20:05:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A26103858410 Received: by mail-wm1-x32a.google.com with SMTP id g205-20020a1c20d6000000b0032cc6bbd505so6694531wmg.5 for ; Wed, 27 Oct 2021 13:05:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G7DgvujSidMdo4W4ha9dwcYsgpycIzWU3VGuTDH2+SU=; b=eFmcrSjXF/nGKhaeAqZ9ZAht1mGQP9JANcEQqXwp75yImB4wBs4lGtxaVfmoj5EcuO kdvcVKhCJD9FN6zxVSjlOPvCFu/zJP11TvjFEqfCo5yKZ4hzAF3uUwqPOhlJSBE3W+qS l6TkZxjCwrNPvu4Cau3ohy7XHtwU620+L/Dq4SxPCdaulupafkJLcaIiYPRvyUlx0Tev j4jDW2ZUYdorPHhxbgwtxFvyui9Ay8AWGGdSO1t6RUmiIg9DUi0ra4GrqAm5facqpR1L 5o9xK9NZJSr6xB3XpyFRaf0gjiyIxREjx+jT6Erx+JmRMX5koIII9WMQCvQJdBn4+nfa 0ibA== X-Gm-Message-State: AOAM531TkbvPk0BvjULK8ufl51mIPVCl75b7b6icYeg0V+uSvRmSYG2N 4aTALHhEJNm6S/4yeNM93s78zRySPoWi3g== X-Google-Smtp-Source: ABdhPJwa/iBe5XC8/rgsHMAsFn1HJcJevp6wAaW0gvF5+XOju+JloknH2GYCtoj0tOydW6ZClYzOng== X-Received: by 2002:a05:600c:35cb:: with SMTP id r11mr7940304wmq.76.1635365109614; Wed, 27 Oct 2021 13:05:09 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:9748:b7d4:9e30:95e]) by smtp.gmail.com with ESMTPSA id c17sm847914wrv.22.2021.10.27.13.05.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 13:05:09 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 5/5] gcc: Pass sysroot options to cpp for preprocessed source Date: Wed, 27 Oct 2021 21:05:05 +0100 Message-Id: <20211027200505.3340725-6-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211027200505.3340725-1-richard.purdie@linuxfoundation.org> References: <20211027200505.3340725-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Purdie via Gcc-patches From: Richard Purdie Reply-To: Richard Purdie Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" OpenEmbedded/Yocto Project extensively uses the --sysroot support within gcc. We discovered that when compiling preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location rather than the --sysroot option specified on the commandline. If access to that directory is permission denied (unreadable), gcc will error. This is particularly problematic when ccache is involved. This patch adds %I to the cpp-output spec macro so the default substitutions for -iprefix, -isystem, -isysroot happen and the correct sysroot is used. 2021-10-27 Richard Purdie gcc/cp/ChangeLog: * lang-specs.h: Pass sysroot options to cpp for preprocessed source gcc/ChangeLog: * gcc.c: Pass sysroot options to cpp for preprocessed source Signed-off-by: Richard Purdie --- gcc/cp/lang-specs.h | 2 +- gcc/gcc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h index 8902ae1d2ed..e99e2fcd6ad 100644 --- a/gcc/cp/lang-specs.h +++ b/gcc/cp/lang-specs.h @@ -116,7 +116,7 @@ along with GCC; see the file COPYING3. If not see {".ii", "@c++-cpp-output", 0, 0, 0}, {"@c++-cpp-output", "%{!E:%{!M:%{!MM:" - " cc1plus -fpreprocessed %i %(cc1_options) %2" + " cc1plus -fpreprocessed %i %I %(cc1_options) %2" " %{!fsyntax-only:" " %{fmodule-only:%{!S:-o %g.s%V}}" " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}" diff --git a/gcc/gcc.c b/gcc/gcc.c index abb900a4247..51176becb86 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1472,7 +1472,7 @@ static const struct compiler default_compilers[] = %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, {".i", "@cpp-output", 0, 0, 0}, {"@cpp-output", - "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, {".s", "@assembler", 0, 0, 0}, {"@assembler", "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},