summaryrefslogtreecommitdiffstats
path: root/include/asm-generic/codetag.lds.h
blob: 372c320c5043781d8521948dbc316c4422b4c1d2 (plain)
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
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __ASM_GENERIC_CODETAG_LDS_H
#define __ASM_GENERIC_CODETAG_LDS_H

#define SECTION_WITH_BOUNDARIES(_name)	\
	. = ALIGN(8);			\
	__start_##_name = .;		\
	KEEP(*(_name))			\
	__stop_##_name = .;

#define CODETAG_SECTIONS()		\
	SECTION_WITH_BOUNDARIES(alloc_tags)

/*
 * Module codetags which aren't used after module unload, therefore have the
 * same lifespan as the module and can be safely unloaded with the module.
 */
#define MOD_CODETAG_SECTIONS()

#define MOD_SEPARATE_CODETAG_SECTION(_name)	\
	.codetag.##_name : {			\
		SECTION_WITH_BOUNDARIES(_name)	\
	}

/*
 * For codetags which might be used after module unload, therefore might stay
 * longer in memory. Each such codetag type has its own section so that we can
 * unload them individually once unused.
 */
#define MOD_SEPARATE_CODETAG_SECTIONS()		\
	MOD_SEPARATE_CODETAG_SECTION(alloc_tags)

#endif /* __ASM_GENERIC_CODETAG_LDS_H */