Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp811794rwd; Thu, 18 May 2023 04:26:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5T92SCRS+r4WrzzpdwlzrpomlgM6X++9ckAZ2bmkiIoHUIbn2S7qWUqsW3jtrQr0MYripd X-Received: by 2002:a05:6a20:d495:b0:106:774c:8bc1 with SMTP id im21-20020a056a20d49500b00106774c8bc1mr1698253pzb.48.1684409180806; Thu, 18 May 2023 04:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684409180; cv=none; d=google.com; s=arc-20160816; b=ZoBvyy6NDsiwBP3tvOc0HX8CKi36k6BbkZuPFD+VHzCqRre5G0CEGgOAn1hcipbGaY JaSm+ZSZhyzi/m8D3LIjFU5jYrf7QNuMS92PA7ixykP/QH7HRGXt3CdSBzzJNZG6Hnl3 VaLAB97Gk7r9h8qnmWDhJh0ctwNds1GfusE/e7dFZnb+lMIa58aEvzGeJb3mH5Ecl09n 32eoqEOxWs1xFn2DryhAqbnYsHsQ9lp1ndKltN1SROdY0oWbtBfZxNJCoS0vuz9UJPZr bIl1fK6ljLonMCmsTEFd+K4izgj8Q5WFpG+ZqapbvVjVOiJCJzTI65dp1ji+FU48xs57 3tOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=4ATqR6+23eUp9OSsJpJ6LDVDI6BWgqiqufebazH3Qso=; b=nP39Mmt72hW23rKGYzuXXNqciW6jEQ1XxXulB0IlhCmfxWVK9TIuT+MQ35X5cnrf0I WnO7omBNkQsJbhKNgUIjkZbKqxU0nyBTlJrAST3qnnJ5Woa2RcOOCFZDMkljOAr+Y6as xgsj9jpX+xMpcqTWK621r0Xlw/8YUQU/VbOG6GqKwAbY66QOxpf8xHLxB3L0Ks4U75UJ MyzDI8ImgaOIkWTJEWBXOWjxZnZPIDpSrpF2nCZo17OSCWxRxx9Kq0AsRg4wdMurdyDe XM4WGwcA1BzceiRfY44/LT0X2llvtzr86TZIlWnDbyKmDVQ2yI+68rHchyXNNWIytP9X wQWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Z4k5wrCp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IeH4ed2b; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a17090ae60200b0023def94be5esi1465497pjy.20.2023.05.18.04.26.08; Thu, 18 May 2023 04:26:20 -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=@linutronix.de header.s=2020 header.b=Z4k5wrCp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=IeH4ed2b; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbjERLJJ (ORCPT + 99 others); Thu, 18 May 2023 07:09:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjERLJI (ORCPT ); Thu, 18 May 2023 07:09:08 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1BF1738; Thu, 18 May 2023 04:08:30 -0700 (PDT) Date: Thu, 18 May 2023 11:08:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684408083; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4ATqR6+23eUp9OSsJpJ6LDVDI6BWgqiqufebazH3Qso=; b=Z4k5wrCpButQ5ztn8gNmpE86UfOfX4NGi5ZC4IQrgITNMYssFktm0GAn5GCm4ZQXF+Nm74 Zr6427PdGY6kIQv8oYROUEZeBb6BMxiZp8vs79do2vgk4b7k5Nb9DF8FExnThO5OCq+2+B eWa60oRfeHtneDrcFJotyQEYHn85vzTfutifvW7uIpqUb4eIyiB/vtAJOaNFHu56NGpktU E1BAwP+jnQ/ogxli4txfZL3NZqfyWsZILHbRFF/Z//1K/Jzf71Z4d4ej0u+3rvqAEaAtWj ByvKrApri9lxRMgHsXLlMdllecWkqasCYMvvbWTvhGULUYcsWeMd2x/ZEWNI8w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684408083; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4ATqR6+23eUp9OSsJpJ6LDVDI6BWgqiqufebazH3Qso=; b=IeH4ed2b6ngQPj7TAI/c3beRbDIHDEl3f2syZ7bc4mZ2qVroxvf02OXPEb6/bplYWX1t4F TnsCptdoN/EVyCCg== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Limit unreachable warnings to once per function Cc: Miroslav Benes , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <9d38f881bfc34e031c74e4e90064ccb3e49f599a.1681853186.git.jpoimboe@kernel.org> References: <9d38f881bfc34e031c74e4e90064ccb3e49f599a.1681853186.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <168440808302.404.11280971463305376650.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 The following commit has been merged into the objtool/core branch of tip: Commit-ID: 5e3992fe72748ed3892be876f09d4d990548b7af Gitweb: https://git.kernel.org/tip/5e3992fe72748ed3892be876f09d4d990548b7af Author: Josh Poimboeuf AuthorDate: Tue, 18 Apr 2023 14:27:47 -07:00 Committer: Josh Poimboeuf CommitterDate: Tue, 16 May 2023 06:31:51 -07:00 objtool: Limit unreachable warnings to once per function Unreachable instruction warnings are limited to once per object file. That no longer makes sense for vmlinux validation, which might have more unreachable instructions lurking in other places. Change it to once per function. Note this affects some other (much rarer) non-fatal warnings as well. In general I think one-warning-per-function makes sense, as related warnings can accumulate quickly and we want to eventually get back to failing the build with -Werror anyway. Reviewed-by: Miroslav Benes Link: https://lore.kernel.org/r/9d38f881bfc34e031c74e4e90064ccb3e49f599a.1681853186.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 5 +++-- tools/objtool/include/objtool/elf.h | 1 + tools/objtool/include/objtool/warn.h | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 0fcf99c..98e6c3b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4514,6 +4514,7 @@ static int validate_sls(struct objtool_file *file) static int validate_reachable_instructions(struct objtool_file *file) { struct instruction *insn; + int warnings = 0; if (file->ignore_unreachables) return 0; @@ -4523,10 +4524,10 @@ static int validate_reachable_instructions(struct objtool_file *file) continue; WARN_INSN(insn, "unreachable instruction"); - return 1; + warnings++; } - return 0; + return warnings; } int check(struct objtool_file *file) diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h index e1ca588..78e2d0f 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -61,6 +61,7 @@ struct symbol { u8 return_thunk : 1; u8 fentry : 1; u8 profiling_func : 1; + u8 warned : 1; struct list_head pv_target; struct list_head reloc_list; }; diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h index b1c920d..f195dea 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -55,7 +55,12 @@ static inline char *offstr(struct section *sec, unsigned long offset) #define WARN_INSN(insn, format, ...) \ ({ \ - WARN_FUNC(format, insn->sec, insn->offset, ##__VA_ARGS__); \ + struct instruction *_insn = (insn); \ + if (!_insn->sym || !_insn->sym->warned) \ + WARN_FUNC(format, _insn->sec, _insn->offset, \ + ##__VA_ARGS__); \ + if (_insn->sym) \ + _insn->sym->warned = 1; \ }) #define BT_FUNC(format, insn, ...) \