Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5489221rwb; Mon, 14 Nov 2022 05:32:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf5yXU9zXKlO9U8/TLuwA+v1o0aOc0tW7aWtG1PiAOxFXzHpzKFsm0L/VM9QhEbiE24Cpn9I X-Received: by 2002:a17:90a:1904:b0:213:22d:b2e2 with SMTP id 4-20020a17090a190400b00213022db2e2mr13565025pjg.148.1668432746676; Mon, 14 Nov 2022 05:32:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668432746; cv=none; d=google.com; s=arc-20160816; b=d7eLNd2oOmTFVnOKGjJj3RfvgGCzybYVPDucWXgIfTfq4NTfd5vbE5nHN6oU1TdbgS A/qDyaFyXoMBiVB9B/zXrRxh+0REPfnIazt+sphpaiBlpPm6obucClpzuHwOSzAmQd63 Y2iLAiJQCRYTrmoRoed+U/L1cg7xYhxpJBqvjXhTbNsmYzy0W75NhylGBGgEelE3OeYh XlhTrozE+x/rUi3lmxfoJiLFsVBGbex115D+srtBSmgTtcJtAWC8wLrVo+JfaYl+FxFs 3oYQiZmmRzF2qs4dq6JslA/PpsxlE24rxJD690GBpDZEaTdk/5aU/seJ3I1/NRG8J5Ah 4sHQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EJAJFHR7RCtoqSc/MLHiIuiYndNYnthA9bZlw039hpQ=; b=qdvag0tiTRKJZDjQGoSnwD7CM68piSY+Aredky37Xp01SfeU2PcPU8ulKUXR0+Jgi9 2nHMowPwip+HsirJ/tZ5gWP118QUI8OczeL95Y+hx+G9zIIblcPdebXVJLo3bUfptSpl jL0jTmXdY1J+5LCRc1hCisesAgFWrlPsCrnl4ROH0GaxOMlyK7KR56W5s3MzXCp0dbtf 3vnQADGRPLwSBQyjCz/9/8+m7XHYYnGJF/7iM3WsE5Cn2mEMuz7QFfvP8eG8f78YRWEP dxWj229olRZDTbkKu1/pEBKsPhnHuoURpZoPb8l3/djnsLGoN+RIjtgbDDl9oDyxy1vb AyBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ig5CDdXq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a6555cd000000b004700981177dsi9781266pgs.528.2022.11.14.05.32.12; Mon, 14 Nov 2022 05:32:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ig5CDdXq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236769AbiKNLq4 (ORCPT + 88 others); Mon, 14 Nov 2022 06:46:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236602AbiKNLqO (ORCPT ); Mon, 14 Nov 2022 06:46:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98790233BD; Mon, 14 Nov 2022 03:45:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCE9C61087; Mon, 14 Nov 2022 11:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 731AFC433D7; Mon, 14 Nov 2022 11:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426307; bh=rax9Sk0B97anfjE870tVIfylOGOMvkqIjn17Y4+e0zw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ig5CDdXql15Gd4fTP+IlvjoNHuzHJ1zDAzs4QbD1+lazKnKCGuM6a3Uft+OMx66Xt 8U15M+SeRg6aVyP0214WZo5NmzOwzkrpzlLdbt6OLr1347K9G60URIFBT2/NARAjcD pycuPOnQGZmhBS/w2xZXJquS8UwgI3vi0Zc1ItKB2gra8PWZ/qPLncpVkxiczC9CJr j9/JIbQMIt/EEdfFRm9cP8A+6YX4oU5qO6oEBnbkU3+FZQEE4MrOHFVE0I5u0Pxf+N E9RFsrchKpk8KrzeUB7FDEDS2psNEjuwE451izXf/2+67zbtlMJtUy5FXJyWrNSZEt O9bKWwNdvdvuw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 29/46] scripts, lto: use CONFIG_LTO for many LTO specific actions Date: Mon, 14 Nov 2022 12:43:27 +0100 Message-Id: <20221114114344.18650-30-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen The clang LTO and the gcc LTO share some changes in Makefiles and build scripts. Change the common ones to use CONFIG_LTO instead of CONFIG_LTO_CLANG so that they can be used by gcc too. [js] fix scripts/link-vmlinux.sh too Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- Makefile | 2 +- include/asm-generic/vmlinux.lds.h | 2 +- kernel/kallsyms.c | 2 +- scripts/Makefile.build | 2 +- scripts/Makefile.lib | 2 +- scripts/link-vmlinux.sh | 2 +- scripts/module.lds.S | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 58cd4f5e1c3a..0b723c903819 100644 --- a/Makefile +++ b/Makefile @@ -992,7 +992,7 @@ endif endif endif -ifdef CONFIG_LTO +ifdef CONFIG_LTO_CLANG KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO) KBUILD_AFLAGS += -fno-lto export CC_FLAGS_LTO diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 3dc5824141cd..5e2179dd41d5 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -96,7 +96,7 @@ * RODATA_MAIN is not used because existing code already defines .rodata.x * sections to be brought in with rodata. */ -#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG) +#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO) #define TEXT_MAIN .text .text.[0-9a-zA-Z_]* #define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$L* #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]* diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 60c20f301a6b..1d4557ae090f 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -167,7 +167,7 @@ static bool cleanup_symbol_name(char *s) { char *res; - if (!IS_ENABLED(CONFIG_LTO_CLANG)) + if (!IS_ENABLED(CONFIG_LTO)) return false; /* diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 564a20ce2667..0a28e3884efe 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -153,7 +153,7 @@ is-single-obj-m = $(and $(part-of-module),$(filter $@, $(obj-m)),y) # When a module consists of a single object, there is no reason to keep LLVM IR. # Make $(LD) covert LLVM IR to ELF here. -ifdef CONFIG_LTO_CLANG +ifdef CONFIG_LTO cmd_ld_single_m = $(if $(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-target) $@) endif diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 3aa384cec76b..ac918fd84d96 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -269,7 +269,7 @@ objtool-args = $(objtool-args-y) \ $(if $(delay-objtool), --link) \ $(if $(part-of-module), --module) -delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT)) +delay-objtool := $(or $(CONFIG_LTO),$(CONFIG_X86_KERNEL_IBT)) cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool-args) $@) cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 918470d768e9..652f33be9549 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -60,7 +60,7 @@ vmlinux_link() # skip output file argument shift - if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then + if is_enabled CONFIG_LTO || is_enabled CONFIG_X86_KERNEL_IBT; then # Use vmlinux.o instead of performing the slow LTO link again. objs=vmlinux.o libs= diff --git a/scripts/module.lds.S b/scripts/module.lds.S index da4bddd26171..b36b0527b0a8 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -27,7 +27,7 @@ SECTIONS { __kcfi_traps : { KEEP(*(.kcfi_traps)) } #endif -#ifdef CONFIG_LTO_CLANG +#ifdef CONFIG_LTO /* * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and * -ffunction-sections, which increases the size of the final module. -- 2.38.1