summaryrefslogtreecommitdiff
path: root/tools/objtool/tests/generic/fixtures/new_function.c
blob: e7886eaaff3efb3ae922c2b6873b8ecede2b596d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: GPL-2.0
/* Function introduced by the patch.  noinline keeps it from being folded. */

static const char __modinfo[]
	__attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";

#ifdef PATCHED
static __attribute__((noinline)) int klp_new_helper(int x)
{
	return x * 7;
}
#endif

int target(int x)
{
#ifdef PATCHED
	return klp_new_helper(x);
#else
	return x;
#endif
}