Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp911400ybb; Fri, 10 Apr 2020 12:40:14 -0700 (PDT) X-Google-Smtp-Source: APiQypLF55d+RjBX1RGwdZnxk3f89SlKshcjGcUqgtHpLfRxNVZb9bv61yWv2qIgXYcv3gChJDlg X-Received: by 2002:ac8:758d:: with SMTP id s13mr773146qtq.105.1586547614061; Fri, 10 Apr 2020 12:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586547614; cv=none; d=google.com; s=arc-20160816; b=Anh/2l6R7vNPOlXafurIKCvwm+x1E3qxHj32UmJ6s+AfmESFs9rz31yqBe5mdaDxOH AKHNqpUAldSDJyjnXAza9zEx8hH22toTIEngniKF9exyTfcf/x+QhOxz67ib5WTdfJQp 4XUN2FtL86eXMRoOvhLORR8XY7nUBZZobACY7+pSuQsEh2nTRzwh5tpIG93YQqbp4kS0 3popffIfx01AZUN8LKp6QSikq1NAWj3zzRJ+T30lK3H3Z9uZYpK8s56mNijSBqggd0lc v4Wd+5lW8P8NGODjIeTg3rltSGr/ISawQaonUNhV/9uO7/YhATQeJqgd56x64i9Zu8Sf adWw== 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=X6Ql4bvBRbqNxdfAN3TQLzDZR8B4bUr997XeiDImpEU=; b=yZzscBP+fDTjk+Xi9Gtuv5nzYVA8HVUi1XwMDQfc88R0+SqhHeYcYZSFkPZzqtV1uZ JRY0kQbNfQdIIo404mIlLPNTCXjJNhCy6mlV2+ncSTsMqGV063od2ApVL1OFsP6CLHYp DyQSTcnouYcff0dUfFHw/wazgB6bbZCUKaXFkZIh5OmbH5/RWbCmCyvWpl3/w8cwp7n1 vS90BpZOp/lQRzhcxmMxZEbLbWVlG0rVmSdR7PpzvocSa2CdaEwdo2HR8HtLaEltUwm+ M/wcOSXcqp3JHuzze6D2fYtcSvOk4ilLZc7RtGCeJyjUH5c25SX6LIxr4vxX6+tX5X5r 59+w== 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 z37si1031618qtb.65.2020.04.10.12.39.59; Fri, 10 Apr 2020 12:40:14 -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 S1726735AbgDJThm (ORCPT + 99 others); Fri, 10 Apr 2020 15:37:42 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:28677 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726646AbgDJThm (ORCPT ); Fri, 10 Apr 2020 15:37:42 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Fri, 10 Apr 2020 12:37:38 -0700 Received: from sc9-mailhost3.vmware.com (unknown [10.166.69.226]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 2FE0140BC3; Fri, 10 Apr 2020 12:37:42 -0700 (PDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Julien Thierry , Ingo Molnar , Steven Rostedt , Miroslav Benes , Matt Helsley Subject: [RFC][PATCH 16/36] objtool: mcount: Move get_mcountsym Date: Fri, 10 Apr 2020 12:35:39 -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-001.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. If we don't move it to recordmcount.c we will get multiple definitions of the function. 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 f0edc9ed6021..91d14743218a 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 rela *rela) +{ + struct symbol *sym = rela->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(rela->sym->idx, rela->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 5fa51118cab0..9bba41ee2db2 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 rela *rela) -{ - struct symbol *sym = rela->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(rela->sym->idx, rela->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