Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1561194ybb; Thu, 26 Mar 2020 03:10:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtO2Pw5V+rydtxSvXSm5mG8074JW97ucvjYAeY/ZVjI/WOgZryBQrpUd71HZ17+NLTAwr0S X-Received: by 2002:aca:fc88:: with SMTP id a130mr1150464oii.89.1585217432525; Thu, 26 Mar 2020 03:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585217432; cv=none; d=google.com; s=arc-20160816; b=Fr6Mq/lFVzymXGU1LiUPHQvLv2V3u5z7MR4gQ03if/x0mkJrfxyFH2QCDdeZqIV8DA Ja1fZCRnblQ+u68bV5h3uvpWmp5qs8Lbe0WWASw0HpQU0WgjhS6DU/qjyPyskDKKbWP/ FaeGk54qb0oqRzoHCVsugRZnoaiMVppIsNycbowV1ujWzIPOZzezRa6McmcNM8vyAiqA J3dCKeeYQDOjYKlWs8miY9JglXvqkoO/Rm8QkgbhKgnafdyzTZ0ZU95MuoWAV3VLMMA+ tkmdX6AIsJ+EZVSG+5QIv+7Yv8Rve7JdwbF7Dlg+N/BpQTA6SohOMDCIO1mPC+YI/3D8 mU+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=MvWTe59RDlnchmokS9L06lYab3pYCMgrE487K/NJ8Lw=; b=hschbKjsVVg+vxJymaANlYtZzznHa/v2j2kpd2fXj4AzeduVzBm3iHyKwX1BedzuBD oSTTTBGCxA/hRkYSAHLz68P71Pd+DCj24K2Gd3zg2Gmyib1xDScAmCxkt+j+kNTfwfu7 o0rJlNjL5pLCp6PjvgXbDgQD38OtBuNpBxiFehprhj6NZBnFhfKZxQ5l1IErF0GBIeWW IjrJuz2i9qE7Ax8JpiwBdPj+oCZyjSjkW9O1fPfBHPUVnXI7gV/peNaXUEqcez12nN3o qYAA/JdrUH/lR5pkrOWgPGQPvzVPVzjOCHFmWCVnH/utMpxtZWadWGNPeJAiMcIoK5AB OiIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si44357otq.23.2020.03.26.03.10.18; Thu, 26 Mar 2020 03:10:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727833AbgCZKIl (ORCPT + 99 others); Thu, 26 Mar 2020 06:08:41 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:50174 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbgCZKIl (ORCPT ); Thu, 26 Mar 2020 06:08:41 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jHPRA-00045R-OJ; Thu, 26 Mar 2020 11:08:32 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 3FAFD1C0440; Thu, 26 Mar 2020 11:08:32 +0100 (CET) Date: Thu, 26 Mar 2020 10:08:31 -0000 From: "tip-bot2 for Peter Zijlstra" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/objtool] objtool: Re-arrange validate_functions() Cc: "Peter Zijlstra (Intel)" , Miroslav Benes , Josh Poimboeuf , x86 , LKML In-Reply-To: <20200324160924.924304616@infradead.org> References: <20200324160924.924304616@infradead.org> MIME-Version: 1.0 Message-ID: <158521731184.28353.5517081652261174451.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/objtool branch of tip: Commit-ID: 350994bf95414d6da67a72f27d7ac3832ce3725d Gitweb: https://git.kernel.org/tip/350994bf95414d6da67a72f27d7ac3832ce3725d Author: Peter Zijlstra AuthorDate: Mon, 23 Mar 2020 20:57:13 +01:00 Committer: Peter Zijlstra CommitterDate: Wed, 25 Mar 2020 18:28:31 +01:00 objtool: Re-arrange validate_functions() In preparation to adding a vmlinux.o specific pass, rearrange some code. No functional changes intended. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Miroslav Benes Acked-by: Josh Poimboeuf Link: https://lkml.kernel.org/r/20200324160924.924304616@infradead.org --- tools/objtool/check.c | 52 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 0c9c9ad..0bfcb39 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2395,9 +2395,8 @@ static bool ignore_unreachable_insn(struct instruction *insn) return false; } -static int validate_functions(struct objtool_file *file) +static int validate_section(struct objtool_file *file, struct section *sec) { - struct section *sec; struct symbol *func; struct instruction *insn; struct insn_state state; @@ -2410,36 +2409,45 @@ static int validate_functions(struct objtool_file *file) CFI_NUM_REGS * sizeof(struct cfi_reg)); state.stack_size = initial_func_cfi.cfa.offset; - for_each_sec(file, sec) { - list_for_each_entry(func, &sec->symbol_list, list) { - if (func->type != STT_FUNC) - continue; + list_for_each_entry(func, &sec->symbol_list, list) { + if (func->type != STT_FUNC) + continue; - if (!func->len) { - WARN("%s() is missing an ELF size annotation", - func->name); - warnings++; - } + if (!func->len) { + WARN("%s() is missing an ELF size annotation", + func->name); + warnings++; + } - if (func->pfunc != func || func->alias != func) - continue; + if (func->pfunc != func || func->alias != func) + continue; - insn = find_insn(file, sec, func->offset); - if (!insn || insn->ignore || insn->visited) - continue; + insn = find_insn(file, sec, func->offset); + if (!insn || insn->ignore || insn->visited) + continue; - state.uaccess = func->uaccess_safe; + state.uaccess = func->uaccess_safe; - ret = validate_branch(file, func, insn, state); - if (ret && backtrace) - BT_FUNC("<=== (func)", insn); - warnings += ret; - } + ret = validate_branch(file, func, insn, state); + if (ret && backtrace) + BT_FUNC("<=== (func)", insn); + warnings += ret; } return warnings; } +static int validate_functions(struct objtool_file *file) +{ + struct section *sec; + int warnings = 0; + + for_each_sec(file, sec) + warnings += validate_section(file, sec); + + return warnings; +} + static int validate_reachable_instructions(struct objtool_file *file) { struct instruction *insn;