From nobody Sat Nov 23 08:36:06 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0953618F2F6; Wed, 13 Nov 2024 23:45:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731541533; cv=none; b=lPKzKVNw+wMjQkptc3TuLyA2dnnEN30D1NUVKUs8CSiPQE7WsEwFT/jZup3l8czXg/Qw6H8xuBm/hO9RVQtrXJIk58MYftX1/UAciP1/6Gc/hQ8uSkLGq6U7wGlbeFLai1AJHgHS6awbjKEnK8PNTrl0yAPaHpy5pscZf5o5qz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731541533; c=relaxed/simple; bh=vPSWjBuFWVQznjZaqIObNUB0TUhuFS1m7kM/on2+uGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QHDmd5d1QJWCsh8subep3UWr4weL/yWsnSfGhQfORATRufuZislL5rZwgDLWougrCQ5K+Az7xttOPenY9dK7lXAR3EU98XiZSGdvhpgMT9jxyBD8rsIEBD+irT8dlts/tbzxnxfOCWPsWrSuVdlyrFVhNIq3dUAwhGDIP5HUbmE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fuJW5uEO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fuJW5uEO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D0C2C4CED7; Wed, 13 Nov 2024 23:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731541532; bh=vPSWjBuFWVQznjZaqIObNUB0TUhuFS1m7kM/on2+uGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fuJW5uEOYa4ULZSQ4d0T5dC5eBfulC8SSSnTskRb8hU4G2Bf8bFCNFTC9M1sy4E7T BubypoRnfktz3sLajPRjUiNAG1B27BZtO8WdxgGooLLFiDzqlKB/BovNMYFRQ1MZcP T/DjyyUv9f7S8o5M6DdDAcmKr6xsmI3psS3O9SGAvEkOmOaO0a2WneNkOLq34bbjXb 5QRTmMrDjhHYjdMb/omNWFRgjpF9o848bgamKCI+CvMSdZxl7ux4cQbhcYWdVkk9B0 OomDImTb6TEeFu4N9B87oC+eFeoiicvB3ke6SnAvrwhuAAEWwqSn4hkmt6QCVuBvVw gixl1yXPnGOAg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Paul Menzel , Borislav Petkov , Nikolay Borisov , Marco Elver , Josh Poimboeuf , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] kbuild: move cmd_cc_o_c and cmd_as_o_S to scripts/Malefile.lib Date: Thu, 14 Nov 2024 08:45:21 +0900 Message-ID: <20241113234526.402738-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241113234526.402738-1-masahiroy@kernel.org> References: <20241113234526.402738-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The cmd_cc_o_c and cmd_as_o_S macros are duplicated in scripts/Makefile.{build,modfinal,vmlinux}. This commit factors them out to scripts/Makefile.lib. No functional changes are intended. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 8 -------- scripts/Makefile.lib | 12 ++++++++++++ scripts/Makefile.modfinal | 6 ++---- scripts/Makefile.vmlinux | 8 +------- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 1aa928a6fb4f..24e10c821461 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -141,11 +141,6 @@ ifdef CONFIG_LTO_CLANG cmd_ld_single_m =3D $(if $(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(t= mp-target) $@; mv $(tmp-target) $@) endif =20 -quiet_cmd_cc_o_c =3D CC $(quiet_modtag) $@ - cmd_cc_o_c =3D $(CC) $(c_flags) -c -o $@ $< \ - $(cmd_ld_single_m) \ - $(cmd_objtool) - ifdef CONFIG_MODVERSIONS # When module versioning is enabled the following steps are executed: # o compile a .o from .c @@ -336,9 +331,6 @@ cmd_cpp_s_S =3D $(CPP) $(a_flags) -o $@ $< $(obj)/%.s: $(obj)/%.S FORCE $(call if_changed_dep,cpp_s_S) =20 -quiet_cmd_as_o_S =3D AS $(quiet_modtag) $@ - cmd_as_o_S =3D $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool) - ifdef CONFIG_ASM_MODVERSIONS =20 # versioning matches the C process described above, with difference that diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 5660dfc9ed36..73e385946855 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -298,6 +298,18 @@ $(foreach m, $1, \ $(addprefix $(obj)/, $(call suffix-search, $(patsubst $(obj)/%,%,$m), $2,= $3)))) endef =20 +# Build commads +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D +# These are shared by some Makefile.* files. + +quiet_cmd_cc_o_c =3D CC $(quiet_modtag) $@ + cmd_cc_o_c =3D $(CC) $(c_flags) -c -o $@ $< \ + $(cmd_ld_single_m) \ + $(cmd_objtool) + +quiet_cmd_as_o_S =3D AS $(quiet_modtag) $@ + cmd_as_o_S =3D $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool) + # Copy a file # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D # 'cp' preserves permissions. If you use it to copy a file in read-only sr= ctree, diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index bab53884f7e3..d0153d033bbb 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -9,7 +9,7 @@ __modfinal: include $(objtree)/include/config/auto.conf include $(srctree)/scripts/Kbuild.include =20 -# for c_flags +# include some build commands include $(srctree)/scripts/Makefile.lib =20 # find all modules listed in modules.order @@ -23,9 +23,7 @@ modname =3D $(notdir $(@:.mod.o=3D)) part-of-module =3D y GCOV_PROFILE :=3D n KCSAN_SANITIZE :=3D n - -quiet_cmd_cc_o_c =3D CC [M] $@ - cmd_cc_o_c =3D $(CC) $(filter-out $(CC_FLAGS_CFI), $(c_flags)) -c -o= $@ $< +ccflags-remove-y :=3D $(CC_FLAGS_CFI) =20 %.mod.o: %.mod.c FORCE $(call if_changed_dep,cc_o_c) diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index 9ef0480ed755..1652561896eb 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -6,20 +6,14 @@ __default: vmlinux include include/config/auto.conf include $(srctree)/scripts/Kbuild.include =20 -# for c_flags +# include some build commands include $(srctree)/scripts/Makefile.lib =20 targets :=3D =20 -quiet_cmd_cc_o_c =3D CC $@ - cmd_cc_o_c =3D $(CC) $(c_flags) -c -o $@ $< - %.o: %.c FORCE $(call if_changed_dep,cc_o_c) =20 -quiet_cmd_as_o_S =3D AS $@ - cmd_as_o_S =3D $(CC) $(a_flags) -c -o $@ $< - %.o: %.S FORCE $(call if_changed_dep,as_o_S) =20 --=20 2.43.0