Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp811656rwe; Wed, 31 Aug 2022 11:24:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR6jpnwkCA3OMrsVf6aSkDV9ZznqnZWGwuwr82fM3D951axVxFQqaeEAQjF0Z9PhCzfRU9MQ X-Received: by 2002:a17:907:1dd7:b0:73d:d0b6:8b3c with SMTP id og23-20020a1709071dd700b0073dd0b68b3cmr19648216ejc.135.1661970281898; Wed, 31 Aug 2022 11:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661970281; cv=none; d=google.com; s=arc-20160816; b=NePvFG3BUbhGeH+KwjJNSjtrw0Fzcq/m4BQ9xXx+SefGZSb94XlV/2C7TXsAJNMRBc SwziJ1Udox3n2BzTJpuMFzJVLKBUxU0hzPWs+diXklJG/MlxzCRhBS6nEosHEk5hk1dO wzGNPFmrdNSvbFT08K+LEGYhrPXKLLDMq91Rr5NnFw5FcFGk4bU8zI7958++nJb8wqnX lymwdqJXnPiSG7iQrwzC9Q2jZ4q35tgn3UXDnKAtbsmTBqEErizTsWAaUNtTdPGC3SXk upEJfG62MTOLo6uBTLEVlKkmMAHD01WiLgm67+pCBFgX8/LPL3JCCUkC+uw2gV6OfE99 B9Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ngKyNieAt9NBgaBOhM6rzds999K848UT6Z3DRytFhH4=; b=owEjU3Jt8woQBZVe325wQAWoisXaZPbilzszek+GW8+ogKgF9ew1tutpoKINc4Z5en JbzRyxBKD14s1QeFPiP/Y6rupY7ZYQw3o+1BCpZyENGbvDpzhxDQXGUAAGd3AXTQN5oY f+vvqSWbbA/2WGkaUyvGzJQmxaeEvvuHCt1t8wObp7WvCeKvcjxr1WKwhp6VthFYC2Qc 0uIKMoHZIc7cTVXdvq0XcrAK4TajxgGzc/70VSOLi6Xz13Ug/SxaHvk0U12rJReW99YW 2vyB9sRp6wT1Y5IHFiI6xmlLRcVyvOs1zZllSRAOiPJ2IjhvWT1Lh0cL4OkB9b6fxkRe ItbA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp27-20020a1709073e1b00b0073da8185a4esi13431818ejc.511.2022.08.31.11.24.16; Wed, 31 Aug 2022 11:24:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231440AbiHaR5n (ORCPT + 99 others); Wed, 31 Aug 2022 13:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231232AbiHaR5l (ORCPT ); Wed, 31 Aug 2022 13:57:41 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8CB26D740D for ; Wed, 31 Aug 2022 10:57:40 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 27VHp22H007556; Wed, 31 Aug 2022 12:51:02 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 27VHp1O9007550; Wed, 31 Aug 2022 12:51:01 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 31 Aug 2022 12:51:00 -0500 From: Segher Boessenkool To: Christophe Leroy Cc: Sathvika Vasireddy , "linuxppc-dev@lists.ozlabs.org" , "peterz@infradead.org" , "linux-kernel@vger.kernel.org" , "rostedt@goodmis.org" , "aik@ozlabs.ru" , "mingo@redhat.com" , "npiggin@gmail.com" , "jpoimboe@redhat.com" , "naveen.n.rao@linux.vnet.ibm.com" , "mbenes@suse.cz" , "chenzhongjin@huawei.com" Subject: Re: [PATCH v2 16/16] objtool/powerpc: Add --mcount specific implementation Message-ID: <20220831175100.GS25951@gate.crashing.org> References: <20220829055223.24767-1-sv@linux.ibm.com> <20220829055223.24767-17-sv@linux.ibm.com> <5da86617-53f1-d899-336a-53fe691e76ae@csgroup.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5da86617-53f1-d899-336a-53fe691e76ae@csgroup.eu> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 On Wed, Aug 31, 2022 at 12:50:07PM +0000, Christophe Leroy wrote: > Le 29/08/2022 ? 07:52, Sathvika Vasireddy a ?crit?: > > + opcode = insn >> 26; > > + > > + switch (opcode) { > > + case 18: /* bl */ > > case 18 is more than 'bl', it includes also 'b'. > In both cases, the calculation of *immediate is the same. It also is "ba" and "bla", sometimes written as "b[l][a]". > It would therefore be more correct to perform the calculation and setup > of *immediate outside the 'if ((insn & 3) == 1)', that would avoid > unnecessary churn the day we add support for branches without link. > > > + if ((insn & 3) == 1) { > > + *type = INSN_CALL; > > + *immediate = insn & 0x3fffffc; > > + if (*immediate & 0x2000000) > > + *immediate -= 0x4000000; > > + } > > + break; > > + } Does this handle AA=1 correctly at all? That is valid both with and without relocations, just like AA=0. Same for AA=1 LK=0 btw. If you only handle AA=0, the code should explicitly test for that. Segher