| Message ID | 20250908162313.343213-1-serhei@serhei.io |
|---|---|
| State | Committed |
| Delegated to: | Mark Wielaard |
| Headers |
Return-Path: <elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7BE4F3858D1E for <patchwork@sourceware.org>; Mon, 8 Sep 2025 16:23:46 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) by sourceware.org (Postfix) with ESMTPS id 52C5C3858D1E for <elfutils-devel@sourceware.org>; Mon, 8 Sep 2025 16:23:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52C5C3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=serhei.io Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=serhei.io ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 52C5C3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=103.168.172.147 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757348617; cv=none; b=qtgkiiBpLUmAx3UWfDH35vN13qywm+Wt4GhEKLFDRAr7B2UNI/GUw0tEw9BjI38OVB6A6Pk9qRjzA0T6i2g2lHiGr7KH5ZcfmBGuIxARtRzBbf0qrjfPB9Rd9LnC3UWlrpR4DHAeSdf3JkNAHY6xomOOVZnwD5A4TyjyrVMpJBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757348617; c=relaxed/simple; bh=Om6Igo61QeCDo2V50hHNRVYV5lBwSXfN60rD8/605dc=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=pziozr3NPYvH3PypZKjHRjhG3luMUCIV8XMcZynWHMXnDu1faagrWTxWaIVWqcOmrPAKEMxz7TEB0dmmH3+j5qvs8ltUgasgs/q3KGms2nFq3de+mu6zI+7aOPc5UqWAtlxnI3j6DoXKZ4q6y8KPn2YkOKBJ6ttV9okFFC1+J9M= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id D0C97EC0067; Mon, 8 Sep 2025 12:23:35 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Mon, 08 Sep 2025 12:23:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=serhei.io; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm1; t=1757348615; x=1757435015; bh=+QFZuIFTsT9CUBRSJUeHU WZbul6NBaxBgBOXhH4ik1s=; b=MAjXilkpX2Rl87r4XJ4HEKJLhx4WM85rQxJAf 7u/eHWWXz1/dyfSHVLD5/8Uy98GnzIBP57Z7FdB256qKkwiWdbweAYtl7OQWPwKB 7ryxnI60IrCAebILW641Yk7PhoqidXHevyG1/HTEBZ20H8UmtyEwxq/caIr+tDNe pcNcA2IkTr/vWFV23HWNVeJ+e4XrMwX3FvgRwh7FhJSWOimFSkP9Z92PNgmMQQd3 xpIkW8ql+kMumY+lMi0nA3ptE2+sqrITc/Co3NXOQRkna11c5vQuH/w0isDYHaMi ZQ/vSLo2gJ8OC6hjOxB0wriyYFhN/cFoRmSudrQbsG32xXxNA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1757348615; x=1757435015; bh=+QFZuIFTsT9CUBRSJUeHUWZbul6NBaxBgBO XhH4ik1s=; b=PUX/RNg+1imx2G2nv6kGJAHmE+7G/5XhFAkMI7ebjmwuIcGf8BZ KgbpWN8Cp/b3wTwOuYLK3eUxG2TTnx4Ui4X0eHT0b3KWLi1iAKY7tBMjSXPHYdvv JbJr655kCLg/1OtJokBBDuCbMynfa1PhAXklyPM9BDQZ89Xv5iMlcLeX0mmccIjT eSXi+Ndwrcu7tncRKSobyrIQLD/B9IkYubxOElvi3Vf9ArdXyBS41mf2g5bQZXDL y3n3+W0fP7u/60ifn9FOkZ93fpZ0Wm1Zqxx+BreiofXTP4BCnCiNYRReHexLxs9B +6Ibv4orBxMvaMm3grbCt6T9uBlAnidixqg== X-ME-Sender: <xms:BwO_aF4tw9HVQob6BdsrjuiuyVLqzWpJqm9dzaSrbzHTIvFrVTR1eQ> <xme:BwO_aILOgxDr5JyPZ9t5d0Ux2B87nyfD06jb8XXvt1G4CVke4bzRH6FhX-Ra64pm- l0V8QdgZDIloen38w> X-ME-Received: <xmr:BwO_aOJYE2gSVzi_RUrtJuRFkz4E79y1gDeonEf0p7MXlI-Dd3258Ro2m2rEIEAICARbZQ_BCrSzWnsRh87sDQ> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddukedttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgggfestdekredtredttd enucfhrhhomhepufgvrhhhvghiucforghkrghrohhvuceoshgvrhhhvghisehsvghrhhgv ihdrihhoqeenucggtffrrghtthgvrhhnpeehvdffffevkeeugfdvlefhleeivdejkeffve eifeeltdfgudeifefgleetgfeufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehsvghrhhgvihesshgvrhhhvghirdhiohdpnhgspghrtghpth htohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvghlfhhuthhilhhsqdgu vghvvghlsehsohhurhgtvgifrghrvgdrohhrghdprhgtphhtthhopehsvghrhhgvihessh gvrhhhvghirdhioh X-ME-Proxy: <xmx:BwO_aGXauNI60qII6BQSzo4hC4C-X4oQPSjoPlp0iGndJ8OD5Sloxw> <xmx:BwO_aAgE4t8QmX0CGYH3dzDn7I2ZzWfRdp1KMn0KmXPZFcsjt_7u4w> <xmx:BwO_aB9lAfQLC5-830zxyTDJT7c19mLnHI9OA3FcercIO3HHp2-EDA> <xmx:BwO_aKDTnd2wpBpM_4WL71bFLiPXZsh8cgtmwW3jXN-HpIQ7EePmUw> <xmx:BwO_aM6lsthPcYRRnYNlhX_MR3B4ANHLaYbqaLuMwTJbmmLqMbDJWbhN> Feedback-ID: i572946fc:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 Sep 2025 12:23:35 -0400 (EDT) From: Serhei Makarov <serhei@serhei.io> To: elfutils-devel@sourceware.org Cc: Serhei Makarov <serhei@serhei.io> Subject: [PATCH] libdwfl_stacktrace: fix non-Linux build dep on PERF_SAMPLE_REGS_ABI Date: Mon, 8 Sep 2025 12:23:13 -0400 Message-ID: <20250908162313.343213-1-serhei@serhei.io> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Post: <mailto:elfutils-devel@sourceware.org> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
libdwfl_stacktrace: fix non-Linux build dep on PERF_SAMPLE_REGS_ABI
|
|
Commit Message
Serhei Makarov
Sept. 8, 2025, 4:23 p.m. UTC
Reported on a GNU Hurd build of elfutils. This is a quick fix pending my more complex patch to reduce dependency on linux perf concepts for the libdwfl_stacktrace code. * libdwfl_stacktrace/dwflst_perf_frame.c (perf_sample_regs_abi): Define this Linux enum on non-Linux platforms. --- libdwfl_stacktrace/dwflst_perf_frame.c | 7 +++++++ 1 file changed, 7 insertions(+)
Comments
Hi Serhei, On Mon, 2025-09-08 at 12:23 -0400, Serhei Makarov wrote: > Reported on a GNU Hurd build of elfutils. This is a quick fix pending > my more complex patch to reduce dependency on linux perf concepts for > the libdwfl_stacktrace code. > > * libdwfl_stacktrace/dwflst_perf_frame.c (perf_sample_regs_abi): > Define this Linux enum on non-Linux platforms. > --- > libdwfl_stacktrace/dwflst_perf_frame.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/libdwfl_stacktrace/dwflst_perf_frame.c b/libdwfl_stacktrace/dwflst_perf_frame.c > index dc274e8e..4fc60183 100644 > --- a/libdwfl_stacktrace/dwflst_perf_frame.c > +++ b/libdwfl_stacktrace/dwflst_perf_frame.c > @@ -32,6 +32,13 @@ > > #if defined(__linux__) > # include <linux/perf_event.h> > +#else > +/* XXX required by copy_word() below */ > +enum perf_sample_regs_abi { > + PERF_SAMPLE_REGS_ABI_NONE = 0, > + PERF_SAMPLE_REGS_ABI_32 = 1, > + PERF_SAMPLE_REGS_ABI_64 = 2, > +}; > #endif > > #include "libdwfl_stacktraceP.h" Yeah, that is the simplest fix for now. Lets just go with it. Could you also take a peek at the Debian workaround for dealing with arches that don't support perf? https://salsa.debian.org/toolchain-team/elfutils/-/commit/2cd08fdcfcaf15d6a2b7b085faedadfc94a4729c I am not sure just listing all the arches that don't support perf is really the way to go. But maybe it is the best there is? Cheers, Mark
On Mon, Sep 8, 2025, at 1:38 PM, Mark Wielaard wrote: > Yeah, that is the simplest fix for now. Lets just go with it. Somewhat delayed, but I've cherry-picked the fix onto main branch. > Could you also take a peek at the Debian workaround for dealing with > arches that don't support perf? > https://salsa.debian.org/toolchain-team/elfutils/-/commit/2cd08fdcfcaf15d6a2b7b085faedadfc94a4729c > I am not sure just listing all the arches that don't support perf is > really the way to go. But maybe it is the best there is? The other option is to keep the definition restricted to _linux_ and x86 / x86_64 (the arches where perf register handling is implemented), then extend the list of arches as we implement support for other arches.
Hi Serhei, On Mon, 2025-10-20 at 14:04 -0400, Serhei Makarov wrote: > On Mon, Sep 8, 2025, at 1:38 PM, Mark Wielaard wrote: > > > Could you also take a peek at the Debian workaround for dealing with > > arches that don't support perf? > > https://salsa.debian.org/toolchain-team/elfutils/-/commit/2cd08fdcfcaf15d6a2b7b085faedadfc94a4729c > > I am not sure just listing all the arches that don't support perf is > > really the way to go. But maybe it is the best there is? > > > The other option is to keep the definition restricted to _linux_ and x86 / x86_64 (the arches where perf register handling is implemented), then extend the list of arches as we implement support for other arches. Yes, that seems a better way forward. Or maybe it could even be a configure set HAVE_PERF_REGS? Thanks, Mark
On Tue, Oct 21, 2025, at 7:21 AM, Mark Wielaard wrote: > Yes, that seems a better way forward. > Or maybe it could even be a configure set HAVE_PERF_REGS? Oh, wait, we've fixed it in commit d05241ce69: https://sourceware.org/cgit/elfutils/commit/?id=d05241ce690018548857199bd34d7734c7164679 The debian fix was done over top of 0.193, which doesn't include this patch. So there's nothing to be done here at the moment. When adding non-x86 support (?November) I expect to tidy the existing configury and add HAVE_PERF_REGS option as you suggest. All the best, Serhei
On Tue, Oct 21, 2025 at 12:28:53PM -0400, Serhei Makarov wrote: > > > On Tue, Oct 21, 2025, at 7:21 AM, Mark Wielaard wrote: > > Yes, that seems a better way forward. > > Or maybe it could even be a configure set HAVE_PERF_REGS? > Oh, wait, we've fixed it in commit d05241ce69: > https://sourceware.org/cgit/elfutils/commit/?id=d05241ce690018548857199bd34d7734c7164679 > > The debian fix was done over top of 0.193, which doesn't include this patch. > > So there's nothing to be done here at the moment. When adding non-x86 support (?November) I expect to tidy the existing configury and add HAVE_PERF_REGS option as you suggest. Adding Matthias Klose to the CC. He apparently still needs a patch to disable some arches: https://salsa.debian.org/toolchain-team/elfutils/-/blob/master/debian/patches/perf_regs.diff?ref_type=heads I am not sure what is going on there. Is the current patch not working correctly? The intention is to only try to include/support asm/perf_regs.h on linux for i686 and x86_64 arches. Cheers, Mark
On Thu, Oct 30, 2025, at 7:00 AM, Mark Wielaard wrote: > I am not sure what is going on there. Is the current patch not working > correctly? The intention is to only try to include/support > asm/perf_regs.h on linux for i686 and x86_64 arches. Perhaps we have been assuming incorrectly, and some of these debian targets define *both* __sparc__ and __x86_64__? Then they don't provide the perf_regs.h? It may be necessary to go with our alternate plan of adding configury item, to remove all ambiguity. I'll author a patch.
diff --git a/libdwfl_stacktrace/dwflst_perf_frame.c b/libdwfl_stacktrace/dwflst_perf_frame.c index dc274e8e..4fc60183 100644 --- a/libdwfl_stacktrace/dwflst_perf_frame.c +++ b/libdwfl_stacktrace/dwflst_perf_frame.c @@ -32,6 +32,13 @@ #if defined(__linux__) # include <linux/perf_event.h> +#else +/* XXX required by copy_word() below */ +enum perf_sample_regs_abi { + PERF_SAMPLE_REGS_ABI_NONE = 0, + PERF_SAMPLE_REGS_ABI_32 = 1, + PERF_SAMPLE_REGS_ABI_64 = 2, +}; #endif #include "libdwfl_stacktraceP.h"