linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	llvm@lists.linux.dev, Helge Deller <deller@gmx.de>,
	linux-parisc@vger.kernel.org,
	Masahiro Yamada <masahiroy@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <n.schier@avm.de>,
	Sedat Dilek <sedat.dilek@gmail.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Tom Rix <trix@redhat.com>
Subject: [PATCH v7 8/8] kbuild: rebuild multi-object modules when objtool is updated
Date: Fri, 27 May 2022 19:01:55 +0900	[thread overview]
Message-ID: <20220527100155.1996314-9-masahiroy@kernel.org> (raw)
In-Reply-To: <20220527100155.1996314-1-masahiroy@kernel.org>

When CONFIG_LTO_CLANG or CONFIG_X86_KERNEL_IBT is enabled, objtool for
multi-object modules is postponed until the objects are linked together.

Make sure to re-run objtool and re-link multi-object modules when
objtool is updated.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64)
---

(no changes since v4)

Changes in v4:
  - New
    Resent of my previous submission
    https://lore.kernel.org/linux-kbuild/20210831074004.3195284-11-masahiroy@kernel.org/

 scripts/Makefile.build | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 31feb798e16e..bd5fc2b37387 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -412,13 +412,18 @@ $(obj)/modules.order: $(obj-m) FORCE
 $(obj)/lib.a: $(lib-y) FORCE
 	$(call if_changed,ar)
 
-quiet_cmd_link_multi-m = LD [M]  $@
-      cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@) $(cmd_objtool)
+quiet_cmd_ld_multi_m = LD [M]  $@
+      cmd_ld_multi_m = $(LD) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@) $(cmd_objtool)
+
+define rule_ld_multi_m
+	$(call cmd_and_savecmd,ld_multi_m)
+	$(call cmd,gen_objtooldep)
+endef
 
 $(multi-obj-m): objtool-enabled := $(delay-objtool)
 $(multi-obj-m): part-of-module := y
 $(multi-obj-m): %.o: %.mod FORCE
-	$(call if_changed,link_multi-m)
+	$(call if_changed_rule,ld_multi_m)
 $(call multi_depend, $(multi-obj-m), .o, -objs -y -m)
 
 targets := $(filter-out $(PHONY), $(targets))
-- 
2.32.0


  parent reply	other threads:[~2022-05-27 10:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 10:01 [PATCH v7 0/8] kbuild: yet another series of cleanups Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 1/8] kbuild: replace $(linked-object) with CONFIG options Masahiro Yamada
2022-05-27 15:00   ` Josh Poimboeuf
2022-05-27 17:32   ` Nick Desaulniers
2022-05-28  2:32   ` Sedat Dilek
2022-05-28  7:10     ` Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 2/8] kbuild: do not create *.prelink.o for Clang LTO or IBT Masahiro Yamada
2022-05-27 15:31   ` Josh Poimboeuf
2022-05-27 10:01 ` [PATCH v7 3/8] parisc: fix the exit status of arch/parisc/nm Masahiro Yamada
2022-05-27 13:57   ` Helge Deller
2022-05-27 14:21     ` Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 4/8] kbuild: check static EXPORT_SYMBOL* by script instead of modpost Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 5/8] kbuild: make built-in.a rule robust against too long argument error Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 6/8] kbuild: make *.mod " Masahiro Yamada
2022-05-27 10:01 ` [PATCH v7 7/8] kbuild: add cmd_and_savecmd macro Masahiro Yamada
2022-05-27 10:01 ` Masahiro Yamada [this message]
2022-05-27 15:50   ` [PATCH v7 8/8] kbuild: rebuild multi-object modules when objtool is updated Josh Poimboeuf
2022-05-27 17:41     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220527100155.1996314-9-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=deller@gmx.de \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=michal.lkml@markovi.net \
    --cc=n.schier@avm.de \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=sedat.dilek@gmail.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).