Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1544214ybg; Tue, 2 Jun 2020 12:56:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvDSgXy33XtxdRmIY+yjFl/MP1RjiTLs1rNUnLYcwpqGnDpedu0KLvzidh4NwNkoUwIsLW X-Received: by 2002:a50:eb0a:: with SMTP id y10mr28188744edp.312.1591127762370; Tue, 02 Jun 2020 12:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591127762; cv=none; d=google.com; s=arc-20160816; b=nN0YQ8H4pSI3gQ26Rzq8uDgKCC15SY7eIYxcrp9viAnVCJLFnnjSPF2wVFUOet4jkM HCYaZaefFyjnd0gcppfAwJzR/VhvMgsXTxaMatwrPNUZUkPcVzplT0L5G2aqNOahmpAM xUqWm7kP+3hZwgiL4iEuhHzNDQdbqMmOTAxXL81G92CE2OZUFtPk+xoVWUxqd2E21R6n Dvah/3OesiO02c41O2ZS1+KGiKun4P5uLd6mD5vtggmT5T8rC3DrsxkMXUFaWXxtgcZE mJX9YYL/SNu0PeV6PbNF0jM9N9PbTrDIwvahB7Xa39HCQHXUv+fH14iFIfWMHMVAknUw Wwvw== 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=uk+wQX2rFA/0cnINQQtYFBrqI2EinR8QIA8yjjrEI5k=; b=l4lAH5QCk4Kao11PjoNwm49NPRV8I7H8c7hO2p2JJ8igDLX29cLJY+OlcSelz7+XjE 7gBK5MNNpnZkXzOS6EoIiwjCm2uZy1dT4+7B6vX15NmrxK0GfXUAXTCgqGYoIyxII8+l 36b00U2RmsFaLSH/jdXtXJo8p5IjtOeofbVMT4Y7gEBi3QhpMvAPU/o85cbzESDUqxpR DuNhEGrwvHzXQjPrYjj4XnBGiHRsiRChw8WbAYckX/qa4Y7sWSWTWMJAKQYwC3xn2gW7 H91k6GG4iZzhrKaCNCs7fho98PXdhGTqPGvM4xJ8l4QHUSSbj3tRjcTDYsi1HweoKqnN bETQ== 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 a3si2039413edq.543.2020.06.02.12.55.39; Tue, 02 Jun 2020 12:56:02 -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 S1728420AbgFBTvJ (ORCPT + 99 others); Tue, 2 Jun 2020 15:51:09 -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 S1728321AbgFBTvA (ORCPT ); Tue, 2 Jun 2020 15:51:00 -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:54 -0700 Received: from sc9-mailhost3.vmware.com (unknown [10.200.192.49]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 2A12F40C1B; Tue, 2 Jun 2020 12:50:55 -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 11/32] objtool: mcount: Move get_mcountsym Date: Tue, 2 Jun 2020 12:50:04 -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 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..f72d313a2b51 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 unsigned 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 GELF_R_INFO(reloc->sym->idx, reloc->type); + return 0; +} + 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 cbf66b63ff82..a3fb62e88450 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 do_func #undef Elf_Addr #undef Elf_Ehdr @@ -50,7 +49,6 @@ # define has_rel_mcount has64_rel_mcount # define tot_relsize tot64_relsize # 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 @@ -75,7 +73,6 @@ # define has_rel_mcount has32_rel_mcount # define tot_relsize tot32_relsize # 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 @@ -234,22 +231,6 @@ static int append_func(Elf_Ehdr *const ehdr, return elf_write(lf); } -static unsigned 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 GELF_R_INFO(reloc->sym->idx, reloc->type); - return 0; -} - /* * 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