From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 708A5C43462 for ; Thu, 1 Apr 2021 18:43:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25FF261041 for ; Thu, 1 Apr 2021 18:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236394AbhDASnY (ORCPT ); Thu, 1 Apr 2021 14:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235293AbhDASVG (ORCPT ); Thu, 1 Apr 2021 14:21:06 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAD9CC00F7E0; Thu, 1 Apr 2021 08:09:00 -0700 (PDT) Date: Thu, 01 Apr 2021 15:08:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1617289738; 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=QOevEyW1EXdcT3e3X1S7oHVITdqRVDZCgtzrQZ4YR+M=; b=BVHxFGBTqqpdqzVHhyVEe/w+f+XCDcSIOCXY4W8o/Osl2JSELv4d/sOGdgWNkEdRWsAOco zipmcJNxhYQFGzAx3iTKAyX9+M6RBBG+h6ZIEKD8rXMC6BvhA/zYtQuxs7j9yOv3Vru9ZV w1JybiaMKUtbGt3edSNhm7AkKD0tHWaG68tST7dumoeCGQ9fJP9egvuAdGEC4jaIssttRZ IQzMrGSEKc8cMZaEMGWwXIKiWtatd6DY/oSccMD7IjJXbenEc8gWAGYGxXn/tRiybzD6mp 5I+TkuREDzjdNhBsQ2zfQuwNwz4cmI9LvhhLajxOuVvysUnFyt4jc35uMAC6BA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1617289738; 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=QOevEyW1EXdcT3e3X1S7oHVITdqRVDZCgtzrQZ4YR+M=; b=lhZFyVbSk3B8Oy0RGPgXsU6whDYd50J681GBasuIR2a9K0pu1euhFJaNzz99ZHlpwejSc8 Pc1bX9R3DxBoQ7BQ== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] objtool: Fix static_call list generation Cc: "Peter Zijlstra (Intel)" , Borislav Petkov , Miroslav Benes , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210326151259.691529901@infradead.org> References: <20210326151259.691529901@infradead.org> MIME-Version: 1.0 Message-ID: <161728973737.29796.8108336872337258798.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/core branch of tip: Commit-ID: b62b63571e4be0ce31984ce83b04853f2cba678b Gitweb: https://git.kernel.org/tip/b62b63571e4be0ce31984ce83b04853f2cba678b Author: Peter Zijlstra AuthorDate: Fri, 26 Mar 2021 16:12:05 +01:00 Committer: Borislav Petkov CommitterDate: Thu, 01 Apr 2021 11:43:16 +02:00 objtool: Fix static_call list generation Currently, objtool generates tail call entries in add_jump_destination() but waits until validate_branch() to generate the regular call entries. Move these to add_call_destination() for consistency. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Borislav Petkov Reviewed-by: Miroslav Benes Link: https://lkml.kernel.org/r/20210326151259.691529901@infradead.org --- tools/objtool/check.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 6fbc001..8618d03 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1045,6 +1045,11 @@ static int add_call_destinations(struct objtool_file *file) } else insn->call_dest = reloc->sym; + if (insn->call_dest && insn->call_dest->static_call_tramp) { + list_add_tail(&insn->static_call_node, + &file->static_call_list); + } + /* * Many compilers cannot disable KCOV with a function attribute * so they need a little help, NOP out any KCOV calls from noinstr @@ -1788,6 +1793,9 @@ static int decode_sections(struct objtool_file *file) if (ret) return ret; + /* + * Must be before add_{jump_call}_destination. + */ ret = read_static_call_tramps(file); if (ret) return ret; @@ -1800,6 +1808,10 @@ static int decode_sections(struct objtool_file *file) if (ret) return ret; + /* + * Must be before add_call_destination(); it changes INSN_CALL to + * INSN_JUMP. + */ ret = read_intra_function_calls(file); if (ret) return ret; @@ -2762,11 +2774,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, if (dead_end_function(file, insn->call_dest)) return 0; - if (insn->type == INSN_CALL && insn->call_dest->static_call_tramp) { - list_add_tail(&insn->static_call_node, - &file->static_call_list); - } - break; case INSN_JUMP_CONDITIONAL: