Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp261598iob; Wed, 11 May 2022 13:57:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+8LwpGa2fzsDUuX8QRzvrJ9cLbeqZpnrj9KoxSd7zzUzjEFblCLJ4ZHB6aJ5JceUuJZia X-Received: by 2002:a17:906:9c84:b0:6e0:7c75:6f01 with SMTP id fj4-20020a1709069c8400b006e07c756f01mr26560575ejc.103.1652302632491; Wed, 11 May 2022 13:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652302632; cv=none; d=google.com; s=arc-20160816; b=TxZHPQvMI/ORFBqp04ivcy5yLZeh05DJPr+wO7Fk+ZvHpwi6B3x09ODpWXCYnTj8cq iS6a7XweNeLa7IgId5jcIpiXksd+v8WrqMB5YU8LkxIhywUSJSWmClFGUgBP4hXHny4D jPp7zvfeBtJ60w1uUtSPhVcYTqB56XQGfc96k+yzleCnIg5o4btv3u8QZIIkQmw5RMi0 QjfM2a4XzHHq8Cg048frCFmL9i0/MZph6Ok/RsVeJyOydrLCZwa0ZAMjCQ/7kc7n9Ncz w4CcAQ4IAJ4KVUG+gqyKrN1g2oRHWeBz8xnXpeQ1JAhzOl+r3sKNQfqnuCMqwplIJNFt dBVg== 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:dkim-filter; bh=lwhcZwty1WSqzMwcqIa4FpY71JgLgetW2nQZRkklH+o=; b=BKUhqAZg4MIdHdMpzZtSnch26Z6rhp22b6fwYdFkZZx2ivS8qcpBSAjNVK/FYr9Yce 36bEUFGz8AJBxyunrZCPIFUTFMqcY7EAUJ3RPhs9ULd/oEREoL0LKDjmdeQVqjq5yoZk lEPCgpg3pp1x6t/FrMq154ikLG2AiMArxT6FfTXTi3ergpkgaKhzk0LxrAscyPFMuOfP /IYJ6Ge01mgHh7bXwfPPJBPLUXPFNy2u+zk95+7F/Qg7VK4SHEJKb/zyC4onxHza+TWg XX3hkQFZu+Kj3qlLPH5l+pykrxlnrjZATc6kcILkqigDgE7yKwcxHSQqLfN5fiN/gF+B KBWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Vbl4SEiY; 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 r24-20020aa7cb98000000b00421f487882fsi3308779edt.322.2022.05.11.13.56.23; Wed, 11 May 2022 13:57:12 -0700 (PDT) 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=@nifty.com header.s=dec2015msa header.b=Vbl4SEiY; 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 S1345180AbiEKQvW (ORCPT + 99 others); Wed, 11 May 2022 12:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345101AbiEKQuh (ORCPT ); Wed, 11 May 2022 12:50:37 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB56980B0; Wed, 11 May 2022 09:50:04 -0700 (PDT) Received: from grover.jp (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 24BGlWc7031975; Thu, 12 May 2022 01:47:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 24BGlWc7031975 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1652287665; bh=lwhcZwty1WSqzMwcqIa4FpY71JgLgetW2nQZRkklH+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vbl4SEiYvvF37f1IoBEjasxAsVDVSQV8iEM8Mi1h0FEwr6nbrD3P3UYOZTcXB+dwW P4z9VJ4VCWJvC1cJ1pmve8jsN9WLx+eVX79Xl6TrT24LXAougV9Awt53/UrOSkZd43 X5EErlnVqv3GL29CA/j+CRK/e3buKnMpnmqT6knIllg7DKJ7KcmM/wga5P7pkHiye6 7Ntd8KWojBuvIyoY6awGSQNZfD7l35B6l5NF8xgdOhRDKMrTfKY1D5UlWG6fqVCJ0C yVqCAChqiTv/BoII/V6PNLSr8f0DT6kA6jxx/hAq260ykEre9DLp5hGZYDAkUG3GK/ a6HnJhQ6XrVqA== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Peter Zijlstra , linux-modules@vger.kernel.org, llvm@lists.linux.dev, Ard Biesheuvel , Sami Tolvanen , Masahiro Yamada , Kees Cook , Josh Poimboeuf Subject: [PATCH v5 12/12] kbuild: rebuild multi-object modules when objtool is updated Date: Thu, 12 May 2022 01:45:14 +0900 Message-Id: <20220511164514.2741934-13-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220511164514.2741934-1-masahiroy@kernel.org> References: <20220511164514.2741934-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 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 Reviewed-by: Kees Cook Acked-by: Josh Poimboeuf --- (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 f546b5f1f33f..4e6902e099e8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -404,13 +404,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