From patchwork Wed Aug 28 23:17:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13782085 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 50736C71150 for ; Wed, 28 Aug 2024 23:20:59 +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=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=l/5cCVBTdhO3+hU/1Del/Xh1zU DCk60AFVVxf6a9MHbv4PCi4J+Wao+mUS4WPf7+crtcMAJgkoBfPwoSFOmRLhhjo2zswt+AIZHca1h yJjUi9IcR9h1beBHe+XX2lvYd4W7S1QFM3hKduxc3jXriSXOqNjQWrxQtXD5nG0CI0S9NP1+AfKvH HP0FxRwL0FVnxJqJKpovXB/xlKCwDzZ6CSVRKRFMrbsplw1AHvE+QQxB06D2vwKrQPqIod28VVwlV J0OQXlhMRkJ7NPZydLsaD/aAqWSasDFmwKSxCM4ymYpDwm5v1tv0HOBnX1mywmCAMJb7L7T5g5QDM lsAmIm3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjRy5-0000000HK6J-23Kg; Wed, 28 Aug 2024 23:20:49 +0000 Received: from mail-dm6nam11on20708.outbound.protection.outlook.com ([2a01:111:f403:2415::708] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjRvg-0000000HJho-0dKL for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 23:18:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CW2BGvXuc1CrfDhbi04ER1tM7DDJl6zWCqEzWvH1lw/lL2q8U4g4Dh0mKLaJAOgz/CQCtBwWTaVY2XuCYmN019iza4cDF/ERQkcgQyt/Cj63deSxLJ9658IoQP1jyKVd1E3WzdeeGGfv/ZV1yjYjIcIkiFTteGdYx8biYQ4XdJU2xVv4zwExCieEmiauRI9Fbv/qwZYotjQZ6KhdsixVgmmFZ1Bb+2ZlFnLplUWJ/CDEoh4RcKkXdiMC675dLDNYcjyoe3rvHxooCkG4aHD1OKmhgp7aNLPWttOMu2EgyPjg1L0mWf/NwPCxmiF7+QIsRsxI2BLMc6+LJ8Y5uUO6LQ== 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=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=AsuLceaHxyJ2b+4RfgAx4/iSqpUSzeRYBWVaE8KI3PZJ5xw2QOh0K/sCrGrlgLgOZC5sTCCtpY4OddKSPdVPfiYRHAn9DtIObmOHR+Psp3WRLNdaIFhr8TiZP4g+d1J3EhXyLbT3mi6t1+rXgFFAJWYO9Mg8th9lfXJ10YfYbNgNFLd6Zxm7CdcaU7JiDF7qx3cLxT5olFNARDX/GdoRIjLWUGCB5FPT74ceOAYw+uMggncwjReZsW/N8wklSuDMOBh+y4yrjBMzLC5pfO3i6zPaPXZXV3XIMMlgWULLg1sSKHBH2qCO0/ZFQZB5MDXJmV1jyj8cedTiIfrac24CfA== 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=46Lnfa419ba6MwoTBOGTytQvW5UJhrJmfl9dt3uEQ2w=; b=Pmi7G9wmuO6+x1Up3HfWMFoRYjZPBZ/hCcUgfjDcHlYfHt/yOhaFHx4yllqScEk+jpu5nvk3HeQPEXJdor8MhfKfEPIUvX3My8/NPWhZ1tkajUk3kjN7OZ5nYV6iIzN/2gnhIM9ivJq+bMDJSVzlsdL4GSSZRX/c3nu1PsoYQe0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) by PH0PR01MB7895.prod.exchangelabs.com (2603:10b6:510:28a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Wed, 28 Aug 2024 23:18:16 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 23:18:16 +0000 From: Steve Clevenger To: leo.yan@arm.com, james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V5 2/4] Force MAPPING_TYPE__IDENTIY for PIE Date: Wed, 28 Aug 2024 17:17:57 -0600 Message-Id: <070af7268841ba70678fcd615119b66816f996f3.1724879699.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: BL1PR13CA0109.namprd13.prod.outlook.com (2603:10b6:208:2b9::24) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|PH0PR01MB7895:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a7c0bcc-73e3-4d7f-6d51-08dcc7b7b1f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: MIFv6yqDeHlduLi8s36Bh6sq/zRE0uII/J/ZuR5A7RkPAEt+fO4qpoe99TrgeVrJeiSolhSxDKV/HIbzNLT/2QcVWmyrOnXhXFj2UTlrJfLSX7ibhYCsxXriU6q6D49gyhpSvBdQUNkJHaulUIwgvTkklGVgra77PRWuoDMNkmPF9RWy+N7COw/1BOmDj2OvVeEr9NYLm8s02syUQAUmD+ITzYfsihSaSSKV1cKWD74k8owgiW4zegAxl3tvYd9Rxd8293/rRVzf2TLFMbMh9qxgLpcTMl6ohzqL3daqHNgaV3LgzpSNkvbcPsWYDuqBCvkBBDSgA9qW+fPp/o1p492jQ++ZjriD25OCIz/SVxlHv7ro8rh1zJFkxK6swZsQ1d6kb/XESSB/7a9LJ/UKsmRcVqANUgsLYG+mYMN8+oxZRPQlq9wmKLk53UMACUgCPL9aNShNeXCST749SEs78MsC+zGX5mBK+AfbT1VINlepcFcM4x4J9NAJN9pmFPuZ+jGzyyn8F9isz+b//7RVFKAfpwY4tuPg33DA2241Qe+heJiyc0jwY6vGtIbqSfpcTiyb87jNqpaHSCqfckS0UchYCOtE8UmFiUmo5eiwjmlutrLVlXtXQl8vxdif1OgBkkjXCcCnSqCxWBZw67ZzKlpxxXoQ8QrNH9UsWgGyPcb7p2+5BhRD9PBS15i/GOEsIXsT8h2NLdmZkySZn4bdA491lqb708chQy/AWEHCGnri+sDDgzBqZvP9fyAGF4cvnaXJ07dnt6XCVRlWXlq0LjTkAQLYzo/oDU455aWmCLSKra7XPaauvsqMSxpmmPl9tP6liWCFU7WOsGOSDi3UlKpB+tSXNlshZLO+8O6+QT5BnSuSWAuE29zlx5hWBBjmMJpiSN3IpPf35SbXYUg9IA/GPgwZg6VYGhajuj243ZdzpHhFkQwQcufPu8mtTzY3keD8gdjfInzvY6ovj/ZOU+l/0ngQVaaTmhAw0gPxDJyo4qnBQ6ycGu2x4tYlVkDpUb1jjsTVa9O4R5M5Z5vWyDN5iRwDd9MRkiCF7G6S+4EUhCf/TkWnPshqIeP5LWHCB2Uo8OnRxw0IvuCHp47RNr3xG8BYZVvNDqQEQvDCJtcaAbL9Z5EsQfD1Ia2qxLRo2m1+8kNlk/P/7SzFKDQwSvWZs42gBct6raT78JvA47kzfubJVtz3c9Rzh+8C2zaMhH0zFr2AOvCKucT9pu0aF0P0hdSJN24xpr1dPQkhKFKUlRcLN02PPIIxhjFF/VhPAh5ufVOOK2quelGw1yNiMjNqLShTMGwWGC4hbQN81/q2lQuvNyT1LtwxG+P+96S7BV8ZxAvkEahfz5DfnXcZELLZyrCDe3aqVnJWAlQk91ZB64JQvxiiByyN68tQL6Aal+M1EuEztyWEdRIWyCjcMQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR01MB8146.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Message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GeqOfJdWrVxQ2aZFoKDi2N/j1t0u9g2VrjjCdsMXYvoj3eNI77KYUhmbX7mzO4jWgxynar5yyht+ONWhW0r+zyL151Zx+nyJ2KVKy8t1udvA8IpdqoUp5offoPIp8wGA7IRiXfae/RK1ak2Oi09qeM/zH+RMHwrxmzbP3dtsW9+nhykG0urIDnhKIL07oH8yj8LieVnxycB5u1207lGts/LRt4ATUqsZcxzA19AQ8gDWH/MHtbWN5cqgUGwZPRL/CPkeYQXz+gRvZQC1FsKrL47gLEqt0muKVDP1QQat4V0EeaRHgyvuJna+ZKrNyGI8oYeRO1VuwsnaQf2uZeCHBrUVz135CyLR9bXxzF54Ai8FTYdlOvqhL3zLJK7YLFVJ2Tt8zAHJf/n9NjSKjTZSP5E+h1IykMoJzEluI8H1kWhAnu4tJC9j37LlhN8VHjdyE9DT5/NRrNvGigoiicmaMS4eU9vkev0bMDNT9IKK3Nh4FW37PQKtqgU0HUFuMfz87vpObxcJgYxnmVT8JUETz7DDk1LptoRIWmDLM6Lggc8iBm+F8NOJHLeGsM2nkl13BMX5vTiWdxHKeB5pylsRRcYb X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a7c0bcc-73e3-4d7f-6d51-08dcc7b7b1f3 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 23:18:15.9817 (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: n+6tbmkcwCPsTW0oiKO7mC9luvKo89+VWLjJFkUbDIRY3icqIhkA3smeoKk3NnwPbstLE81pdfWU4UJtBqQN5yqiQWZBlGG6nXyOLiktjnP8ECagjse5U+G8Vdx0EdMV X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7895 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_161820_199627_76EFEA30 X-CRM114-Status: GOOD ( 10.85 ) 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 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index e781c8d56a9a..c846faec177b 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -173,8 +173,8 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, assert(!dso__kernel(dso)); map__init(result, start, start + len, pgoff, dso, prot, flags); - if (anon || no_dso) { - map->mapping_type = MAPPING_TYPE__IDENTITY; + if (anon || no_dso || dso__is_pie(dso)) { + map__set_mapping_type(map, MAPPING_TYPE__IDENTITY); /* * Set memory without DSO as loaded. All map__find_*