Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp877663ybt; Wed, 24 Jun 2020 13:34:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyg+4x3tSl6PAziUxbYZCjcGP7+3iYoH5jQBJXZBRkHyabB7UqcXo1H2J7gwBn0iGAH3rQ X-Received: by 2002:a17:906:88d:: with SMTP id n13mr13761170eje.349.1593030880007; Wed, 24 Jun 2020 13:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593030879; cv=none; d=google.com; s=arc-20160816; b=PwmqlzD91vg5bISRo3tBGQZbLNb1s4CI6PcvnmnLmT9agm3Zv3oRkGzUjUS5m7YbD6 +HU8YkPmaQroit6zLRd+Ne312olqR/YSrcS1vaDTymATaCFK1ONKdiSg+T8FEWSzYaz5 MWjeo/A/h1K0TDPSP88UbGSYK28cJswj+UWUUjbkKnbX5HYi0BROLmQj3DdIVWCvM+NY 0hnpX/4+ViH7O/VYmoPmpDXpV0cQeLpnIvnctbFyvFTyVsLIt8EXmZ7mCFttQMrZ2tXe uOeQFaYw06++hYiap8Ju7tMeTiZNHEdHy9Nz5in6wrDypZDqqZurwMh7vREwUG4QOKfN ppTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=tvg1Fbryi0kMABLSJZV+2LlG9cMfXZohRvKr2b10/ew=; b=Q9mM/Sl/hPzLktvdYY91LzOSJMWRGlAK1ZUUmz4OpCpTMkI6VmvuEEpVW2JtXtY7OZ Zs8K78R73I+eKh1WlOhKPRuCKB2OXzD/C/DUY+PbQRTR8wrN0vEX+5xtYaiixVRE2vY+ +pt42ZzNHGacIlFeAKakLCJ16ArrdVLCF8HslqaIMT77yruFkFRI0QJgzfkt7uvB4lWm jHK28v2nLFPE5J0M54+Hi4izVfdsXiNujDeYM5PcZZWMHn/TkGt5AifZ4vZwPkAeAvcn l6DvVJKHL/VQb3fYQ/t3jB0JurCPgbshk6hXuzRxipEcUog6iA31Ba3rUNtvQNme0Woh 9tDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qDi1kJQp; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si9228373edq.110.2020.06.24.13.34.16; Wed, 24 Jun 2020 13:34:39 -0700 (PDT) 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=@google.com header.s=20161025 header.b=qDi1kJQp; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406624AbgFXUdo (ORCPT + 99 others); Wed, 24 Jun 2020 16:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406611AbgFXUdj (ORCPT ); Wed, 24 Jun 2020 16:33:39 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C65DCC061799 for ; Wed, 24 Jun 2020 13:33:38 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id r19so2352661qvz.7 for ; Wed, 24 Jun 2020 13:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=tvg1Fbryi0kMABLSJZV+2LlG9cMfXZohRvKr2b10/ew=; b=qDi1kJQp6Ay8PowzBhvgcAgfJKyEY22DJ3SehuRqjn/jA9tuCP3XgBFwyavVII/8H8 +qDUOb2y6OKXwsbI5cxksI3QZk1MHXAA03OHDhdjTbrRcF9EMaP1PLIUJPhY0/usboE5 WysdzKDHLGBWRBK078rHZqlAErXt2qVt2sq358db2q+vTaEhfb2Ztz8s+Npc56SUR/GU zam+aC0Fi9TXcLLkm/vCwtmB9CZFKkHlUgIzUuWu5eMrmtKdAXKTOQSgFxHw8mPgwD7i VrVAm6xkIce/iluM0BjvQMvc/W7Io0XF/CLOQ/Xz7mhbTAKzZSonAVtghl5cbcwT3k0W qRXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=tvg1Fbryi0kMABLSJZV+2LlG9cMfXZohRvKr2b10/ew=; b=KGDYj7rnL8tiRx4vx1NwY21mBN3FM6BGyKJA1yMvLbNm4lIUlLw9YzsfcervjZoM+h kaggur5NcSo5TP5tx0YzuFzM4T9WabW/x/pkPeXoK6Het9HwkTZ2hx9BgUkPGk3C2toY s2LbX2tu0uNOsR33tACPACsu3xrEXkSsM37+4QD4/QGJTWvSomqpD3diIN4RDh9dLGu3 fUN7WVsdjPqiSrNYyh9tHpt3GNL7i5kin7gQrTPzweD47PHi+WN8o79snoxUgHEWXNf5 B+NiI7VEqyIDtIbqvgiON5qenqz0PKyGwWQLAnL5a/GAhTrKdH/KwxhbULP3Wxv7sexO dokg== X-Gm-Message-State: AOAM533V5IoW4mAUrEUMjpwTslWS+1oh1BuoE9PkoFGNpPx8u1P9yRjV gWxB4abEjMcOmCDc/VQFVE3pU/VFaO3eD7X/dBE= X-Received: by 2002:a05:6214:846:: with SMTP id dg6mr31350632qvb.210.1593030818021; Wed, 24 Jun 2020 13:33:38 -0700 (PDT) Date: Wed, 24 Jun 2020 13:32:00 -0700 In-Reply-To: <20200624203200.78870-1-samitolvanen@google.com> Message-Id: <20200624203200.78870-23-samitolvanen@google.com> Mime-Version: 1.0 References: <20200624203200.78870-1-samitolvanen@google.com> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog Subject: [PATCH 22/22] x86, build: allow LTO_CLANG and THINLTO to be selected From: Sami Tolvanen To: Masahiro Yamada , Will Deacon Cc: Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, x86@kernel.org, Sami Tolvanen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow CONFIG_LTO_CLANG and CONFIG_THINLTO to be enabled. Signed-off-by: Sami Tolvanen --- arch/x86/Kconfig | 2 ++ arch/x86/Makefile | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 6a0cc524882d..df335b1f9c31 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -92,6 +92,8 @@ config X86 select ARCH_SUPPORTS_ACPI select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_NUMA_BALANCING if X86_64 + select ARCH_SUPPORTS_LTO_CLANG if X86_64 + select ARCH_SUPPORTS_THINLTO if X86_64 select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_QUEUED_RWLOCKS select ARCH_USE_QUEUED_SPINLOCKS diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 00e378de8bc0..a1abc1e081ad 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -188,6 +188,11 @@ ifdef CONFIG_X86_64 KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000) endif +ifdef CONFIG_LTO_CLANG +KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \ + -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8) +endif + # Workaround for a gcc prelease that unfortunately was shipped in a suse release KBUILD_CFLAGS += -Wno-sign-compare # -- 2.27.0.212.ge8ba1cc988-goog