Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp672152pxj; Thu, 13 May 2021 14:11:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdnPzyM7BBpb+ykPYxMZqub5Eg/vJKnX9ANnS4wEQSetaH4CUoDWU1bga1A+fTLQTHuK9A X-Received: by 2002:aa7:cfcd:: with SMTP id r13mr9617669edy.177.1620940311640; Thu, 13 May 2021 14:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620940311; cv=none; d=google.com; s=arc-20160816; b=KJOqSugO6wxQe0EEbwp8MLjx+2GeKLVRAO5oq6kmGNHKcb3vIkxWASLXhzmunXnz6O /of20LB64a7Rq9voGid5Hkjj3TI63XJe5rgL+Bb2glrUuJTcT6Kk9jUXCS92XzryTt4t FMHJbwF8+2CoGJKiv5B/Tqcj12a6wD+On5r8hndZCr5r8h/pVl8oIP3tE3hX/xgQE+CV HdQ3kHLy2/l2pz/WiUBdQuYRNX8KXobHXnPv55lojf0C5iPwxFzuJRRfDxINXqqgnVKr kLxhrrr3rmttydLl2o2lcsM/otNoVnzgzgmxwbcYv6m+pDTnfZ/QhV6ZjJTxHKJ1b1V9 8fTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rTB7oxQoS0DrRl/ZYlxeafz727DK0Z6Wo0bqAAR9t6s=; b=CK6UF5axPgI/vsjXVZn1kHkljgq4zbNi4c71Q6iH+OajWvlESr32A3EPEOCeWvlwPr bGPBgSvJ2nY/T6BGxd4uRgw5u1W6ymi5Uelan8w5K5AeokYuTqg2JzVriBqfAMNLCjlP Hi/Y6RyLSb6mQ6bdvrc8iUWgGPUzwoUyM9ZxbI8aW9dwNb4C3Qv9vxccMG/8KT6ugpov 1DtfynnQPU9VR9G1UmhI7GRltVlKLyIbCmTMEKhzXRbZ6WS9WB7s/suHmwHQ7npoWVB4 jHe3Xqd0xZU2FMzQiBbv2rOVlNjEws9Td47HGL9Ls1ZnPmrhP2zk8nDmQZb/E9mahC5J +nlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=hUKv17D7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si4351457ejv.315.2021.05.13.14.11.27; Thu, 13 May 2021 14:11:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=hUKv17D7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234374AbhEMORT (ORCPT + 99 others); Thu, 13 May 2021 10:17:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234351AbhEMORP (ORCPT ); Thu, 13 May 2021 10:17:15 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CEBC061574 for ; Thu, 13 May 2021 07:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rTB7oxQoS0DrRl/ZYlxeafz727DK0Z6Wo0bqAAR9t6s=; b=hUKv17D7lFDkiXWfPPWQQcB+w5 gQUwyeD7E23MBtHyCCV+7gUHM/19Q7iu0bfGdzK0HaWmSX1CYM3q2zt1uuAU69FGykVPdkOhrP/Jd ELfL8thOKMqRoSgCwf2dVCfSC5Tni/GJXZ4SIAxtxMYu3kEZGgFQQK6tEQxzB39DMKvqaAsUynxAi y1847jOFWsD3GOnDv4K3kHvYY/ncHkF6gkbh6GtNgkFvRjdlp0rUhUCPMHtZH6oz6qcA1Q3vSaIlH 299IPCOz+r+w/Qswz+9Z68iUcGsEUqhmQIy9dICsLkT6GjGQfEg3/wSuGA1cq9h5N0iNs8KupNZuj +jRP0Dow==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lhC7z-005iFb-JT; Thu, 13 May 2021 14:15:52 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D43FA3001E1; Thu, 13 May 2021 16:15:50 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B1E652D3CBAF5; Thu, 13 May 2021 16:15:50 +0200 (CEST) Date: Thu, 13 May 2021 16:15:50 +0200 From: Peter Zijlstra To: x86@kernel.org, jpoimboe@redhat.com, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 12.5/13] objtool: Reflow handle_jump_alt() Message-ID: References: <20210506193352.719596001@infradead.org> <20210506194158.153101906@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210506194158.153101906@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Subject: objtool: Reflow handle_jump_alt() From: Peter Zijlstra Date: Thu May 13 13:52:46 CEST 2021 Miroslav figured the code flow in handle_jump_alt() was sub-optimal with that goto. Reflow the code to make it clearer. Reported-by: Miroslav Benes Signed-off-by: Peter Zijlstra (Intel) --- tools/objtool/check.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1225,17 +1225,9 @@ static int handle_jump_alt(struct objtoo struct instruction *orig_insn, struct instruction **new_insn) { - if (orig_insn->type == INSN_NOP) { -do_nop: - if (orig_insn->len == 2) - file->jl_nop_short++; - else - file->jl_nop_long++; + if (orig_insn->type != INSN_JUMP_UNCONDITIONAL && + orig_insn->type != INSN_NOP) { - return 0; - } - - if (orig_insn->type != INSN_JUMP_UNCONDITIONAL) { WARN_FUNC("unsupported instruction at jump label", orig_insn->sec, orig_insn->offset); return -1; @@ -1252,7 +1244,15 @@ static int handle_jump_alt(struct objtoo orig_insn->offset, orig_insn->len, arch_nop_insn(orig_insn->len)); orig_insn->type = INSN_NOP; - goto do_nop; + } + + if (orig_insn->type == INSN_NOP) { + if (orig_insn->len == 2) + file->jl_nop_short++; + else + file->jl_nop_long++; + + return 0; } if (orig_insn->len == 2)