Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp471270ybg; Fri, 12 Jun 2020 06:29:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrNtZG2+d22nWAzvqXFPYhvg5s3LMnmJYeD0eSE3C/Yb3k9bwziwPjK0b0tVDM909Bj9IS X-Received: by 2002:a17:907:94c4:: with SMTP id dn4mr687504ejc.150.1591968580167; Fri, 12 Jun 2020 06:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591968580; cv=none; d=google.com; s=arc-20160816; b=S1T1q8dFqi/kwsF6iskML0evjAOCkRvwe4unyxeTkd7e7JXXWdcgq9ckVGoaFUaPHm GbHNIJQjmJ4c7NbfkxcpzCEB7Dad6L2septO8YZrjHDe502fl3/wI1d2D9RDv+NLqZkb fwJzDSjAmL1Dbaoehr1Igqc5jyRJXEoehkRK2553e0ti6FrfKAFdwRLXkiKfZP6eRVJY 38E76mFJuG8hT6qzSp7rs8lS+A28p/7bYGeDS1cVyWe/sQjeQL7iep3CZ8BI6j5U2qGz mKKHdX//LmhKoPJztQePWM3Q7AgrzlijqVweZosJphkePXEIgbCkFk8KQ3RjbxL9f0VQ 4Yug== 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:message-id:subject:cc:to:from:date :dkim-signature; bh=bUBhyKW0TgX82+vyX9VE1I4aaadgLyRSmyDZenRqXG4=; b=XYJ7kq9kPCl20NtufRmf0pxNm8QBtkRQEHIDDKMMqFLs0EJjNc47deSZx9TANLc8Ch wjpIs15o2Qjyo/cGns4PlhWkUTftrX03UlFg3y5Q3J4IxEuTPHrFguMx3dKGurXqRxr9 EGcOGQ6gXCTIXZ/nEAFO2iAqOtoFuqz7TzKvbUsQUt2HDW0T1tyHVzCcd7PdTbKjxyj/ /XgeCKdayie9pE/pj4ZTvpVEQaIHOAOFUzYpk8W5qTu5SswAGcxP23ZejVpukzmjnK+B Q4rkF/PFnSHMEnAYadhiN+4D3gBwkQSoxIP0YOzAq6VtBG6QwUFQKpmgQKCV5aHni0g5 zy4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=c9DqVWlN; 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 vr3si3789405ejb.520.2020.06.12.06.29.15; Fri, 12 Jun 2020 06:29:40 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=c9DqVWlN; 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 S1726253AbgFLN13 (ORCPT + 99 others); Fri, 12 Jun 2020 09:27:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbgFLN13 (ORCPT ); Fri, 12 Jun 2020 09:27:29 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A94DEC03E96F for ; Fri, 12 Jun 2020 06:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; 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=bUBhyKW0TgX82+vyX9VE1I4aaadgLyRSmyDZenRqXG4=; b=c9DqVWlN9XHVVXEGOPovDQpEAe FYb5pHmRpeQaPFN2e17zDrouGAyCOps/JJCFeuSE1E4LM5kC5z24NCXifxCzDePkAvYcCflUEGo+F ZHNsKbuDoQr9plCsjAHNLwUek+T3+IP8W3OGXiubYA5G4NZSOqgk58njAjzqKSiPdzTp6hRmlvfCk YKIXcM2RNPvWB+w8ehyyoGW6Xsb2tVCAeC6yOGKXWumLxlc0iAknvGpSpVoETQBfCgqgVQl0WXgWv Vc/Lfbs/tHKJg+RwyvKNG0Fv1cBMvTPN7L5iVvSq+gK02JW3m/YJjBxYDjh5+I8D59aaCQxdscBm+ 1GJyfn0w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjji0-0004F4-D1; Fri, 12 Jun 2020 13:27:00 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 494533003E7; Fri, 12 Jun 2020 15:26:57 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 07DD82BE34E29; Fri, 12 Jun 2020 15:26:57 +0200 (CEST) Date: Fri, 12 Jun 2020 15:26:56 +0200 From: Peter Zijlstra To: Matt Helsley Cc: linux-kernel@vger.kernel.org, Josh Poimboeuf , Steven Rostedt , Sami Tolvanen , Julien Thierry , Kamalesh Babulal Subject: Re: [RFC][PATCH v4 18/32] objtool: mcount: Move nop_mcount() Message-ID: <20200612132656.GQ2531@hirez.programming.kicks-ass.net> References: <7109ceb239a88c2901eeb7f52c29f69cdb413cd3.1591125127.git.mhelsley@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7109ceb239a88c2901eeb7f52c29f69cdb413cd3.1591125127.git.mhelsley@vmware.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 02, 2020 at 12:50:11PM -0700, Matt Helsley wrote: > +static int nop_mcount(struct section * const rels, > + const char *const txtname) > +{ > + struct reloc *reloc; > + struct section *txts = find_section_by_index(lf, rels->sh.sh_info); > + unsigned mcountsym = 0; > + int once = 0; > + > + list_for_each_entry(reloc, &rels->reloc_list, list) { > + int ret = -1; > + > + if (!mcountsym) > + mcountsym = get_mcountsym(reloc); > + > + if (mcountsym == GELF_R_INFO(reloc->sym->idx, reloc->type) && !is_fake_mcount(reloc)) { This makes no sense to me; why not have mcountsym be a 'struct symbol *' and have get_mcountsym() return one of those. if (reloc->sym == mcountsym && ... ) is much nicer, no? > + if (make_nop) { > + ret = make_nop(txts, reloc->offset); > + if (ret < 0) > + return -1; > + } > + if (warn_on_notrace_sect && !once) { > + printf("Section %s has mcount callers being ignored\n", > + txtname); > + once = 1; > + /* just warn? */ > + if (!make_nop) > + return 0; > + } > + } > + > + /* > + * If we successfully removed the mcount, mark the relocation > + * as a nop (don't do anything with it). > + */ > + if (!ret) { > + reloc->type = rel_type_nop; > + rels->changed = true; I have an elf_write_rela(), I'll make sure to Cc you. > + } > + } > + return 0; > +}