projects/linux·blob 5b6dca02 · refs

25 lines · 727 B

1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Compiled twice and partially linked so the result has duplicate locals,
4 * which is what symid_needed() requires. dup_normal is in a live section,
5 * dup_discarded in one the vmlinux link throws away. DISCARDED_SEC selects
6 * which discarded section, since there is more than one and each was its own
7 * bug.
8 */
9
10#ifndef DISCARDED_SEC
11#define DISCARDED_SEC ".exitcall.exit"
12#endif
13
14static const char __modinfo[]
15 __attribute__((section(".modinfo"), used, aligned(1))) = "\0name=vmlinux";
16
17static int dup_normal = 1;
18
19static void *dup_discarded
20 __attribute__((section(DISCARDED_SEC), used)) = &dup_normal;
21
22int FUNC_NAME(void)
23{
24 return dup_normal + (dup_discarded != (void *)0);
25}