Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp990208iob; Fri, 13 May 2022 18:48:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0LSyOjicLFG0VPixTeOrbPZrX8OaL2MvZaMkWbD0W5IJ4xIV0wqeTIjdbwn2H2YhtrZ6e X-Received: by 2002:adf:ea12:0:b0:20a:e14b:2710 with SMTP id q18-20020adfea12000000b0020ae14b2710mr5892647wrm.81.1652492908403; Fri, 13 May 2022 18:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652492908; cv=none; d=google.com; s=arc-20160816; b=y5YfFo5p90ZKNQQUJ/qh0JIHRPD3tQOsvbqYfDVcQR5WHx6zIV1I8ZmhAhdQCnlxTZ 2ga5Iw8hYLX62gto22Twilah+hEU5lRwIk2aS3bUkM66LigQ22eYcCP4JrlnQ33N9Nbd xo5AHvkEnygUp5abAP2gGA/vfxDQjU02HBdVUYWAcV0Ang8jaw7wRrS5YNRy0P0m1brD 5y8DDOfqOHbcs0F1M6QMW9Hu9zwbVBpQImBciAbTokhqQu8f/xwimq6x/KX3XwZ50p9i EQFh2ovNkA6O1R7JivVpoMf1Xx3xZWQsTXaYFwgjBxCul6mPI3ol8ypg6ps/pnbsngkb qgyA== 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=Bi6sLfbdKmIO2edbwjx7czMHPSd9O/aqQ3lYRuHiOMI=; b=Tti0WZngif+EOqZXp0LPtUyMtXMBrJJmxXr2h8w1Gp8a7TNvX0SN4glcw41x1Tan5i bsiUyiPJxTPcF93MNRNEOq6HVMdZVyydxRblIVN3zeXIT0G0VX9frYt/XxE4hiY32BRw KF1EIl6VWrIAiMpO1niN+ganOryYzuzybDIvQoGqYzmPp0pLzkgymOQW+oG8n11tEuoH TGDW1AAiW+LH0+Jbz1E7Bmf1aIgWgo/h73lA5swu5d/prC9wAMPJjnVnsZSB8rlKU8+p qr9+9Au94Obs2K/uJ+l/Ow+FnLi+S3RW/eePYJUXaF2Cj39VZ8Whi4KFeF8ZHUbCf0LJ FQlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=hdUTS2mg; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m7-20020adfdc47000000b0020af34a0505si3763680wrj.3.2022.05.13.18.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:48:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=hdUTS2mg; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0A5F31D1A0; Fri, 13 May 2022 17:12:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380042AbiEMLoT (ORCPT + 99 others); Fri, 13 May 2022 07:44:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380033AbiEMLnV (ORCPT ); Fri, 13 May 2022 07:43:21 -0400 Received: from conuserg-07.nifty.com (conuserg-07.nifty.com [210.131.2.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF8D3101161; Fri, 13 May 2022 04:42:44 -0700 (PDT) Received: from grover.sesame (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-07.nifty.com with ESMTP id 24DBeEwj008349; Fri, 13 May 2022 20:40:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 24DBeEwj008349 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1652442025; bh=Bi6sLfbdKmIO2edbwjx7czMHPSd9O/aqQ3lYRuHiOMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hdUTS2mg2rDpdAJcbEQpj2OfKf33I0W4Yq5MEfcwF+1CtKl+75/KpXnDJmtO7abjQ RalunWSjbIoNDQnrNfI+hyKQWJtRvhtCkSglRaoWbw8rZ3h43spsOO9UcygVE+pdf9 gHnsela+702mUaKYbhwf8D47e4VnC4mHHVG3kUUKcVZ/vb/zrrO+MHawDh/EIbq6s0 kqwxx6ckuggBKwsz37MGkSro6qw02t47kTEF16n9+/0/wt1x/HVOadDkYiAHm/t5za aXxTc0Bv/Q+idke1jb+Jv4VedpCMtdI9JdzSOq1ElCijT79ZbtpBUVagrLEeAtE5y2 +ucnspf/63/OA== 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 v6 10/10] kbuild: rebuild multi-object modules when objtool is updated Date: Fri, 13 May 2022 20:39:30 +0900 Message-Id: <20220513113930.10488-11-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220513113930.10488-1-masahiroy@kernel.org> References: <20220513113930.10488-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE 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 Tested-by: Nathan Chancellor --- (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