Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4462516rdb; Mon, 11 Dec 2023 23:06:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IERExINwp7kVVmDdNsLzrtR5JOFYzxnEXACFm6B/DVPzAJqj1cTpcjwaDXUhKw7lsvgSnio X-Received: by 2002:a05:6a20:7344:b0:18f:97c:5b78 with SMTP id v4-20020a056a20734400b0018f097c5b78mr2592695pzc.70.1702364789417; Mon, 11 Dec 2023 23:06:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702364789; cv=none; d=google.com; s=arc-20160816; b=ncyVtMegadcZgMYVPlQZtuoZaVYBNLS4AynUCCuIpA5dX6Q0E417Dpzb7FvMwF5MkM 6/Hqzgg5xjnQzOCdz8Q5e1Zt/9k1tB6elFcOi4PnO0wwGS3JvYDVcjSzF0hpU5RmS8v3 Z9k85X5IHXMweIkdml/t08iZer+rfkXNLQQqmHByJc1fagzgzi1zlt1UZWIeeKxQQ7jX 7wzNkvPHHjMnoFrtPlmJkukFK3ptk9aIqjNDYYE5ISpkOUwtet0y6FwnNrzhQZCCVEOG n+93epIpoowWtf2x3S+UNKUCCjW4DKN8VDQrII+5EuQKckoW3OL7M01EY3g4ECy4vl6h abBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=IxQYxpYcrWIqvC1cKCSYLMPQZtsdrNIv93BxHbphWrs=; fh=j7XGxNx2Lg8u7nyGj/Zu18oEzBtLERie2+5jwGMgLi0=; b=SwWo+ozgaDy+y0j8kT7b3Oazy1riK0IPcSH0Vk8QorJJmigsOxTcB2MN7Qc2wDJAkP 4L67Kg01mnLh3wAXAiABOkOC7HKkYJaBbM4iNMys6VBEX+z7eejSPZQYJFG12G0hnikO QQJ4RbTRBHevjdH5MmQuGvIe13Drur/11IFFSH6xJRrwEJu2X2wOi7hMoa8j5M22IA23 T6nlg8qBaGygat7u+iMvVRg13Of/geE9KlnUg+/gKLxa8cdL0omsQxPxEZgAqyL8yEH4 Ay6FBf4wwWklKiX7/E5Mayp4MujMCus5uYXcchEpbPnujYTD74/qlSKslffjzCCBe4kW 1lzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JgTJApR5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id jn3-20020a170903050300b001cff9cd4d6fsi7131823plb.174.2023.12.11.23.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 23:06:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JgTJApR5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A222E8077569; Mon, 11 Dec 2023 23:06:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbjLLHFq (ORCPT + 99 others); Tue, 12 Dec 2023 02:05:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230266AbjLLHFp (ORCPT ); Tue, 12 Dec 2023 02:05:45 -0500 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B62D5; Mon, 11 Dec 2023 23:05:51 -0800 (PST) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-20307e91258so11220fac.0; Mon, 11 Dec 2023 23:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702364751; x=1702969551; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=IxQYxpYcrWIqvC1cKCSYLMPQZtsdrNIv93BxHbphWrs=; b=JgTJApR5diAcVXCoDKGxz4igZ2fxk6devxE9l9aWilUpCLVEt5hmDACOGpCpuA1Kd7 O1AutN5f6LoIcQFujNmEGDXvHpMkonwiovwiEdVLC/aYmMnjMJe0FQr7K6pC1qGd79Dp lgx03+MTLgyMI+Q2o8SztL+H4dkKuAIKcFkfZintzgqeMyVYmvqyRwE3p1E8Paljh+w3 GhWb9iaUapjrdswi7RROufbt6WRZoNd2DXNPZwKEMNNM+ZAKmGEqgRJJ1tJ2bGd/xr9+ rV2ocCQslbnjJHJo9hJYXHQg4Xt1grGXJempUkLbUKzIL1ddH+MfPRKRGIvYTj8No8yC uUiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702364751; x=1702969551; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IxQYxpYcrWIqvC1cKCSYLMPQZtsdrNIv93BxHbphWrs=; b=m3WwWqyjKreV11kngzPWAvuacOz1oV23+/FcPX09YyBoQCOIuQ6r6eN4Bg360UdPPz sqMMtF7bvM/l6drLA4njJiW/7R+/s7pKD+LsN9kjZ9PUvcrNTw2aGQFoMzr8tN7hf43J pQ/gPIco3ctMAceGJDQbvMfeWmc95Cih/aD6jeD0hY+zuoa/jShRjuIistByJdrUHrFS Pn61a23Bmgo1Tj1wW8Yz31lB/koACLMW4vXPOjdkB0b5LoJXczBA8hbULGA6HTF07Rq2 KXomk/ud3POQahm8PITo/iwzNVSnG1wWoJc08MQT83kziQgPnbTEHCYnPMyZmYOkPWQ/ ofaQ== X-Gm-Message-State: AOJu0YwcRzHYMDojk45mIoQkkjeqa3pgUwcCmQvZkbLQ1VvHreNPFMME QTz6TOyckD9KbcAJ6Q2p5+k= X-Received: by 2002:a05:6870:61d4:b0:1fb:75a:77c1 with SMTP id b20-20020a05687061d400b001fb075a77c1mr5353980oah.114.1702364750851; Mon, 11 Dec 2023 23:05:50 -0800 (PST) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6780:42e0:7da0:5ec4:de63:3cf4]) by smtp.gmail.com with ESMTPSA id g17-20020a056a0023d100b006cb6e83bf7fsm7397491pfc.192.2023.12.11.23.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 23:05:50 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Milian Wolff , Pablo Galindo , Fangrui Song Subject: [PATCH 1/3] perf genelf: Set ELF program header addresses properly Date: Mon, 11 Dec 2023 23:05:44 -0800 Message-ID: <20231212070547.612536-2-namhyung@kernel.org> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20231212070547.612536-1-namhyung@kernel.org> References: <20231212070547.612536-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Dec 2023 23:06:01 -0800 (PST) The text section starts after the ELF headers so PHDR.p_vaddr and others should have the correct addresses. Fixes: babd04386b1d ("perf jit: Include program header in ELF files") Signed-off-by: Namhyung Kim --- tools/perf/util/genelf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index fefc72066c4e..ac17a3cb59dc 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c @@ -293,9 +293,9 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym, */ phdr = elf_newphdr(e, 1); phdr[0].p_type = PT_LOAD; - phdr[0].p_offset = 0; - phdr[0].p_vaddr = 0; - phdr[0].p_paddr = 0; + phdr[0].p_offset = GEN_ELF_TEXT_OFFSET; + phdr[0].p_vaddr = GEN_ELF_TEXT_OFFSET; + phdr[0].p_paddr = GEN_ELF_TEXT_OFFSET; phdr[0].p_filesz = csize; phdr[0].p_memsz = csize; phdr[0].p_flags = PF_X | PF_R; -- 2.43.0.472.g3155946c3a-goog