From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BA0323858D37; Tue, 5 Dec 2023 23:05:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA0323858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701817508; bh=74GyF3GGFVpG4e2lZcjmwIzoMA8ehy8dW6YKnGPloFU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ufqXx6oU3El8e5BlC/t/Yp/GAps5vbF1USegHZ17GPTti+4j4cy9WGVxyIkH5B4LC NKCPFLJq9dMHuzhAuS+PdWpDpZt5+OJnL1JPxV0F++vWChvE7Ic7WJ5e0UVGj5LwjT r/ShQB1M4Zp0hJ4kQbut7Js2XWbZmGAgRB6D758g= From: "david.faust at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/111735] incorrect BTF representation of forward-declared enums Date: Tue, 05 Dec 2023 23:05:07 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.faust at oracle dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111735 David Faust changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david.faust at oracle dot = com --- Comment #1 from David Faust --- Sorry for the delay, somehow I missed this until now. Confirmed... though this really ought to be further discussed and formalized with the kernel BPF folks. As of now, btf.rst does not specify any representation at all for forward-declared enums. And, it lists in 'encoding requirements' for BTF_KIND_ENUM that 'size' must be one of 1/2/4/8, so in a sense this de-facto representation is not really valid. IMO it would be better to adjust the BTF_KIND_FWD definition to support forward-declared enums. CTF for example encodes the kind of the forward in the 'type' field of its KIND_FWD, which in BTF is simply unused. Anyway, that can be raised for discussion on the bpf list. In the meanwhile, it should not be problematic to adapt GCC to follow clang and pahole in emitting KIND_ENUM with vlen=3D0.=