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')