blob: fe9f9e6bf44f9e9eedefd3f150edf23fa06bbfe9 (
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
35
36
37
38
39
|
// SPDX-License-Identifier: GPL-2.0
/*
* Two translation units (TU_B selects the second) linked with ThinLTO.
* Importing bump() promotes the file-local counter, renaming it
* counter.llvm.<hash>. The hash is content derived, so it differs between the
* original and patched builds.
*/
#ifdef TU_B
extern int bump(void);
int other_entry(void)
{
return bump() + bump();
}
#else
static const char __modinfo[]
__attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";
static int counter;
int bump(void)
{
return ++counter;
}
int target(void)
{
#ifdef PATCHED
return counter + 1;
#else
return counter;
#endif
}
#endif
|