Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1543147ybg; Tue, 2 Jun 2020 12:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhqYq9bW11EyMwdkMNXcrpvpt0c9ISm1HXr2EpNKNqaDzZ7z0LCbSV0KQ3ghFohv0l5Osb X-Received: by 2002:a17:906:1cc6:: with SMTP id i6mr24115780ejh.552.1591127649799; Tue, 02 Jun 2020 12:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591127649; cv=none; d=google.com; s=arc-20160816; b=j03NRIQxIEVY4bX257i3efzUoPJs5LK66AhlHTJyYSkBgDm6SHqFgIPTRYMShHa0FQ eT5imGrhBHts45LI28L2X03Mj5Sa3nutXLJE12fQ/SbCN04Ao7jCy2oorrDWZ40A/34b zxfNebAtS1Ola48t0EjTt5jETJFwDQwS/V8XO6KOeFvt/b06BixZrk9udYu1E87Xfevz yKjecxlzem3ODvsmt0CTs5vFQZXq/8rWlKKWTPKQTVLIAsYDh39q7C1agvW7MXARPYOZ K9ZtjGfpEegnKXt+DOEmY4FSh6iunCe2TZx1rK75IBCxI/sEVv3HD6+7hofXNfUuIyPn AqnA== 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=+AzpCgrpHTKbp8TSnC6WG3uEgUhaZxI0nPV4Vip+DuI=; b=psIX4UKLWBEzyJETZwjffnDXdEKeoTGknFJiejpKm6b34+hRPF2hNbIpbpdQriXlC8 HkMbqPdnBLhkeCWqC/NDsa3Q03u2wCzCQ+2yC2HBZMUThAc3PJpn1/EHQFB3t65QYUHJ p5cY0cEceWXz/yl2MzK36XnE63wQkhhLgWQr5VH7Sh5t9FnMn68tTfUJoLL6ZMlB4aeH oPSPxJAP1bTIcQ86Hh92zJYWJsWgtG/y0mdn5SansedR5Bp2P/tuvrTTcmwcrfXI0Nt9 4LXlzsPx/HaqGrpXRMy/q8khhBX1OI3NTAKUV/QoJQtF1Ve9U+25OWut/XcZGBL6no9n NGFg== 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 cf23si1937457ejb.540.2020.06.02.12.53.46; Tue, 02 Jun 2020 12:54:09 -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 S1728441AbgFBTvM (ORCPT + 99 others); Tue, 2 Jun 2020 15:51:12 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:36862 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728341AbgFBTvB (ORCPT ); Tue, 2 Jun 2020 15:51:01 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Tue, 2 Jun 2020 12:50:57 -0700 Received: from sc9-mailhost3.vmware.com (unknown [10.200.192.49]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 8035940BF1; Tue, 2 Jun 2020 12:50:57 -0700 (PDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Steven Rostedt , Sami Tolvanen , Julien Thierry , Kamalesh Babulal , Matt Helsley Subject: [RFC][PATCH v4 14/32] objtool: mcount: Stop using ehdr in find_section_sym_index Date: Tue, 2 Jun 2020 12:50:07 -0700 Message-ID: X-Mailer: git-send-email 2.25.1 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 65386938693b..c7ce6345089d 100644 --- a/tools/objtool/recordmcount.h +++ b/tools/objtool/recordmcount.h @@ -188,7 +188,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; @@ -282,9 +282,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); @@ -298,7 +297,7 @@ static int find_section_sym_index(unsigned const txtndx, list_for_each_entry(sym, &txts->symbol_list, list) { 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; @@ -387,12 +386,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