Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp486411pxb; Thu, 21 Jan 2021 11:50:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxl03l4o6SCiIwEGNCL54GytBHRksGJYwrE33a5w64SiN7HstX4qahFK0zaSRnkmbzVu0NM X-Received: by 2002:a17:906:2f07:: with SMTP id v7mr697185eji.343.1611258617640; Thu, 21 Jan 2021 11:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611258617; cv=none; d=google.com; s=arc-20160816; b=E/9QxbM08I3sSfkSWipzoD781kSkblIKuFiNDa5C3ieZjkDARpYuvr90u234q8g01P y07D27HBJ21Xc9wTSnW9E8+dJ5djYFFf7tzUPTQqQNRt2zbs53xam7xWpnWbLdulVLD/ BUVVJ4utwb1HRARfsy/dQ/5aiTlmBsb4J4FifD0uEq6+xZS+pb7/hKJumMduPTl0K/Jd 0FIa1DjZ7d/fQ68xMonusZrKyeuQDgVGt8IKxXEstj3JxWBxYU3PVktMH+KQlxfkbq/8 okBTvqWBGxREhYo2ebxZ8nrkOThzJNjn0dYKDidOsMqFFpO6VZYq+VkDljWmY+vUJRjI BKGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:reply-to:cc:from:to:dkim-signature:date; bh=1Awk2X9LSHOQQZek4o1ELWbmO0BY+pTltTaN3f2WBw4=; b=V+FRN9td1KZEb7HyTVlvSHSPy7l1KIA6BCVyfko2uHKLdXsc5aoE1pwt7SNNxqKLHP JIEGufMr9eBayO5NqAGcpPekjGXS20ssvBvVkFVc617pGSp9AzKKH8wXSQ6nErTdTun1 4sNPl0QfAf4hwbZ//yM7IY2dUYdh8eRV6bQNq7Hrt595/fuUde178QbgrE2ceQzKbrdH zGz6HsMfyJylkodUvCAGEouTWbgQwTkKil/Qc5yuwY9se+gChZA74IYYtqOA0U/PFURt xRJdD+qme2ykbJrq+vn/BtSTghqv2ko9rxKqpwsJS626EbnhgGLWbDYM9JdQ4bP/8zxX 0k3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=CrQodZ1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c4si2530424edr.176.2021.01.21.11.49.51; Thu, 21 Jan 2021 11:50:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=CrQodZ1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726205AbhAUTsx (ORCPT + 99 others); Thu, 21 Jan 2021 14:48:53 -0500 Received: from mail2.protonmail.ch ([185.70.40.22]:42300 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726019AbhAUSrh (ORCPT ); Thu, 21 Jan 2021 13:47:37 -0500 Date: Thu, 21 Jan 2021 18:45:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1611254762; bh=1Awk2X9LSHOQQZek4o1ELWbmO0BY+pTltTaN3f2WBw4=; h=Date:To:From:Cc:Reply-To:Subject:From; b=CrQodZ1xZM2FLIl9dUu8OGQbAxk8pFD5PDH+MeGcVSm7yNrjJgMYceYpJ4DtZ6Sz9 G/sT2qYGM4zcgSHo9UI6KRunrCt2lTG0vIvGYhsz9kz4rNQgA4Ezy7jbPUVTNIcVJL f6IRqw8gtdbvMnVWdzcFu1tb0zBq5sC+tjaJTl8RpxB5H9BAOGuxyp8vDr83yRf18S HymS15rUgb8k/enkIRmNlOLFHj/PGIhv7Xf2pJrkpU55bodYBCL52/62XlNDcz9v/P fg25BXyyT2dj95PJUi7CWskvbskXafSVA27y9dZV8ER7go6NBgPOxEdr4deCWYFAdG Tb+Pk1nLNANug== To: Kees Cook From: Alexander Lobakin Cc: Sami Tolvanen , Masahiro Yamada , Michal Marek , Alexander Lobakin , kernel-hardening@lists.openwall.com, linux-hardening@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH kspp-next] kbuild: prevent CC_FLAGS_LTO self-bloating on recursive rebuilds Message-ID: <20210121184544.659998-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CC_FLAGS_LTO gets initialized only via +=3D, never with :=3D or =3D. When building with CONFIG_TRIM_UNUSED_KSYMS, Kbuild may perform several kernel rebuilds to satisfy symbol dependencies. In this case, value of CC_FLAGS_LTO is concatenated each time, which triggers a full rebuild. Initialize it with :=3D to fix this. Fixes: dc5723b02e52 ("kbuild: add support for Clang LTO") Signed-off-by: Alexander Lobakin --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 668909e7a460..2233951666f7 100644 --- a/Makefile +++ b/Makefile @@ -895,10 +895,10 @@ endif =20 ifdef CONFIG_LTO_CLANG ifdef CONFIG_LTO_CLANG_THIN -CC_FLAGS_LTO=09+=3D -flto=3Dthin -fsplit-lto-unit +CC_FLAGS_LTO=09:=3D -flto=3Dthin -fsplit-lto-unit KBUILD_LDFLAGS=09+=3D --thinlto-cache-dir=3D$(extmod-prefix).thinlto-cache else -CC_FLAGS_LTO=09+=3D -flto +CC_FLAGS_LTO=09:=3D -flto endif CC_FLAGS_LTO=09+=3D -fvisibility=3Dhidden =20 --=20 2.30.0