Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /* Copyright (c) 2021 Facebook */
0003 
0004 #include <linux/bpf.h>
0005 #include <bpf/bpf_helpers.h>
0006 
0007 /* 4-byte aligned .data */
0008 static volatile int static_var1 = 5;
0009 static volatile int static_var2 = 6;
0010 int var2 = -1;
0011 /* 8-byte aligned .rodata */
0012 const volatile long rovar2;
0013 
0014 /* same "subprog" name in both files */
0015 static __noinline int subprog(int x)
0016 {
0017     /* but different formula */
0018     return x * 3;
0019 }
0020 
0021 SEC("raw_tp/sys_enter")
0022 int handler2(const void *ctx)
0023 {
0024     var2 = subprog(rovar2) + static_var1 + static_var2;
0025 
0026     return 0;
0027 }
0028 
0029 /* different name and/or type of the variable doesn't matter */
0030 char _license[] SEC("license") = "GPL";
0031 int _version SEC("version") = 1;