Message ID | 20221014170905.64069-7-adrian.hunter@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp291089wrs; Fri, 14 Oct 2022 10:13:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gUkqqiHFhPw0IG6mX+YsxIz5uf2sJ1FRfvJsE1MVffCAn3dPK1fZb4M7dLRHxUcFUOnX5 X-Received: by 2002:a17:907:7b86:b0:78d:cb21:da0c with SMTP id ne6-20020a1709077b8600b0078dcb21da0cmr4437460ejc.24.1665767605475; Fri, 14 Oct 2022 10:13:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665767605; cv=none; d=google.com; s=arc-20160816; b=km+jlLU1ZY8aAXDoomsnZBwkKBn/czMBIS3bKSJEJh14v9CMTqVMQRZ863cjlg6ksy qcPrB/yqypsYlhoLKNOHBganFwTyC2C61Gai7wZ8NFVRdzKOj0YQDbYlwsAstqofc7wx SzpiQMu86olv0+qfHN2M+NSZN2j3iewo4K7cwWL2pTdycECzURzpECDY7I4no0QcR372 X7VzKJLiH6ghFQ0hdZsQiOTSRbbseeP2MZ2ZlLl4N2gTao+4tHf28+lVw4FNhjsgaMIh vHhOdAsUZgurZ2zqVkV5e9ByyR3Ft1fy5gD/lxN+dra2GuJoYDWvGlAkAdlrQqexOOnE ftow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iH1ptCbBrlRs9LY1fGLYdSPub9oAN2yLAIX1Vx4sx/g=; b=XnZlzVnkeUuRo2NZOBi8Q40POi53G8PWCg1bEcZDLMYVTosZ2fTCSodOL7vyB3pDzE jaH4tySOGxxl96pRYQfQloPJfpinkTpdVvsShQHlYk3/K5x+Y/A0ifleZD3F08pLEd28 rku5oKpXOZF0MgdNhBK93xlgjqWy+duJeoOOKFYtg1rqBKem5ydxSUHaOtHVhTfAOc9C 8sLDnPgnqTdK1ex8/VQ/5aZ1M8jsHY+SmjtB20xU52huvWJ3wjvwbFbzqDhllJw0OOuK BXStzSmaChFI+l1O7bBazRFkuPBoIzD8cIKtpOrtAMrNl6SAANH8o/9+4Iw2NCiiF5vk uJxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f1Ur3SGW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz3-20020a1709072ce300b0078db371355esi583764ejc.987.2022.10.14.10.12.58; Fri, 14 Oct 2022 10:13:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f1Ur3SGW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231218AbiJNRKj (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Fri, 14 Oct 2022 13:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229945AbiJNRKh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 14 Oct 2022 13:10:37 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF46A8E7BA; Fri, 14 Oct 2022 10:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665767433; x=1697303433; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ryhJMBhcoSpBFXuIFT30paYnhOJbS2OmeVDypFSB8to=; b=f1Ur3SGWhbGJglRg1tCKdGurWZAeLCNJBV88h/1GambI9ZvvsAxPVXZT ftX75dM97S8O5lPeDP6j58/AdHCN50Vj9HnKgO5a5J5j3/waypH+ptPay orP90vd9Runq390R+jGPAiRAjSrOBMMsbIH5spg6aojT1wpNHm/sG36V0 ebTlbMvZvX/q/mknzfzPDeaMNovHXQLSySv2DiM1RmNHeCY7P8Wmot8Zf uK3fyvUA0Fn+AhTS7ReC9F2eFSm1SrgvOHldHWAsuO0gly7v3uQqZSFcw WEzb0/GHVP0KYIFH5XRIsi05g7zldqYWR5s0QxEAGgIbQJ+fPLVgotjnN A==; X-IronPort-AV: E=McAfee;i="6500,9779,10500"; a="369622660" X-IronPort-AV: E=Sophos;i="5.95,184,1661842800"; d="scan'208";a="369622660" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2022 10:09:41 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10500"; a="696377032" X-IronPort-AV: E=Sophos;i="5.95,184,1661842800"; d="scan'208";a="696377032" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.43.79]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2022 10:09:39 -0700 From: Adrian Hunter <adrian.hunter@intel.com> To: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 6/7] perf inject: Fix GEN_ELF_TEXT_OFFSET for jit Date: Fri, 14 Oct 2022 20:09:04 +0300 Message-Id: <20221014170905.64069-7-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014170905.64069-1-adrian.hunter@intel.com> References: <20221014170905.64069-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746683932888239666?= X-GMAIL-MSGID: =?utf-8?q?1746683932888239666?= |
Series |
perf intel-pt: jitdump fix and test
|
|
Commit Message
Adrian Hunter
Oct. 14, 2022, 5:09 p.m. UTC
When a program header was added, it moved the text section but
GEN_ELF_TEXT_OFFSET was not updated.
Fix by adding the program header size and aligning.
Fixes: babd04386b1d ("perf jit: Include program header in ELF files")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/genelf.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h index b5c909546e3f..6af062d1c452 100644 --- a/tools/perf/util/genelf.h +++ b/tools/perf/util/genelf.h @@ -2,6 +2,8 @@ #ifndef __GENELF_H__ #define __GENELF_H__ +#include <linux/math.h> + /* genelf.c */ int jit_write_elf(int fd, uint64_t code_addr, const char *sym, const void *code, int csize, void *debug, int nr_debug_entries, @@ -76,6 +78,6 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent #endif /* The .text section is directly after the ELF header */ -#define GEN_ELF_TEXT_OFFSET sizeof(Elf_Ehdr) +#define GEN_ELF_TEXT_OFFSET round_up(sizeof(Elf_Ehdr) + sizeof(Elf_Phdr), 16) #endif