test_static_linked1.c (619B)
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (c) 2021 Facebook */ 3 4#include <linux/bpf.h> 5#include <bpf/bpf_helpers.h> 6 7/* 8-byte aligned .data */ 8static volatile long static_var1 = 2; 9static volatile int static_var2 = 3; 10int var1 = -1; 11/* 4-byte aligned .rodata */ 12const volatile int rovar1; 13 14/* same "subprog" name in both files */ 15static __noinline int subprog(int x) 16{ 17 /* but different formula */ 18 return x * 2; 19} 20 21SEC("raw_tp/sys_enter") 22int handler1(const void *ctx) 23{ 24 var1 = subprog(rovar1) + static_var1 + static_var2; 25 26 return 0; 27} 28 29char LICENSE[] SEC("license") = "GPL"; 30int VERSION SEC("version") = 1;