From patchwork Mon Aug 26 21:35:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13778526 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 434A8C5321D for ; Mon, 26 Aug 2024 21:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OF+jnntJ/0cyM9SmXgZIk+3jfpGgZNHq/ixJEgd9brw=; b=hxpw01QHPicrCHQPDGLZxUaPGy YltM2t4UQriMZhraoARqWJvrx20h38xIcxaKtOYVHqGlv+enIdpMooID0XCtmndHAhHRxGxx4qwSE pGr63hkFhEk9jQEM1LtfUzhnJAn+k1e5PVG8x7hbxjdr8QyxqjLuIn/JC6ywgFOkdBelg9seoZi/s EV/FF6hWQeelXuylvHKJVIQca30wOjYcUEr/0PC8Av6Z+S5bd4rd8Fa+RHoX61t79VnbYNMUs9bSV aZMJc8XskZHfU1sX0XQjJbP8QAfyZ7bk6j28U3zsxEcXz6xLIXuP7cDll1u+ZEV3kka2HPc7EBHE4 LAAJelOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sihVV-00000008rFK-1iL6; Mon, 26 Aug 2024 21:44:13 +0000 Received: from mail-eastus2azlp170110002.outbound.protection.outlook.com ([2a01:111:f403:c110::2] helo=BN8PR05CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sihNy-00000008prN-04HA for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 21:36:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fLbyETG4lnMoOsjvBg6H/YP1yrsYFjvWVje8HGj/slEGcsqRx4Qhus/+zP9qnuVa1Henc4mXdcLZBCY4t5AOT6Rd4mzcO7m3zWWKI6j7IjwMYoCJa9UuZgXffwidYIfQFpjJQdYx/Bu7MXVIse8tu8OMqUkwAm0zMr4qwKT3lHj/OQqNuvqtej49fuE9a5lepB5v1twV1XyiKwJBtgcG8beIsJkS3mukH/EqLaJnoUmMu9zX+hinJzPhRG9Ho2NBBIGS39Jzes1WKQKxTZ5NrS/xB3Uqf9VWRTn6g5Za5ZDZalqyqlmScdLU6RWgzaAVRzlsZgrMhaO/j4aCK3LKsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OF+jnntJ/0cyM9SmXgZIk+3jfpGgZNHq/ixJEgd9brw=; b=sJuyh/i10G3knGOzBQ7modEz6klOnvK0bOP/lDt/0a/2sd3e3Rl6BLwgG2WOCpFcFmOPHrrHAeRUfz7mBb8jfMkHiDumnc1+N4eW3Zf3SpPxghANmEgvBhMC6UXBDG7iWJn7PtkGIe4gz4Bx/wm57fiPRZnujSXwAza6nfg1RnqdN3BQOtv95LaNkCwwyDB5tUN1JiJWttp8m0jCkp62QLqVXqE8dqo701E/tpYcE+qhprLvPL2SGfZx5ocmnc5WY28+tCphb58r/NjY7tSnEDK+7bsf3i7gT7qo4/VtD8l+D/c/CLiZQhrqilX6oLoSgzlX5hCU5nNGd25CUDfaoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OF+jnntJ/0cyM9SmXgZIk+3jfpGgZNHq/ixJEgd9brw=; b=fFlQ5MF2koCmXK/QGceW/SjPxErmKWUFcTJWxx0CPZZJjdUSpCCRgZcG5qnx0Z38gd8EfpW4r/sxHEtFHXWLfHeb9pG0nxaWlSn2ZsrGZsmzuB4o6ELfu3lrdcwhVR/QEzmPojgkPVMHNHglcjv+Unb3sx7r2Ut852312I3x/Wg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SJ2PR01MB8150.prod.exchangelabs.com (2603:10b6:a03:4ff::5) by CYYPR01MB8410.prod.exchangelabs.com (2603:10b6:930:c9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Mon, 26 Aug 2024 21:36:20 +0000 Received: from SJ2PR01MB8150.prod.exchangelabs.com ([fe80::72ca:29db:7676:9fea]) by SJ2PR01MB8150.prod.exchangelabs.com ([fe80::72ca:29db:7676:9fea%6]) with mapi id 15.20.7897.021; Mon, 26 Aug 2024 21:36:20 +0000 From: Steve Clevenger To: james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, leo.yan@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V2 3/5] Force MAPPING_TYPE__IDENTIY for PIE Date: Mon, 26 Aug 2024 15:35:54 -0600 Message-Id: <2ed246c95cac628cffc1628c115a4b791459f8fe.1724698250.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: YQ1P288CA0024.CANP288.PROD.OUTLOOK.COM (2603:10b6:c01:9e::7) To SJ2PR01MB8150.prod.exchangelabs.com (2603:10b6:a03:4ff::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR01MB8150:EE_|CYYPR01MB8410:EE_ X-MS-Office365-Filtering-Correlation-Id: 6067510b-6551-4349-2bed-08dcc6171fb4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: DvRdaSl1+UtOhmUw3gO8AAxAcjN2NGThyDVVH9Q2z0NSxICrfQcwrUB0UXcb+EB/Bg7VGxFDwKCdu8WJXkY0OKUrrsf+XlwvwI7mbtIMTb44yMdJbraNyncUH1yztK7PevqPvOYbRW2W3LUiVz1FERYwTL8Q89ktVD2utOmD56m+3f0v/n2Hncwo5SDz99N6mPv4axhQGJFafLpAn45rXreHDndVVPLsnA1wvbmSmn8zEF7Q1R82DUkCG2rdccs0Yw/EtOpqK8u22lyknl+wKlwUq7LC33o8oXCLODiMCdexaqxEcS34+FtzdlY4k38dxPOx6zu2G1ETrdNuu3/c3yE/4+2LHdNBHEACkuK7sa3UhhOO1Q8cwCoKR+p+WJnHx2j5y0QOdX9eL5yaOs1jeb6IOKJN68DxWao1n/JiS+vxuyPRfVP3oBpnxhkmI14jvkluvtgJgsZHlAP6M84W5J1IlKRa/cburGgBVQUdxTDY07KbQTd7MdzTQ5Zb+gRftE69BxkuEEwXxrih8Guj/4pdwA9SrKzYutQgXFA9z2qtHzMtJo/lhff529KzHF+DEGLv30y6CWEqDqv0pYV4SB8rLDMo+zvTmmezw7fMXdZ7M7gFcLGOeQ19yfop48k9ZhHXuPD2R+PrUY1rexsCO+9Z/8WQzHhAWpgsObQ14iXp5R8LhrJuA2hm+2gssjkdQGpcheoO/Onu89ussI+o+y/k+ZEXoXPDXc/V/FRxpI8GN/Ds8XNNPfD/DpNoIsomgtPsMPZAQdcU8zAjX8aDnAkULUdpybM+UcvgkLrzGjrI4mOBpn9vvU/PlAQuxtTUGWQeKYBzWwrHdpcr4d92UfCgCTqWSbt8R/DudMyVlHyg8vYBZ5ezuU9sIvLvORf7aYJZzjhOeP50N6CYZutWUN6s/d2v8ZDr0V8oJtpzBV4GtBHxVTOpWXrrTrHsSP4wzjevG41AJ3xK7lP6AB9Q7BfTo2+x/HUtoMRxttU4U1+3ddjbSj9fighcdTif5rSdKqIPm1k2kP0VK7b1TSkcCdDFQ3SWKz28C7igwfkPRIHsvlN9J1Y0bvbeMlUaq+/Z8RieQlb5YcyfsvuOs1p+Fa9tfVPDKfYX5Ngklqu5bQQl9vYbsZnzgUmBktCiXd3Z1j15JU6c/L3rm6eZGlivjkxU6WhzhQHdl4yvwKGPTPxdVg/6IK9GY+9+9tiUzeH0tKg8Z1GnqbmN2d9eSMi3O8lDGR5VKe3T5Nyz1tiLZ9C2QFqEU1zkTgT1Xa6/FaGevtk/fHWY+mfewZEnIOrGOdg6vdGmPD0lUatNdhfTJSGhRL9OPPJny3PY8wrKtUgi4/fZyZPejes/8Lvf2OgUkhWQ7EEVoaZKQnpsIIhgXTF2QMRTydKtaTxoSHVI/xso4TbBu1rMglTrf0eE6fdBOg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ2PR01MB8150.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam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Gvkc4ygWROOt5ZrPTkcv0K70zA7v0+AEBZn+spl0GCvmDFpZgn+1f++0Bc5/cJrSymyH2PFnjtRKkUt0BNty3DM/pqs+6JKE8x3r3VDPRwAXmWGl2en1L0m5cAy1lafXfrZ7gYIxnNqKtWVVleu4dmvNrp/+Ud2+oMDxE++pNVXciph+IffD9FnMwkq1wQRpCui8WkzetkXDsWZ8YSrzFWS4HqeDYaXp5fCV5euSlU8aQ2FmnmT2FKHoianyY99ybTogFTjBJu9QKNTauxH0htkNnJCgLH4k+h9IXuEcpAJnlI6HuIo0DL/Q8AyhaQUEI0l7zn4QJNeJhdfJSNy/l2bbt0x7RhSra0OAxeHMfv5fYBdFLr3tDRVxtgVQmmcGsHvPNEmbeNW3UtcXmge22id6tZZPpBRFEofUsEDv6p0QBuoR3+G36ytqR3X0UlXJn2ymJNO3WhnGglX2zVW7tfd0N0W3VifvywAGMZUc13VuAzyJCbk39kDBd1Hh3tV0x+HK2V89gZLFnvWkr8ZJu/LstRLzsPHHWhgn/BkMcj8PR1wwHT1C1bjkaC31rksCq+SNyOrqiSQOkcQ6FcR X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6067510b-6551-4349-2bed-08dcc6171fb4 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR01MB8150.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 21:36:20.0080 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XhcuC/bOHtRjJ5Y095oZ8X0exaL4UBhyXX25vyBcPfzuDf5gX5X4malgvfBiX7jH+EBPqMDxH1oXHivUEkspCP9bLxZmOTEXbdAF05SC5KD0TyP/pfFu0oSMvyYCzeh4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR01MB8410 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_143626_078317_4F13974D X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Changes in V2: - Updated mailing list distribution Use dso__is_pie() to check whether the DSO file is a Position Independent Executable (PIE). If PIE, change the MAPPING_TYPE to MAPPING_TYPE__IDENTITY so a zero map pgoff (text offset) is passed into the script. Signed-off-by: Steve Clevenger --- tools/perf/util/map.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index e1d14936a60d..df7c06fc373e 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -171,8 +171,11 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, assert(!dso__kernel(dso)); map__init(result, start, start + len, pgoff, dso); + if (map->pgoff && !no_dso) + no_dso = dso__is_pie(dso); // PIE check + if (anon || no_dso) { - map->mapping_type = MAPPING_TYPE__IDENTITY; + map__set_mapping_type(map, MAPPING_TYPE__IDENTITY); /* * Set memory without DSO as loaded. All map__find_*