xref: /linux/tools/objtool/tests/generic/fixtures/function_removal.c (revision 5b6dca02b3e2254d2fd5706d76d7ab4610a67296)
1*ade23d75SSong Liu // SPDX-License-Identifier: GPL-2.0
2*ade23d75SSong Liu /*
3*ade23d75SSong Liu  * A function the patch deletes, along with its only caller's use of it.  The
4*ade23d75SSong Liu  * original has a symbol which the patched object simply does not, so there is
5*ade23d75SSong Liu  * nothing to correlate it against.
6*ade23d75SSong Liu  */
7*ade23d75SSong Liu 
8*ade23d75SSong Liu static const char __modinfo[]
9*ade23d75SSong Liu 	__attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";
10*ade23d75SSong Liu 
11*ade23d75SSong Liu #ifndef PATCHED
going_away(int x)12*ade23d75SSong Liu int going_away(int x)
13*ade23d75SSong Liu {
14*ade23d75SSong Liu 	return x + 7;
15*ade23d75SSong Liu }
16*ade23d75SSong Liu #endif
17*ade23d75SSong Liu 
caller(int x)18*ade23d75SSong Liu int caller(int x)
19*ade23d75SSong Liu {
20*ade23d75SSong Liu #ifdef PATCHED
21*ade23d75SSong Liu 	return x + 1;
22*ade23d75SSong Liu #else
23*ade23d75SSong Liu 	return going_away(x);
24*ade23d75SSong Liu #endif
25*ade23d75SSong Liu }
26