Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp910964ybb; Fri, 10 Apr 2020 12:39:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLOHXjQbAg0CnpeIFFKS5Mulyfk6Xr1sbMK9e5fP4SAV81xMof/cJWeukPB8LggN5QZm2CK X-Received: by 2002:ac8:1bbd:: with SMTP id z58mr782414qtj.94.1586547572714; Fri, 10 Apr 2020 12:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586547572; cv=none; d=google.com; s=arc-20160816; b=hSeoZLWnXmrUo9o66U1abkrK4/5/6Xof5Y/iIhm2nzuFqrOVMa4w2ucr8s+vwNEpDm mIaqTx1sqAgPndBl8gc68H55pPhW7M7yVifI3QJR4Yh5QMwYxzpmO8+biB+Yw3w5WXsc vajWa3AnVwJsHVHST/VYC8e5CB2adRKYJNHRsM77TjRM+Ef1d7TNAj4MC61p94kZ4SBd CfnT7ySS+SDEdW30OkPeFXz3AOWH0gqsnZxvHT8GmbPkukLeigh4hWWlM6ZOqgiq00uc 6Ui2RI3FQa4lsd5Tii0m05ecyZ7i5zqn2ZCOAUFdpWwtxCm4q+a0R0OK+JzTXKh1EXJc MX1Q== 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=YLDdW88LESlRM1QZZOehIZ1WoS9QFo7JlUr4DFoSic8=; b=YLd2Ha1LCe2O7DZFsKLcHC1zSBYZaA+nG/DmoL894GC6f8jIGQMGM74jiWoBsVYYqh VGfrStqROIZUQa+dEuWffuqbE9stTfc7Mhj539tC6uzn1wuS3yVyGaP4UStBB6XgU9FP Isr66lYVoqnePoDhNn2qMmGbwEq2qQ4uDUsXoulPG6cs9FstQXKDk4I58wPB7dEmJlQ2 X6iUBqttpa97fSuxBcPVGAhwggw8Cu/RATbq+cdNHvkcTPlokQzO9/EOw3L6a8GGLp0/ GBmS7/0JBuEUAXD1bG8xEii8qJkNRK8PYLgkGMR2fTQPzwL3C1TwBWFuEDEFRl4sG2Xs BxJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y16si16239qtb.182.2020.04.10.12.39.17; Fri, 10 Apr 2020 12:39:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726995AbgDJTiA (ORCPT + 99 others); Fri, 10 Apr 2020 15:38:00 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:36216 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbgDJTiA (ORCPT ); Fri, 10 Apr 2020 15:38:00 -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; Fri, 10 Apr 2020 12:37:55 -0700 Received: from sc9-mailhost3.vmware.com (unknown [10.166.69.226]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 5BA62B2C87; Fri, 10 Apr 2020 15:37:59 -0400 (EDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Julien Thierry , Ingo Molnar , Steven Rostedt , Miroslav Benes , Matt Helsley Subject: [RFC][PATCH 19/36] objtool: mcount: Stop using ehdr in find_section_sym_index Date: Fri, 10 Apr 2020 12:35:42 -0700 Message-ID: <985196946be640697625c93a5744e66ca10b6493.1586468801.git.mhelsley@vmware.com> 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 d61892597731..066923dd70a9 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