public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/106263] New: BTF_KIND_FUNC type does not encode linkage
@ 2022-07-11 20:26 ibhagat at gcc dot gnu.org
  2022-08-01 17:46 ` [Bug debug/106263] " cvs-commit at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ibhagat at gcc dot gnu.org @ 2022-07-11 20:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106263

            Bug ID: 106263
           Summary: BTF_KIND_FUNC type does not encode linkage
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ibhagat at gcc dot gnu.org
  Target Milestone: ---

GCC generates BTF_KIND_FUNC with vlen set to 0.  libbpf expects the vlen field
to include the linkage information.

The issue was reported here:

https://lore.kernel.org/bpf/8735fbcv3x.fsf@oracle.com/

Although GCC is currently generating the BTF_KIND_FUNC as per the BTF format
documentation (see excerpt below), this needs to be changed to allow the tools
to work well with each other.

[Source: https://www.kernel.org/doc/Documentation/bpf/btf.rst]

...
2.2.12 BTF_KIND_FUNC
~~~~~~~~~~~~~~~~~~~~

``struct btf_type`` encoding requirement:
  * ``name_off``: offset to a valid C identifier
  * ``info.kind_flag``: 0
  * ``info.kind``: BTF_KIND_FUNC
  * ``info.vlen``: 0
  * ``type``: a BTF_KIND_FUNC_PROTO type
...

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug debug/106263] BTF_KIND_FUNC type does not encode linkage
  2022-07-11 20:26 [Bug debug/106263] New: BTF_KIND_FUNC type does not encode linkage ibhagat at gcc dot gnu.org
@ 2022-08-01 17:46 ` cvs-commit at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-01 17:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106263

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jose E. Marchesi <jemarch@gcc.gnu.org>:

https://gcc.gnu.org/g:32566720f3a9135fa355f0304f024a79f107a1b8

commit r13-1918-g32566720f3a9135fa355f0304f024a79f107a1b8
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date:   Fri Jul 8 18:32:02 2022 +0200

    btf: emit linkage information in BTF_KIND_FUNC entries

    The kernel bpftool expects BTF_KIND_FUNC entries in BTF to include an
    annotation reflecting the linkage of functions (static, global).  For
    whatever reason they abuse the `vlen' field of the BTF_KIND_FUNC entry
    instead of adding a variable-part to the record like it is done with
    other entry kinds.

    This patch makes GCC to include this linkage info in BTF_KIND_FUNC
    entries.

    Tested in bpf-unknown-none target.

    gcc/ChangeLog:

            PR debug/106263
            * ctfc.h (struct ctf_dtdef): Add field linkage.
            * ctfc.cc (ctf_add_function): Set ctti_linkage.
            * dwarf2ctf.cc (gen_ctf_function_type): Pass a linkage for
            function types and subprograms.
            * btfout.cc (btf_asm_func_type): Emit linkage information for the
            function.
            (btf_dtd_emit_preprocess_cb): Propagate the linkage information
            for functions.

    gcc/testsuite/ChangeLog:

            PR debug/106263
            * gcc.dg/debug/btf/btf-function-4.c: New test.
            * gcc.dg/debug/btf/btf-function-5.c: Likewise.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-01 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 20:26 [Bug debug/106263] New: BTF_KIND_FUNC type does not encode linkage ibhagat at gcc dot gnu.org
2022-08-01 17:46 ` [Bug debug/106263] " cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).