Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp913323ybb; Fri, 10 Apr 2020 12:42:52 -0700 (PDT) X-Google-Smtp-Source: APiQypJgckx5HG7KubkpaBDBqqMFug/SReSGE5S+xPAKpHJzuTy9XWaOFWrz/37lJNbTm8GrDLOV X-Received: by 2002:a05:620a:16b0:: with SMTP id s16mr5794566qkj.204.1586547772342; Fri, 10 Apr 2020 12:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586547772; cv=none; d=google.com; s=arc-20160816; b=wn9k3RhcbMNMInbgBnIQgbMcJbX5Iz/g3nxrimzDrunrmgg6qfi2pxFKUSnDPLA81T ikKxbMUroQok4ceHml9qvAV8bLAi5upUSQpxqAsGRcc8qam8yJEfhfOoPHPcwGMnj5by pqkdP1bi2FBpUgTfpJaWWuVrrN8yWb2QWUn7HOGMjtQyO2nagkRg6V1KjQUjvFDEf8At /uZDpaMs+1283S+ktjrdmfiKpnAOMj3F2omWt+sDFUCx06g1kDZ7k248fXfGVl3Lrats m8a22bTCuVJJ4HwULorgqf/nZjofcGDnhmvvEgkDpWLC6LnJME7xXw9A4g40JjRStB++ XvKw== 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=0Vrrf11JkTxwqrjbuAi3l3TVcAzjQye3AxAQ1qY0OwU=; b=GeoKvplGX0w0h7tKz+/zOUNVBs41tNGODL2NVWDvmNUWV6XmSzcPNqWjuWfgCoE9RM dEF6Jcot/z97hIh0coeCx7mePvNvcShpIjRZbOuhQt0yrWbFRNPwhLY9PvvXA96/GhBo F54YoJA5Hm6BJ6T1OxahrsuFtZRkuCSgLXrIP/xE3u5S/DBiGoZgsyoxNwSh65K4Y+q3 87VAfmVDls6ZEa3W+H9b979kKXB3qKxpBA7c6Xp1d/EMsfX8xUf1vo5eAk1Y/hLtXTZS BEbofMtvCoX3S45jpEL3Hu9Agcp3QwZqTvtRVqbjqhuINUtejdH99ZevNDK7DBeSN+5p dlaw== 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 a5si1883185qkn.149.2020.04.10.12.42.38; Fri, 10 Apr 2020 12:42:52 -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 S1726741AbgDJTl0 (ORCPT + 99 others); Fri, 10 Apr 2020 15:41:26 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:36243 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbgDJTlZ (ORCPT ); Fri, 10 Apr 2020 15:41:25 -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:39:05 -0700 Received: from sc9-mailhost3.vmware.com (unknown [10.166.69.226]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 5E464B2D03; Fri, 10 Apr 2020 15:39:09 -0400 (EDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Julien Thierry , Ingo Molnar , Steven Rostedt , Miroslav Benes , Matt Helsley Subject: [RFC][PATCH 30/36] objtool: mcount: Move mcount_adjust out of wrapper Date: Fri, 10 Apr 2020 12:35:53 -0700 Message-ID: <531409b6dbb2df74056ba03269e311b8248ba7ae.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 The mcount_adjust variable defines how many bytes to move back from the relocation address in order to be able to get to the start of the function call instruction(s) needed to turn it into a no-op. The values are very small and signed so we don't need to worry about changing the size of the variable's type inside the wrapper -- we can just use a regular int. Signed-off-by: Matt Helsley --- tools/objtool/recordmcount.c | 12 +++++++++--- tools/objtool/recordmcount.h | 5 ----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/objtool/recordmcount.c b/tools/objtool/recordmcount.c index 5fdef8b2ac28..52d8d9800bf9 100644 --- a/tools/objtool/recordmcount.c +++ b/tools/objtool/recordmcount.c @@ -385,6 +385,12 @@ static unsigned tot_relsize(unsigned int *rel_entsize) } return totrelsz; } + +/* zero or a small negative offset added to get the start of the call + * instruction + */ +static int mcount_adjust = 0; + /* 32 bit and 64 bit are very similar */ #include "recordmcount.h" #define RECORD_MCOUNT_64 @@ -495,7 +501,7 @@ static int do_file(char const *const fname) rel_type_nop = R_386_NONE; make_nop = make_nop_x86; ideal_nop = ideal_nop5_x86_32; - mcount_adjust_32 = -1; + mcount_adjust = -1; gpfx = 0; break; case EM_ARM: @@ -524,7 +530,7 @@ static int do_file(char const *const fname) ideal_nop = ideal_nop5_x86_64; reltype = R_X86_64_64; rel_type_nop = R_X86_64_NONE; - mcount_adjust_64 = -1; + mcount_adjust = -1; gpfx = 0; break; } /* end switch */ @@ -556,7 +562,7 @@ static int do_file(char const *const fname) } if (lf->ehdr.e_machine == EM_S390) { reltype = R_390_64; - mcount_adjust_64 = -14; + mcount_adjust = -14; } if (lf->ehdr.e_machine == EM_MIPS) { reltype = R_MIPS_64; diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h index 353c7d082631..b4d3c55f2c9c 100644 --- a/tools/objtool/recordmcount.h +++ b/tools/objtool/recordmcount.h @@ -18,7 +18,6 @@ * Copyright 2010 Steven Rostedt , Red Hat Inc. */ #undef append_func -#undef mcount_adjust #undef sift_rel_mcount #undef do_func #undef Elf_Shdr @@ -35,7 +34,6 @@ # define append_func append64 # define sift_rel_mcount sift64_rel_mcount # define do_func do64 -# define mcount_adjust mcount_adjust_64 # define Elf_Rel Elf64_Rel # define Elf_Rela Elf64_Rela # define ELF_R_INFO ELF64_R_INFO @@ -48,7 +46,6 @@ # define append_func append32 # define sift_rel_mcount sift32_rel_mcount # define do_func do32 -# define mcount_adjust mcount_adjust_32 # define Elf_Rel Elf32_Rel # define Elf_Rela Elf32_Rela # define ELF_R_INFO ELF32_R_INFO @@ -65,8 +62,6 @@ static void fn_ELF_R_INFO(Elf_Rel *const rp, unsigned sym, unsigned type) } static void (*Elf_r_info)(Elf_Rel *const rp, unsigned sym, unsigned type) = fn_ELF_R_INFO; -static int mcount_adjust = 0; - /* Append the new __mcount_loc and its relocations. */ static int append_func(uint_t const *const mloc0, uint_t const *const mlocp, -- 2.20.1