| 1 | //go:build ignore |
| 2 | |
| 3 | #include <linux/bpf.h> |
| 4 | #include <bpf/bpf_helpers.h> |
| 5 | |
| 6 | // Remove when toolchain Docker image ships with 5.13+ headers. |
| 7 | #define __hidden __attribute__((visibility("hidden"))) |
| 8 | |
| 9 | // variables_const { |
| 10 | volatile const __u32 const_u32; |
| 11 | |
| 12 | SEC("socket") int const_example() { |
| 13 | return const_u32; |
| 14 | } |
| 15 | // } |
| 16 | |
| 17 | // variables_global { |
| 18 | volatile __u16 global_u16; |
| 19 | |
| 20 | SEC("socket") int global_example() { |
| 21 | global_u16++; |
| 22 | return global_u16; |
| 23 | } |
| 24 | // } |
| 25 | |
| 26 | // variables_hidden { |
| 27 | __hidden __u64 hidden_var; |
| 28 | |
| 29 | SEC("socket") int hidden_example() { |
| 30 | hidden_var++; |
| 31 | return hidden_var; |
| 32 | } |
| 33 | // } |