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