1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
3 #include <vmlinux.h>
4 #include <bpf/bpf_helpers.h>
5 #include "../test_kmods/bpf_testmod.h"
6
7 char _license[] SEC("license") = "GPL";
8
9 /*
10 * This subprogram validates that libbpf handles the situation in which BPF
11 * object has subprograms in .text section, but has no entry BPF programs.
12 * At some point that was causing issues due to legacy logic of treating such
13 * subprogram as entry program (with unknown program type, which would fail).
14 */
dangling_subprog(void)15 int dangling_subprog(void)
16 {
17 /* do nothing, just be here */
18 return 0;
19 }
20
21 SEC(".struct_ops.link")
22 struct bpf_testmod_ops testmod_do_detach;
23