[Bug target/106773] libbpf: failed to find BTF info for global/extern symbol 'bpf_link_fops'

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 14 18:25:57 GMT 2022


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

--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Faust <dfaust@gcc.gnu.org>:

https://gcc.gnu.org/g:4f7aa145b796c044526c93f390e68f3b56a1b30a

commit r13-4708-g4f7aa145b796c044526c93f390e68f3b56a1b30a
Author: David Faust <david.faust@oracle.com>
Date:   Wed Dec 7 11:47:26 2022 -0800

    btf: fix 'extern const void' variables [PR106773]

    The eBPF loader expects to find BTF_KIND_VAR records for references to
    extern const void symbols. We were mistakenly identifing these as
    unsupported types, and as a result skipping emitting VAR records for
    them.

    In addition, the internal DWARF representation from which BTF is
    produced does not generate 'const' modifier DIEs for the void type,
    which meant in BTF the 'const' qualifier was dropped for 'extern const
    void' variables. This patch also adds support for generating a const
    void type in BTF to correct emission for these variables.

            PR target/106773

    gcc/

            * btfout.cc (btf_collect_datasec): Correct size of void entries.
            (btf_dvd_emit_preprocess_cb): Do not skip emitting variables which
            refer to void types.
            (btf_init_postprocess): Create 'const void' type record if needed
and
            adjust variables to refer to it as appropriate.

    gcc/testsuite/

            * gcc.dg/debug/btf/btf-pr106773.c: New test.


More information about the Gcc-bugs mailing list