xref: /linux/tools/testing/selftests/bpf/progs/test_subskeleton.c (revision dec1c62e91ba268ab2a6e339d4d7a59287d5eba1)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) Meta Platforms, Inc. and affiliates. */
3 
4 #include <stdbool.h>
5 #include <linux/bpf.h>
6 #include <bpf/bpf_helpers.h>
7 
8 /* volatile to force a read, compiler may assume 0 otherwise */
9 const volatile int rovar1;
10 int out1;
11 
12 /* Override weak symbol in test_subskeleton_lib */
13 int var5 = 5;
14 
15 extern volatile bool CONFIG_BPF_SYSCALL __kconfig;
16 
17 extern int lib_routine(void);
18 
19 SEC("raw_tp/sys_enter")
20 int handler1(const void *ctx)
21 {
22 	(void) CONFIG_BPF_SYSCALL;
23 
24 	out1 = lib_routine() * rovar1;
25 	return 0;
26 }
27 
28 char LICENSE[] SEC("license") = "GPL";
29