Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1646809ybt; Thu, 18 Jun 2020 13:47:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlb7oDZGS9/QPLmU4HzftDjcgxz57zLQ82yK9NC7sOXI9zLWdkvjYPSZ3ahlkSqUjAG/RS X-Received: by 2002:a17:906:1c93:: with SMTP id g19mr528110ejh.194.1592513238599; Thu, 18 Jun 2020 13:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592513238; cv=none; d=google.com; s=arc-20160816; b=ItpelN2Q8cc12I07+EQhWJht0Vd64ywt9soCU3NREE6aZBXaCJdKZhEKKfyTyLS7k6 b2ehP8YuzuZHo61HcNeHP0OCtsL2wt0TbvzwF4nLLdx8KnR7vdVE4hCDRkOOBs04DOmc MtlscH/Wp+EgHxq3J0tk+D9r6kYL+hyEwPK2JMzGTRaED6vhcNkfbCRtz933ioFO4k+q 8VzRMjaFVvJVxRgjAvMgz47a/Zb0b2lT9y9PAcc2cfM8So2X8g2c5Ok/6ragFWknR664 48rYf4G6E/jAE7LR6/4vUZW45Vg60ZhFlOKPr1FRMei99gw2JJKQM/9h4TvV+ybLEeXx GvaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=92fOJhOr/jBIgFlr6Ho3AJlzIWACEY/vEsldVHefU7o=; b=Tt9Eipj+87aFw3UHoHc7/4OQFEs89TWxHCelbKLtvg8x5NePBZo22wOLRzeMPerrx0 4/B3oJoC4B0xfUz492NORY6HI5s0JsNP8o9or4ozU0Ezg3s25hFZARX1n1PGtybKMW4M ld6tqtGPveKk1WL455DZia5x0xkWWDaxMdDBVAUjpl1YSOojI9KjgSU3cJL12VC4yF62 1sP3gYABkFRoxyjOOxh3LiHk3fknOjiFD/urmOIPD2fLpHHNmbTwCqbzqDvDMifrvpcv 3qDY9CiyU7ukv0gaIpCYujvptv+G3xT7q438xz6YjMHhLgkGvKYC7WBEhpEyjdqWPtZA FJMg== 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 r21si2415037ejx.647.2020.06.18.13.46.56; Thu, 18 Jun 2020 13:47:18 -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 S1731659AbgFRUjw (ORCPT + 99 others); Thu, 18 Jun 2020 16:39:52 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:48844 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731176AbgFRUjP (ORCPT ); Thu, 18 Jun 2020 16:39:15 -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, 18 Jun 2020 13:39:09 -0700 Received: from sc9-mailhost2.vmware.com (unknown [10.129.221.29]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 2A13FB2656; Thu, 18 Jun 2020 16:39:12 -0400 (EDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Steven Rostedt , Julien Thierry , Kamalesh Babulal , Matt Helsley Subject: [RFC][PATCH v5 17/51] objtool: mcount: Stop using ehdr in find_section_sym_index Date: Thu, 18 Jun 2020 13:38:03 -0700 Message-ID: <0a0a522dcbe7038109bd97571c965a2afba0123c.1592510545.git.mhelsley@vmware.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 We can use the objtool GElf_Ehdr structure to access ehdr here. This makes the function completely independent of the old recordmcount ELF wrapper. The next step will be to promote it to the C file. Signed-off-by: Matt Helsley --- tools/objtool/recordmcount.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h index 941f96e4f74b..cf420f9f64b0 100644 --- a/tools/objtool/recordmcount.h +++ b/tools/objtool/recordmcount.h @@ -225,7 +225,7 @@ static uint_t *sift_rel_mcount(uint_t *mlocp, Elf_Rel **const mrelpp, const struct section * const rels, unsigned const recsym_index, - uint_t const recval, + unsigned long const recval, unsigned const reltype) { uint_t *const mloc0 = mlocp; @@ -319,9 +319,8 @@ static int nop_mcount(struct section * const rels, */ static int find_section_sym_index(unsigned const txtndx, char const *const txtname, - uint_t *const recvalp, - unsigned int *sym_index, - Elf_Ehdr const *const ehdr) + unsigned long *const recvalp, + unsigned int *sym_index) { struct symbol *sym; struct section *txts = find_section_by_index(lf, txtndx); @@ -336,7 +335,7 @@ static int find_section_sym_index(unsigned const txtndx, /* avoid symbols with weak binding */ if ((sym->bind == STB_LOCAL) || (sym->bind == STB_GLOBAL)) { /* function symbols on ARM have quirks, avoid them */ - if (w2(ehdr->e_machine) == EM_ARM + if (lf->ehdr.e_machine == EM_ARM && sym->type == STT_FUNC) continue; @@ -424,12 +423,12 @@ static int do_func(Elf_Ehdr *const ehdr, txtname = has_rel_mcount(sec); if (txtname && is_mcounted_section_name(txtname)) { + unsigned long recval = 0; unsigned int recsym; - uint_t recval = 0; symsec_sh_link = sec->sh.sh_link; result = find_section_sym_index(sec->sh.sh_info, - txtname, &recval, &recsym, ehdr); + txtname, &recval, &recsym); if (result) goto out; -- 2.20.1