summaryrefslogtreecommitdiff
path: root/tools/objtool/tests/generic/fixtures/special_section_shared.c
blob: f54e24f862c60e743398006341b0e22cc5c1ca3d (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
// SPDX-License-Identifier: GPL-2.0
/* Two functions contribute to one special section; only one is patched. */

static const char __modinfo[]
	__attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";

int other(int x)
{
	asm volatile(
		"2:\n\t"
		".pushsection	.kcfi_traps, \"a\"\n\t"
		".balign	4\n\t"
		".long		2b - .\n\t"
		".popsection\n\t");
	return x * 5;
}

int target(int x)
{
	asm volatile(
		"1:\n\t"
		".pushsection	.kcfi_traps, \"a\"\n\t"
		".balign	4\n\t"
		".long		1b - .\n\t"
		".popsection\n\t");
#ifdef PATCHED
	return x + 2;
#else
	return x + 1;
#endif
}