xref: /linux/tools/objtool/tests/generic/fixtures/new_function.c (revision 14c897740388216acd59477a382de327d5e27ba4)
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
8 static __attribute__((noinline)) int klp_new_helper(int x)
9 {
10 	return x * 7;
11 }
12 #endif
13 
14 int target(int x)
15 {
16 #ifdef PATCHED
17 	return klp_new_helper(x);
18 #else
19 	return x;
20 #endif
21 }
22