https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107983
Bug ID: 107983 Summary: btf: bad call relo against 'test_task_acquire_release_current' in section 'tp_btf/task_newtask' Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: james.hilliard1 at gmail dot com Target Milestone: --- I'm seeing this failure in GCC which does not occur with LLVM: $ /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool --debug gen skeleton /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/task_kfunc_success.bpf.linked3.o name task_kfunc_success libbpf: loading object 'task_kfunc_success' from buffer libbpf: elf: section(2) .symtab, size 600, link 1, flags 0, type=2 libbpf: elf: section(3) .data, size 0, link 0, flags 3, type=1 libbpf: elf: skipping section(3) .data (size 0) libbpf: elf: section(4) .bss, size 8, link 0, flags 3, type=8 libbpf: elf: section(5) tp_btf/task_newtask, size 2704, link 0, flags 6, type=1 libbpf: sec 'tp_btf/task_newtask': found program 'test_task_acquire_release_argument' at insn offset 0 (0 bytes), code size 13 insns (104 bytes) libbpf: sec 'tp_btf/task_newtask': found program 'test_task_acquire_release_current' at insn offset 13 (104 bytes), code size 13 insns (104 bytes) libbpf: sec 'tp_btf/task_newtask': found program 'test_task_acquire_leave_in_map' at insn offset 26 (208 bytes), code size 56 insns (448 bytes) libbpf: sec 'tp_btf/task_newtask': found program 'test_task_xchg_release' at insn offset 82 (656 bytes), code size 88 insns (704 bytes) libbpf: sec 'tp_btf/task_newtask': found program 'test_task_get_release' at insn offset 170 (1360 bytes), code size 86 insns (688 bytes) libbpf: sec 'tp_btf/task_newtask': found program 'test_task_current_acquire_release' at insn offset 256 (2048 bytes), code size 3 insns (24 bytes) libbpf: sec 'tp_btf/task_newtask': found program 'test_task_from_pid_arg' at insn offset 259 (2072 bytes), code size 26 insns (208 bytes) libbpf: sec 'tp_btf/task_newtask': found program 'test_task_from_pid_current' at insn offset 285 (2280 bytes), code size 26 insns (208 bytes) libbpf: sec 'tp_btf/task_newtask': found program 'test_task_from_pid_invalid' at insn offset 311 (2488 bytes), code size 27 insns (216 bytes) libbpf: elf: section(6) license, size 4, link 0, flags 3, type=1 libbpf: license of task_kfunc_success is GPL libbpf: elf: section(7) .maps, size 32, link 0, flags 3, type=1 libbpf: elf: section(8) .comment, size 43, link 0, flags 30, type=1 libbpf: elf: skipping unrecognized data section(8) .comment libbpf: elf: section(9) .reltp_btf/task_newtask, size 864, link 2, flags 40, type=9 libbpf: elf: section(10) .BTF, size 469313, link 0, flags 0, type=1 libbpf: looking for externs among 25 symbols... libbpf: collected 4 externs total libbpf: extern (ksym) #0: symbol 10, name bpf_task_acquire libbpf: extern (ksym) #1: symbol 21, name bpf_task_from_pid libbpf: extern (ksym) #2: symbol 18, name bpf_task_kptr_get libbpf: extern (ksym) #3: symbol 11, name bpf_task_release libbpf: map '__tasks_kfunc_map': at sec_idx 7, offset 0. libbpf: map '__tasks_kfunc_map': found type = 1. libbpf: map '__tasks_kfunc_map': found key [15], sz = 4. libbpf: map '__tasks_kfunc_map': found value [6621], sz = 8. libbpf: map '__tasks_kfunc_map': found max_entries = 1. libbpf: map 'task_kfu.bss' (global data): at sec_idx 4, offset 0, flags 400. libbpf: map 1 is "task_kfu.bss" libbpf: sec '.reltp_btf/task_newtask': collecting relocation for section(5) 'tp_btf/task_newtask' libbpf: sec '.reltp_btf/task_newtask': relo #0: insn #2 against 'pid' libbpf: prog 'test_task_acquire_release_argument': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 2 libbpf: sec '.reltp_btf/task_newtask': relo #1: insn #8 against 'bpf_task_acquire' libbpf: prog 'test_task_acquire_release_argument': found extern #0 'bpf_task_acquire' (sym 10) for insn #8 libbpf: sec '.reltp_btf/task_newtask': relo #2: insn #10 against 'bpf_task_release' libbpf: prog 'test_task_acquire_release_argument': found extern #3 'bpf_task_release' (sym 11) for insn #10 libbpf: sec '.reltp_btf/task_newtask': relo #3: insn #14 against 'pid' libbpf: prog 'test_task_acquire_release_current': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 1 libbpf: sec '.reltp_btf/task_newtask': relo #4: insn #21 against 'bpf_task_acquire' libbpf: prog 'test_task_acquire_release_current': found extern #0 'bpf_task_acquire' (sym 10) for insn #8 libbpf: sec '.reltp_btf/task_newtask': relo #5: insn #23 against 'bpf_task_release' libbpf: prog 'test_task_acquire_release_current': found extern #3 'bpf_task_release' (sym 11) for insn #10 libbpf: sec '.reltp_btf/task_newtask': relo #6: insn #28 against 'pid' libbpf: prog 'test_task_acquire_leave_in_map': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 2 libbpf: sec '.reltp_btf/task_newtask': relo #7: insn #48 against '__tasks_kfunc_map' libbpf: prog 'test_task_acquire_leave_in_map': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #22 libbpf: sec '.reltp_btf/task_newtask': relo #8: insn #54 against '__tasks_kfunc_map' libbpf: prog 'test_task_acquire_leave_in_map': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #28 libbpf: sec '.reltp_btf/task_newtask': relo #9: insn #60 against 'bpf_task_acquire' libbpf: prog 'test_task_acquire_leave_in_map': found extern #0 'bpf_task_acquire' (sym 10) for insn #34 libbpf: sec '.reltp_btf/task_newtask': relo #10: insn #66 against 'bpf_task_release' libbpf: prog 'test_task_acquire_leave_in_map': found extern #3 'bpf_task_release' (sym 11) for insn #40 libbpf: sec '.reltp_btf/task_newtask': relo #11: insn #71 against 'err' libbpf: prog 'test_task_acquire_leave_in_map': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 45 libbpf: sec '.reltp_btf/task_newtask': relo #12: insn #78 against '__tasks_kfunc_map' libbpf: prog 'test_task_acquire_leave_in_map': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #52 libbpf: sec '.reltp_btf/task_newtask': relo #13: insn #84 against 'pid' libbpf: prog 'test_task_xchg_release': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 2 libbpf: sec '.reltp_btf/task_newtask': relo #14: insn #106 against '__tasks_kfunc_map' libbpf: prog 'test_task_xchg_release': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #24 libbpf: sec '.reltp_btf/task_newtask': relo #15: insn #112 against '__tasks_kfunc_map' libbpf: prog 'test_task_xchg_release': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #30 libbpf: sec '.reltp_btf/task_newtask': relo #16: insn #118 against 'bpf_task_acquire' libbpf: prog 'test_task_xchg_release': found extern #0 'bpf_task_acquire' (sym 10) for insn #36 libbpf: sec '.reltp_btf/task_newtask': relo #17: insn #130 against '__tasks_kfunc_map' libbpf: prog 'test_task_xchg_release': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #48 libbpf: sec '.reltp_btf/task_newtask': relo #18: insn #139 against 'bpf_task_release' libbpf: prog 'test_task_xchg_release': found extern #3 'bpf_task_release' (sym 11) for insn #57 libbpf: sec '.reltp_btf/task_newtask': relo #19: insn #145 against 'err' libbpf: prog 'test_task_xchg_release': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 63 libbpf: sec '.reltp_btf/task_newtask': relo #20: insn #150 against 'err' libbpf: prog 'test_task_xchg_release': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 68 libbpf: sec '.reltp_btf/task_newtask': relo #21: insn #157 against 'err' libbpf: prog 'test_task_xchg_release': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 75 libbpf: sec '.reltp_btf/task_newtask': relo #22: insn #162 against 'bpf_task_release' libbpf: prog 'test_task_xchg_release': found extern #3 'bpf_task_release' (sym 11) for insn #80 libbpf: sec '.reltp_btf/task_newtask': relo #23: insn #166 against '__tasks_kfunc_map' libbpf: prog 'test_task_xchg_release': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #84 libbpf: sec '.reltp_btf/task_newtask': relo #24: insn #172 against 'pid' libbpf: prog 'test_task_get_release': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 2 libbpf: sec '.reltp_btf/task_newtask': relo #25: insn #194 against '__tasks_kfunc_map' libbpf: prog 'test_task_get_release': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #24 libbpf: sec '.reltp_btf/task_newtask': relo #26: insn #200 against '__tasks_kfunc_map' libbpf: prog 'test_task_get_release': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #30 libbpf: sec '.reltp_btf/task_newtask': relo #27: insn #206 against 'bpf_task_acquire' libbpf: prog 'test_task_get_release': found extern #0 'bpf_task_acquire' (sym 10) for insn #36 libbpf: sec '.reltp_btf/task_newtask': relo #28: insn #217 against '__tasks_kfunc_map' libbpf: prog 'test_task_get_release': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #47 libbpf: sec '.reltp_btf/task_newtask': relo #29: insn #222 against 'bpf_task_kptr_get' libbpf: prog 'test_task_get_release': found extern #2 'bpf_task_kptr_get' (sym 18) for insn #52 libbpf: sec '.reltp_btf/task_newtask': relo #30: insn #225 against 'bpf_task_release' libbpf: prog 'test_task_get_release': found extern #3 'bpf_task_release' (sym 11) for insn #55 libbpf: sec '.reltp_btf/task_newtask': relo #31: insn #231 against 'err' libbpf: prog 'test_task_get_release': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 61 libbpf: sec '.reltp_btf/task_newtask': relo #32: insn #236 against 'err' libbpf: prog 'test_task_get_release': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 66 libbpf: sec '.reltp_btf/task_newtask': relo #33: insn #243 against 'err' libbpf: prog 'test_task_get_release': found data map 1 (task_kfu.bss, sec 4, off 0) for insn 73 libbpf: sec '.reltp_btf/task_newtask': relo #34: insn #248 against 'bpf_task_release' libbpf: prog 'test_task_get_release': found extern #3 'bpf_task_release' (sym 11) for insn #78 libbpf: sec '.reltp_btf/task_newtask': relo #35: insn #252 against '__tasks_kfunc_map' libbpf: prog 'test_task_get_release': found map 0 (__tasks_kfunc_map, sec 7, off 0) for insn #82 libbpf: sec '.reltp_btf/task_newtask': relo #36: insn #256 against 'test_task_acquire_release_current' libbpf: prog 'test_task_current_acquire_release': bad call relo against 'test_task_acquire_release_current' in section 'tp_btf/task_newtask' Error: failed to open BPF object file: Relocation failed GCC BTF Dump attached