Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1640394ybk; Thu, 14 May 2020 14:11:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiQzuTCn4BfC12sOtxW9IN1zfPoTtXxQsYg9ODHrg0sA5EEdaGmBv6bZcUWSIQPJVut5BE X-Received: by 2002:a17:906:82d9:: with SMTP id a25mr1857187ejy.43.1589490701057; Thu, 14 May 2020 14:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589490701; cv=none; d=google.com; s=arc-20160816; b=bHt79iNToytaEe7wR5NUmeaxDnpQoQA7P7ch2qaGYfThnwRzlxWxCrrbsinHEKAsf4 Efrrru9D38uXWZ7O6RqsZJbkN5gck0xk344eL+f4T8Wa8Yx2C8o3d3QpTwfaRu/TBqAB BI+0yeFFh0mMRaE8mwHaP6MrxLoWTvHzC78W6umINMv4cP5HkL0C6t+qvLu3nngtmj47 fdUcu5vfCvT8mVUPzd6Ut71JzZ9jghfecvMBKcx8DTkhKHHIRcgKiJF3ijK6Sjs7IrGK mr08hn9c/dhxF1iS+/C/ck/OLBkgEMXkjdouUuknAKgHhuVc2HxPw9wFXqyYAZyg4r3P K5tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date; bh=mgHk8dMAXrM6zNOZ7tV/LKIs9/rSm80MibEzvT5iQcc=; b=ZMPl+MjTLhaZlQvVYajrNFNOU1UXpPhGQxvMRAo3vNCtfECPfFJwE7z5cGZ8dFKoWI BDkh2Iv+LK5Ow+NopLxxKhi7gQnvV1IjQshoRZd1DG2CB1ZhdCegOb7rDSUFACUast1N Sf9vucJrq3uJd4Rsjur+Jy3WfLKqZfUsECU07T9goEXc+vnKLKMWT1+joOVIjnJrKOIT k1+EQicUIysmBD4/an2GhJAv020+/B9mQizsODHAktOe9/K6E91ECETslooCmNq9eZHp c79sMVA+WjeBG2TBuxyRwsDu3nM/arFLyobP1vor2or2Nzytl/rO76ZEo/eiW6Jum9Hh S4Ww== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si2026797edl.169.2020.05.14.14.11.17; Thu, 14 May 2020 14:11:41 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727122AbgENVJu (ORCPT + 99 others); Thu, 14 May 2020 17:09:50 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:44741 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgENVJo (ORCPT ); Thu, 14 May 2020 17:09:44 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Thu, 14 May 2020 14:09:39 -0700 Received: from localhost (unknown [10.200.192.41]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 3BC9EB23CF; Thu, 14 May 2020 17:09:43 -0400 (EDT) Date: Thu, 14 May 2020 14:09:42 -0700 From: Matt Helsley To: Julien Thierry CC: , Josh Poimboeuf , Peter Zijlstra , Miroslav Benes , Steven Rostedt Subject: Re: [RFC][PATCH 3/5] objtool: Add support for relocations without addends Message-ID: <20200514210942.GK9040@rlwimi.vmware.com> Mail-Followup-To: Matt Helsley , Julien Thierry , linux-kernel@vger.kernel.org, Josh Poimboeuf , Peter Zijlstra , Miroslav Benes , Steven Rostedt References: <17ee3f6f2a246008aaae70f92df24ae92fa0e21e.1588888003.git.mhelsley@vmware.com> <20200513162648.GJ9040@rlwimi.vmware.com> <61c35ce2-47b3-1f62-d4ec-da9984289c5d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <61c35ce2-47b3-1f62-d4ec-da9984289c5d@redhat.com> Received-SPF: None (EX13-EDG-OU-002.vmware.com: mhelsley@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 13, 2020 at 05:55:21PM +0100, Julien Thierry wrote: > > > On 5/13/20 5:26 PM, Matt Helsley wrote: > > On Tue, May 12, 2020 at 06:04:50PM +0100, Julien Thierry wrote: > > > Hi Matt, > > > > > > On 5/11/20 6:35 PM, Matt Helsley wrote: > > > > Currently objtool only collects information about relocations with > > > > addends. In recordmcount, which we are about to merge into objtool, > > > > some supported architectures do not use rela relocations. Since > > > > object files use one or the other the list can be reused. > > > > > > > > Signed-off-by: Matt Helsley > > > > --- > > > > tools/objtool/elf.c | 55 ++++++++++++++++++++++++++++++++++++--------- > > > > tools/objtool/elf.h | 5 ++++- > > I'm thinking it's simpler with fewer variables. I don't think > > moving the cast into the switch cases makes it any clearer. It's also > > odd because we'll keep re-initializing relas or rels to rel_buf each loop > > iteration. Finally, this approach has the advantage that, when reviewing > > the patch, it's clear that the original code handling RELA relocation entries > > isn't changing -- you can see it's just shifting into one of the cases > > (below). > > > > Do you still prefer introducing rel_buf? > > On a completely personal taste, yes. I do not like having two local > variables in the same scope pointing at the same data but with an implied > "you should only use one or the other under the right circumstances". > > But my main concern was having an allocation of a certain size and then > modifying the size (might have been valid if sizeof(GElf_Rel) <= > sizeof(GElf_Rela), but I must admit I did not bother to check). Since you've > addressed that issue, the rest is just a matter of taste so better left to > the maintainers. OK. As a sort of tie-breaker I tried to quickly find an analogous piece of code in objtool which I could use as a guide on maintainer preference. The only place I see void pointers being used is as keys for comparison functions. So my guess and preference is to not use a void pointer here. Cheers, -Matt Helsley