Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp912661ybb; Fri, 10 Apr 2020 12:41:54 -0700 (PDT) X-Google-Smtp-Source: APiQypLOec5CGrg+FijIdCKuWo52oTuYfhVQVpvD3egD7pk3ORrFOKJEEO+pYrbYw314u7r/VGa4 X-Received: by 2002:ad4:4c85:: with SMTP id bs5mr6704375qvb.213.1586547714577; Fri, 10 Apr 2020 12:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586547714; cv=none; d=google.com; s=arc-20160816; b=XewbfQKbBfw58i0St0SDZDx4YCJ39FN16i/U4Hz0xyeChctr8w/l6pNvDL3C3UvQ29 mQ6GXyv9YjSMvwOzXd+nGbFNv7/Dq2Q+lJ1a+dOZdxqZBRyULUiKHYD8ugS+KZSHXDyS tYjq5VzFylmuQutSjTDmpbgifWCL5xTJctGJsYgQr7U0xvD7K9/3vF1G1mgvp0ae2KjR 5R/AgcBsdQ8Hds+UToLfQquYlIpegNG+ipHZRuNCric8TUiTTpi3nvclrwTnaQ/vPNJP hsWZHwi0TbG4uewnkDLszHw9NuyX/CRZ5znAwNwYZNoHL6/W2X/xbu88id/F3fSl3esU 8rSg== 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=bMQtLjp70vPxGJJSFq2+0gzKzunSY8YZMtt5+FRaBU4=; b=NV7TrZyYBnSBZeFxxsOKfeeuuBzYORkDbbXVNYZE6TRGuBCRhVs5mS3ndzO3BSpRhv 2pBbhze3YYS/9MsWBPvhlp7/7Qnoy9wAk+Yef3SjhgaqxF9xD5oSAgCZi+9Vh8ATpAa7 KdccQ3KBWhoVYcDzY/NOrYKlJRkm+EN/7XK23ypTt++hMCEx37lhjaOC8fefFI+O56ht L+Ob7CX+/FqBBDug1T3xEH5U1TsX0jAtB8PTSnWI2RPU4HLicDn0+TGYt1eLR8aPqPvy GxMPcUGmM6nbnsU37iDGrGzkaCvnJwVK+4RxsaymrNpLE/bxErb1WxxyukUifqpLB+jz J2Pw== 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 p1si1986771qki.26.2020.04.10.12.41.39; Fri, 10 Apr 2020 12:41:54 -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 S1726795AbgDJTjE (ORCPT + 99 others); Fri, 10 Apr 2020 15:39:04 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:28742 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbgDJTjD (ORCPT ); Fri, 10 Apr 2020 15:39:03 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) 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:38:59 -0700 Received: from sc9-mailhost3.vmware.com (unknown [10.166.69.226]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 3966DB2C9B; Fri, 10 Apr 2020 15:39:03 -0400 (EDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Julien Thierry , Ingo Molnar , Steven Rostedt , Miroslav Benes , Matt Helsley Subject: [RFC][PATCH 29/36] objtool: mcount: Reduce usage of _size wrapper Date: Fri, 10 Apr 2020 12:35:52 -0700 Message-ID: <395fa2069e8280d57c1509bdbac9eafb1c6badf9.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 Use loc_size, which will be passed in from outside the wrapper, rather than the _size wrapper since the location size is determined outside the wrapper anyway. Signed-off-by: Matt Helsley --- tools/objtool/recordmcount.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h index 9ce2d74df89a..353c7d082631 100644 --- a/tools/objtool/recordmcount.h +++ b/tools/objtool/recordmcount.h @@ -72,6 +72,7 @@ static int append_func(uint_t const *const mloc0, uint_t const *const mlocp, Elf_Rel const *const mrel0, Elf_Rel const *const mrelp, + unsigned int const loc_size, unsigned int const rel_entsize, unsigned int const symsec_sh_link) { @@ -83,14 +84,14 @@ static int append_func(uint_t const *const mloc0, unsigned const old_shnum = lf->ehdr.e_shnum; /* add section: __mcount_loc */ - sec = elf_create_section(lf, mc_name + (sizeof(Elf_Rela) == rel_entsize) + strlen(".rel"), _size, mlocp - mloc0); + sec = elf_create_section(lf, mc_name + (sizeof(Elf_Rela) == rel_entsize) + strlen(".rel"), loc_size, mlocp - mloc0); if (!sec) return -1; // created sec->sh.sh_size = (void *)mlocp - (void *)mloc0; sec->sh.sh_link = 0;/* TODO objtool uses this? */ sec->sh.sh_info = 0;/* TODO objtool uses this? */ - sec->sh.sh_addralign = _size; + sec->sh.sh_addralign = loc_size; // created sec->sh.sh_entsize = _size; // assert sec->data->d_size == (void *)mlocp - (void *)mloc0 @@ -109,7 +110,7 @@ static int append_func(uint_t const *const mloc0, sec->sh.sh_flags = 0; sec->sh.sh_link = find_section_by_name(lf, ".symtab")->idx; sec->sh.sh_info = old_shnum; - sec->sh.sh_addralign = _size; + sec->sh.sh_addralign = loc_size; // assert sec->data->d_size == (void *)mrelp - (void *)mrel0 memcpy(sec->data->d_buf, mrel0, sec->data->d_size); @@ -231,7 +232,7 @@ static int do_func(unsigned const reltype) } if (!result && mloc0 != mlocp) result = append_func(mloc0, mlocp, mrel0, mrelp, - rel_entsize, symsec_sh_link); + _size, rel_entsize, symsec_sh_link); out: free(mrel0); free(mloc0); -- 2.20.1