Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1646514ybt; Thu, 18 Jun 2020 13:46:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDGJcnIWZUGjMJMjw9+hGOVowwJb6dx1O/iWuPbkBrZxLtRdCmSu76yv5FTKDtjmxCuk2Y X-Received: by 2002:a17:906:e4b:: with SMTP id q11mr519065eji.302.1592513212971; Thu, 18 Jun 2020 13:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592513212; cv=none; d=google.com; s=arc-20160816; b=g/sTj55hgYaTeU6KYkKuqi5qR8UsY7YT1dGLB2QUS+Qg1YG41eCHGyNK90PS4IpK7t zG5vxeD+m3JZPOmja1kbW07DEphlbJ/JZtWqs7HnLFjpzl3qai78scbW+u1iN1gTGT4c qCRHIpFQ2S+h5Vnr9DPOMrA93VuX8LKo1QDTBfD8fti2SVyqgZJhLZw/uhaayG+CXyKw 8L5cNwRAyiMWHHUyCNNRx9gOTRXTgAPCkhNhk30653E3MjKhH8ejXmWKHCRp9dw1MECC Q4N1PU0TKnnLv206kK7mvj+F39IgTD0sp5tz9ej4v8J3wX9NO82LrCy1+EJuZ6TG9atF o5Vw== 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=31adl+VgPOAtz5varJxPzhpn6gBtIacxDbCbFioSJ0s=; b=vBf6oIuKaCsg8SVTiPJVei8Zj35QnTWOl6GPMxVoYtDh5VTmenntJXZJ1HWFMWJFH7 DpikTkghhEGU1WIE8HYjZiQJLqmXRQ4ya8nd1x5J+TDp2VUsFERZ17y29O1hQo+r6u06 lNEcQdZqaV8cuLWVeKFBS4/B+g4bqdzBwndHEYwrtKaZ6qRW9VfXV9f52TlHroSGlu/m 4qA1Nem4nAB+isoJqBjCdATJGMXnnPeu+p9Ff/MR4auyKmTnA6pS6SjY2oJ7McYvr0wP TP8FxdOFWfpVvrduZyqMtGoWcvl87Rumpiy8FL1WM/OcsjLL2Ezwow/8acleEeZ8kZ0d /52w== 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 r18si2555264eja.41.2020.06.18.13.46.30; Thu, 18 Jun 2020 13:46:52 -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 S1731568AbgFRUjs (ORCPT + 99 others); Thu, 18 Jun 2020 16:39:48 -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 S1731153AbgFRUjN (ORCPT ); Thu, 18 Jun 2020 16:39:13 -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:06 -0700 Received: from sc9-mailhost2.vmware.com (unknown [10.129.221.29]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id BEF8AB2656; Thu, 18 Jun 2020 16:39:09 -0400 (EDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Steven Rostedt , Julien Thierry , Kamalesh Babulal , Matt Helsley Subject: [RFC][PATCH v5 14/51] objtool: mcount: Move get_mcountsym Date: Thu, 18 Jun 2020 13:38:00 -0700 Message-ID: <8c3b95adbd58e26c7b09e4d0c7e59acb25b69054.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 Now that it's been stripped of using the old recordmcount ELF wrapper get_mcountsym() is ready to be promoted out of the double-included wrapper header. Signed-off-by: Matt Helsley --- tools/objtool/recordmcount.c | 16 ++++++++++++++++ tools/objtool/recordmcount.h | 19 ------------------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/tools/objtool/recordmcount.c b/tools/objtool/recordmcount.c index dafa6dd10d04..d5f7c06afd57 100644 --- a/tools/objtool/recordmcount.c +++ b/tools/objtool/recordmcount.c @@ -422,6 +422,22 @@ static int is_mcounted_section_name(char const *const txtname) strcmp(".cpuidle.text", txtname) == 0; } +static struct symbol *get_mcountsym(struct reloc *reloc) +{ + struct symbol *sym = reloc->sym; + char const *symname = sym->name; + char const *mcount = gpfx == '_' ? "_mcount" : "mcount"; + char const *fentry = "__fentry__"; + + if (symname[0] == '.') + ++symname; /* ppc64 hack */ + if (strcmp(mcount, symname) == 0 || + (altmcount && strcmp(altmcount, symname) == 0) || + (strcmp(fentry, symname) == 0)) + return sym; + return NULL; +} + static const unsigned int missing_sym = (unsigned int)-1; /* 32 bit and 64 bit are very similar */ diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h index 6ac120aa45af..210899819261 100644 --- a/tools/objtool/recordmcount.h +++ b/tools/objtool/recordmcount.h @@ -27,7 +27,6 @@ #undef find_section_sym_index #undef has_rel_mcount #undef tot_relsize -#undef get_mcountsym #undef get_shnum #undef set_shnum #undef get_shstrndx @@ -56,7 +55,6 @@ # define set_shnum set_shnum64 # define get_shstrndx get_shstrndx64 # define do_func do64 -# define get_mcountsym get_mcountsym_64 # define is_fake_mcount is_fake_mcount64 # define fn_is_fake_mcount fn_is_fake_mcount64 # define MIPS_is_fake_mcount MIPS64_is_fake_mcount @@ -84,7 +82,6 @@ # define set_shnum set_shnum32 # define get_shstrndx get_shstrndx32 # define do_func do32 -# define get_mcountsym get_mcountsym_32 # define is_fake_mcount is_fake_mcount32 # define fn_is_fake_mcount fn_is_fake_mcount32 # define MIPS_is_fake_mcount MIPS32_is_fake_mcount @@ -271,22 +268,6 @@ static int append_func(Elf_Ehdr *const ehdr, return elf_write(lf); } -static struct symbol *get_mcountsym(struct reloc *reloc) -{ - struct symbol *sym = reloc->sym; - char const *symname = sym->name; - char const *mcount = gpfx == '_' ? "_mcount" : "mcount"; - char const *fentry = "__fentry__"; - - if (symname[0] == '.') - ++symname; /* ppc64 hack */ - if (strcmp(mcount, symname) == 0 || - (altmcount && strcmp(altmcount, symname) == 0) || - (strcmp(fentry, symname) == 0)) - return sym; - return NULL; -} - /* * Look at the relocations in order to find the calls to mcount. * Accumulate the section offsets that are found, and their relocation info, -- 2.20.1