public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "james.hilliard1 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/106773] libbpf: failed to find BTF info for global/extern symbol 'bpf_link_fops'
Date: Mon, 05 Dec 2022 19:01:02 +0000	[thread overview]
Message-ID: <bug-106773-4-nS5gX4i0lg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106773-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #14 from James Hilliard <james.hilliard1 at gmail dot com> ---
(In reply to David Faust from comment #13)
> Created attachment 54017 [details]
> DATASEC entries for extern funcs
> 
> Applies on top of 54002: updated patch
> Adds emission of DATASEC entries for extern funcs. Rough, needs cleanup.

Seeing a regression in get_func_ip_test.c looks like:
$ /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool
--debug gen object
/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/get_func_ip_test.bpf.linked1.o
/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/get_func_ip_test.bpf.o
libbpf: linker: adding object file
'/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/get_func_ip_test.bpf.o'...
libbpf: Invalid BTF total size: 25303
libbpf: failed to parse .BTF from
/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/get_func_ip_test.bpf.o:
-22
Error: failed to link
'/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/get_func_ip_test.bpf.o':
Invalid argument (22)

Broken GCC BTF dump:
$ /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool
--debug btf dump file
/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/get_func_ip_test.bpf.o
format raw
libbpf: Invalid BTF total size: 25303
Error: failed to load BTF from
/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/get_func_ip_test.bpf.o:
Invalid argument

Working LLVM btf dump:
$ /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool
--debug btf dump file
/home/buildroot/bpf-next/tools/testing/selftests/bpf/get_func_ip_test.bpf.o
format raw
[1] FUNC_PROTO '(anon)' ret_type_id=2 vlen=0
[2] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED
[3] FUNC 'unused' type_id=1 linkage=global
[4] PTR '(anon)' type_id=5
[5] INT 'unsigned long long' size=8 bits_offset=0 nr_bits=64 encoding=(none)
[6] FUNC_PROTO '(anon)' ret_type_id=2 vlen=1
        'ctx' type_id=4
[7] FUNC 'test1' type_id=6 linkage=global
[8] FUNC_PROTO '(anon)' ret_type_id=2 vlen=1
        'ctx' type_id=4
[9] FUNC 'test2' type_id=8 linkage=global
[10] PTR '(anon)' type_id=11
[11] FWD 'pt_regs' fwd_kind=struct
[12] FUNC_PROTO '(anon)' ret_type_id=2 vlen=1
        'ctx' type_id=10
[13] FUNC 'test3' type_id=12 linkage=global
[14] FUNC_PROTO '(anon)' ret_type_id=2 vlen=1
        'ctx' type_id=10
[15] FUNC 'test4' type_id=14 linkage=global
[16] FUNC_PROTO '(anon)' ret_type_id=2 vlen=1
        'ctx' type_id=4
[17] FUNC 'test5' type_id=16 linkage=global
[18] FUNC_PROTO '(anon)' ret_type_id=2 vlen=1
        'ctx' type_id=10
[19] FUNC 'test6' type_id=18 linkage=global
[20] INT 'char' size=1 bits_offset=0 nr_bits=8 encoding=SIGNED
[21] ARRAY '(anon)' type_id=20 index_type_id=22 nr_elems=4
[22] INT '__ARRAY_SIZE_TYPE__' size=4 bits_offset=0 nr_bits=32 encoding=(none)
[23] VAR '_license' type_id=21, linkage=global
[24] INT '_Bool' size=1 bits_offset=0 nr_bits=8 encoding=BOOL
[25] VAR 'CONFIG_X86_KERNEL_IBT' type_id=24, linkage=extern
[26] TYPEDEF '__u64' type_id=5
[27] VAR 'test1_result' type_id=26, linkage=global
[28] VAR 'test2_result' type_id=26, linkage=global
[29] VAR 'test3_result' type_id=26, linkage=global
[30] CONST '(anon)' type_id=0
[31] VAR 'bpf_fentry_test3' type_id=30, linkage=extern
[32] VAR 'test4_result' type_id=26, linkage=global
[33] VAR 'test5_result' type_id=26, linkage=global
[34] VAR 'test6_result' type_id=26, linkage=global
[35] VAR 'bpf_fentry_test1' type_id=30, linkage=extern
[36] VAR 'bpf_fentry_test2' type_id=30, linkage=extern
[37] VAR 'bpf_fentry_test4' type_id=30, linkage=extern
[38] VAR 'bpf_modify_return_test' type_id=30, linkage=extern
[39] DATASEC '.bss' size=0 vlen=6
        type_id=27 offset=0 size=8 (VAR 'test1_result')
        type_id=28 offset=0 size=8 (VAR 'test2_result')
        type_id=29 offset=0 size=8 (VAR 'test3_result')
        type_id=32 offset=0 size=8 (VAR 'test4_result')
        type_id=33 offset=0 size=8 (VAR 'test5_result')
        type_id=34 offset=0 size=8 (VAR 'test6_result')
[40] DATASEC '.kconfig' size=0 vlen=1
        type_id=25 offset=0 size=1 (VAR 'CONFIG_X86_KERNEL_IBT')
[41] DATASEC '.ksyms' size=0 vlen=5
        type_id=31 offset=0 size=1 (VAR 'bpf_fentry_test3')
        type_id=35 offset=0 size=1 (VAR 'bpf_fentry_test1')
        type_id=36 offset=0 size=1 (VAR 'bpf_fentry_test2')
        type_id=37 offset=0 size=1 (VAR 'bpf_fentry_test4')
        type_id=38 offset=0 size=1 (VAR 'bpf_modify_return_test')
[42] DATASEC 'license' size=0 vlen=1
        type_id=23 offset=0 size=4 (VAR '_license')

  parent reply	other threads:[~2022-12-05 19:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 22:07 [Bug c/106773] New: " james.hilliard1 at gmail dot com
2022-09-01 20:31 ` [Bug target/106773] " james.hilliard1 at gmail dot com
2022-09-01 22:33 ` james.hilliard1 at gmail dot com
2022-11-29  0:44 ` david.faust at oracle dot com
2022-11-30 21:20 ` david.faust at oracle dot com
2022-12-01  0:04 ` james.hilliard1 at gmail dot com
2022-12-01  0:12 ` james.hilliard1 at gmail dot com
2022-12-01  2:07 ` james.hilliard1 at gmail dot com
2022-12-01 17:09 ` david.faust at oracle dot com
2022-12-01 21:49 ` david.faust at oracle dot com
2022-12-01 22:09 ` james.hilliard1 at gmail dot com
2022-12-01 22:11 ` james.hilliard1 at gmail dot com
2022-12-01 22:30 ` james.hilliard1 at gmail dot com
2022-12-05 17:42 ` david.faust at oracle dot com
2022-12-05 19:01 ` james.hilliard1 at gmail dot com [this message]
2022-12-05 21:06 ` david.faust at oracle dot com
2022-12-05 21:57 ` james.hilliard1 at gmail dot com
2022-12-14 18:25 ` cvs-commit at gcc dot gnu.org
2022-12-14 18:25 ` cvs-commit at gcc dot gnu.org
2022-12-14 18:26 ` cvs-commit at gcc dot gnu.org
2023-01-06 14:18 ` jemarch at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106773-4-nS5gX4i0lg@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).