xref: /linux/tools/objtool/tests/generic/fixtures/new_function.c (revision 5b6dca02b3e2254d2fd5706d76d7ab4610a67296)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Function introduced by the patch.  noinline keeps it from being folded. */
3 
4 static const char __modinfo[]
5 	__attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";
6 
7 #ifdef PATCHED
klp_new_helper(int x)8 static __attribute__((noinline)) int klp_new_helper(int x)
9 {
10 	return x * 7;
11 }
12 #endif
13 
target(int x)14 int target(int x)
15 {
16 #ifdef PATCHED
17 	return klp_new_helper(x);
18 #else
19 	return x;
20 #endif
21 }
22