Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp912773ybb; Fri, 10 Apr 2020 12:42:03 -0700 (PDT) X-Google-Smtp-Source: APiQypJoIT/79ZntcAehy5R/Hk0zFSik0c7cNyqZrO3OGU84HAwiTNiSc6upWb9LhHiM/Ii9VZcd X-Received: by 2002:a37:e40e:: with SMTP id y14mr5538863qkf.426.1586547723763; Fri, 10 Apr 2020 12:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586547723; cv=none; d=google.com; s=arc-20160816; b=mFQ1TUl3tKHZuVDZtgRvQW6zITHnfhG79gjnbCnW0L+ETUfIWtWi8f/HikaQ2zS+Se /vBRWbN3iFBacZKS5UfFvbYNfZ634WevAJXIK8hzBYyWoPzlh1HvJhPWoyuvVsr5Lfil SzKqo3ym19SMiXxEDcCg3MgO4PejL9TxKCsCEBfzLsipWUAKHFx+SuuUslKVscNRS7jH aCjKH92dTDKS9knEA1q81eSkisbDT13+LZQbHCoxNjaJ/bE8QnCUMGMI81lugr78PXeX V4EyO/UIymZ57WBWQMu1yfOl5sdZks7HdmxKuWhR71EoQsI+ozqIe3pCfdhinnbjs0oz BanQ== 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=1mclFE2FMu4MklMNoEwITKRsDT2ZNcWPbk8KQsq6KOs=; b=j3zMuqHlaGRwcBznw8gX3WRJVQ25LnX1WmkaHvpeFf/bJbesVPYlQP/j6i9uGFjpbr SvW7RREx0AqdgU8+MBVHrfP7rAZVOGnqPWrrk4jlwIBGgB2LoDERFzeIAyjA/ZKC+8Cm /3Ur6PcENuK+/Ebll1MPA0JvXUXCVIA6jEOSZl+oo2cEwtlfJ5KoTGX3mFGj7nu19MNW mvxnzClBh5P2fB6Pi/E96iCuXkdGhadVWCagzvvbpr35lsXI/KwCffkYYM7L3DWGbUV7 yBHfTKvtyEmnF1WLNlpm46kuPDrzadC1eMHMNv05/43w6r87rSuCwC/NvFuiTZauBmR+ PIBw== 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.41.48; Fri, 10 Apr 2020 12:42:03 -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 S1726885AbgDJTj1 (ORCPT + 99 others); Fri, 10 Apr 2020 15:39:27 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:28773 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726861AbgDJTj1 (ORCPT ); Fri, 10 Apr 2020 15:39:27 -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:39:22 -0700 Received: from sc9-mailhost3.vmware.com (unknown [10.166.69.226]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 6136240BC0; Fri, 10 Apr 2020 12:39:26 -0700 (PDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Julien Thierry , Ingo Molnar , Steven Rostedt , Miroslav Benes , Matt Helsley Subject: [RFC][PATCH 33/36] objtool: mcount: Move sift_rel_mcount out of wrapper file Date: Fri, 10 Apr 2020 12:35:56 -0700 Message-ID: <0442618da2678ee6bc657bfda6137140239f58be.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-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 this function no longer uses any of the old recordmcount wrapper code we can move it out of the wrapper too. Signed-off-by: Matt Helsley --- tools/objtool/recordmcount.c | 47 +++++++++++++++++++++++++++++++++ tools/objtool/recordmcount.h | 51 ------------------------------------ 2 files changed, 47 insertions(+), 51 deletions(-) diff --git a/tools/objtool/recordmcount.c b/tools/objtool/recordmcount.c index 89765870b0dd..a16611a352e5 100644 --- a/tools/objtool/recordmcount.c +++ b/tools/objtool/recordmcount.c @@ -394,6 +394,53 @@ static int mcount_adjust = 0; /* Size of an entry in __mcount_loc; 4 or 8 */ static size_t loc_size; +/* + * Look at the relocations in order to find the calls to mcount. + * Accumulate the section offsets that are found, and their relocation info, + * onto the end of the existing arrays. + */ +static void sift_rel_mcount(GElf_Addr **mlocpp, + GElf_Sxword *r_offsetp, + void **const mrelpp, + const struct section * const rels, + unsigned const recsym_index, + unsigned long const recval, + unsigned const reltype, + bool is_rela) +{ + GElf_Rel *mrelp = *mrelpp; + GElf_Rela *mrelap = *mrelpp; + unsigned int mcount_sym_info = 0; + struct rela *rela; + + list_for_each_entry(rela, &rels->rela_list, list) { + unsigned long addend; + + if (!mcount_sym_info) + mcount_sym_info = get_mcount_sym_info(rela); + + if (mcount_sym_info != GELF_R_INFO(rela->sym->idx, rela->type) || is_fake_mcount(rela)) + continue; + + addend = rela->offset - recval + mcount_adjust; + if (is_rela) { + mrelap->r_offset = *r_offsetp; + mrelap->r_info = GELF_R_INFO(recsym_index, reltype); + mrelap->r_addend = addend; + mrelap++; + **mlocpp = 0; + } else { + mrelp->r_offset = *r_offsetp; + mrelp->r_info = GELF_R_INFO(recsym_index, reltype); + mrelp++; + **mlocpp = addend; + } + (*mlocpp)++; + r_offsetp += loc_size; + } + *mrelpp = is_rela ? (void *)mrelap : (void *)mrelp; +} + /* 32 bit and 64 bit are very similar */ #include "recordmcount.h" #define RECORD_MCOUNT_64 diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h index bdf77172da58..7db08ad9b4a7 100644 --- a/tools/objtool/recordmcount.h +++ b/tools/objtool/recordmcount.h @@ -17,68 +17,17 @@ * This conversion to macros was done by: * Copyright 2010 Steven Rostedt , Red Hat Inc. */ -#undef sift_rel_mcount #undef do_func #undef Elf_Rela #ifdef RECORD_MCOUNT_64 -# define sift_rel_mcount sift64_rel_mcount # define do_func do64 # define Elf_Rela Elf64_Rela #else -# define sift_rel_mcount sift32_rel_mcount # define do_func do32 # define Elf_Rela Elf32_Rela #endif -/* - * Look at the relocations in order to find the calls to mcount. - * Accumulate the section offsets that are found, and their relocation info, - * onto the end of the existing arrays. - */ -static void sift_rel_mcount(GElf_Addr **mlocpp, - GElf_Sxword *r_offsetp, - void **const mrelpp, - const struct section * const rels, - unsigned const recsym_index, - unsigned long const recval, - unsigned const reltype, - bool is_rela) -{ - GElf_Rel *mrelp = *mrelpp; - GElf_Rela *mrelap = *mrelpp; - unsigned int mcount_sym_info = 0; - struct rela *rela; - - list_for_each_entry(rela, &rels->rela_list, list) { - unsigned long addend; - - if (!mcount_sym_info) - mcount_sym_info = get_mcount_sym_info(rela); - - if (mcount_sym_info != GELF_R_INFO(rela->sym->idx, rela->type) || is_fake_mcount(rela)) - continue; - - addend = rela->offset - recval + mcount_adjust; - if (is_rela) { - mrelap->r_offset = *r_offsetp; - mrelap->r_info = GELF_R_INFO(recsym_index, reltype); - mrelap->r_addend = addend; - mrelap++; - **mlocpp = 0; - } else { - mrelp->r_offset = *r_offsetp; - mrelp->r_info = GELF_R_INFO(recsym_index, reltype); - mrelp++; - **mlocpp = addend; - } - (*mlocpp)++; - r_offsetp += loc_size; - } - *mrelpp = is_rela ? (void *)mrelap : (void *)mrelp; -} - - /* Overall supervision for Elf32 ET_REL file. */ static int do_func(unsigned const reltype) { -- 2.20.1