From patchwork Wed Oct 14 11:01:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 11837505 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 51C9914B5 for ; Wed, 14 Oct 2020 11:08:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DFE9208B3 for ; Wed, 14 Oct 2020 11:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730477AbgJNLIa (ORCPT ); Wed, 14 Oct 2020 07:08:30 -0400 Received: from wildebeest.demon.nl ([212.238.236.112]:49680 "EHLO gnu.wildebeest.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbgJNLI3 (ORCPT ); Wed, 14 Oct 2020 07:08:29 -0400 X-Greylist: delayed 351 seconds by postgrey-1.27 at vger.kernel.org; Wed, 14 Oct 2020 07:08:29 EDT Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 2F12D30291AC; Wed, 14 Oct 2020 13:02:35 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id D9CC74000C5F; Wed, 14 Oct 2020 13:02:35 +0200 (CEST) From: Mark Wielaard To: linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , linux-kbuild@vger.kernel.org Cc: Ian Rogers , Mark Wielaard , linux-toolchains@vger.kernel.org, Andi Kleen , Nick Desaulniers , Segher Boessenkool , Florian Weimer Subject: [PATCH] Only add -fno-var-tracking-assignments workaround for old GCC versions. Date: Wed, 14 Oct 2020 13:01:32 +0200 Message-Id: <20201014110132.2680-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 In-Reply-To: References: X-Spam-Flag: NO X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on gnu.wildebeest.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Some old GCC versions between 4.5.0 and 4.9.1 might miscompile code with -fvar-tracking-assingments (which is enabled by default with -g -O2). commit 2062afb4f added -fno-var-tracking-assignments unconditionally to work around this. But newer versions of GCC no longer have this bug, so only add it for versions of GCC before 5.0. Signed-off-by: Mark Wielaard Acked-by: Ian Rogers Cc: linux-toolchains@vger.kernel.org Cc: Andi Kleen Cc: Nick Desaulniers Cc: Segher Boessenkool Cc: Florian Weimer Reviewed-by: Andi Kleen --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 51540b291738..8477fee5f309 100644 --- a/Makefile +++ b/Makefile @@ -813,7 +813,9 @@ KBUILD_CFLAGS += -ftrivial-auto-var-init=zero KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang endif -DEBUG_CFLAGS := $(call cc-option, -fno-var-tracking-assignments) +# Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801 +# for old versions of GCC. +DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments)) ifdef CONFIG_DEBUG_INFO ifdef CONFIG_DEBUG_INFO_SPLIT