1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * A function which the patch changes from static to non-static, and a variable 4 * that goes the other way. The names are unchanged; only the binding moves. 5 */ 6 7 static const char __modinfo[] 8 __attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux"; 9 10 /* noinline, or the static one is folded into its caller and has no symbol */ 11 #ifdef PATCHED flipped_up(int x)12__attribute__((noinline)) int flipped_up(int x) /* was static */ 13 #else 14 __attribute__((noinline)) static int flipped_up(int x) 15 #endif 16 { 17 return x + 1; 18 } 19 20 #ifdef PATCHED 21 static volatile int flipped_down = 5; /* was global */ 22 #else 23 volatile int flipped_down = 5; 24 #endif 25 caller(int x)26int caller(int x) 27 { 28 flipped_down += x; 29 #ifdef PATCHED 30 return flipped_up(x) + flipped_down + 2; 31 #else 32 return flipped_up(x) + flipped_down + 1; 33 #endif 34 } 35