blob: 73210aacb4ae51894f5cf8b64ab77e736e5e4069 (
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
|
// SPDX-License-Identifier: GPL-2.0
/*
* A reference which only exists in the patched build. The symbol has no twin
* in the original object, so what klp diff may do with it depends entirely on
* whether Module.symvers says it is exported, and by what.
*/
static const char __modinfo[]
__attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";
extern int newly_referenced(int x);
/*
* A reference both builds have. When Module.symvers says a module exports
* this one, the original already depends on that module, which is what makes
* a new reference to it safe -- the loader will not let the patched module
* load without it. EXISTING_DEP leaves it out, for the case where there is
* no such dependency to inherit.
*/
extern int existing_dep(int x);
int target(int x)
{
#ifdef EXISTING_DEP
int base = existing_dep(x);
#else
int base = x;
#endif
#ifdef PATCHED
return newly_referenced(base);
#else
return base + 1;
#endif
}
|