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