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