xref: /linux/tools/objtool/tests/generic/fixtures/init_reference.c (revision 5b6dca02b3e2254d2fd5706d76d7ab4610a67296)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Patched function referencing data in an .init section. */
3 
4 static const char __modinfo[]
5 	__attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";
6 
7 /* volatile so the read cannot be folded into a constant, leaving no reference */
8 static volatile int init_only __attribute__((section(".init.data"), used)) = 5;
9 
target(int x)10 int target(int x)
11 {
12 #ifdef PATCHED
13 	return x + init_only + 1;
14 #else
15 	return x + init_only;
16 #endif
17 }
18