xref: /linux/include/asm-generic/codetag.lds.h (revision 7f4f3b14e8079ecde096bd734af10e30d40c27b7)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __ASM_GENERIC_CODETAG_LDS_H
3 #define __ASM_GENERIC_CODETAG_LDS_H
4 
5 #define SECTION_WITH_BOUNDARIES(_name)	\
6 	. = ALIGN(8);			\
7 	__start_##_name = .;		\
8 	KEEP(*(_name))			\
9 	__stop_##_name = .;
10 
11 #define CODETAG_SECTIONS()		\
12 	SECTION_WITH_BOUNDARIES(alloc_tags)
13 
14 /*
15  * Module codetags which aren't used after module unload, therefore have the
16  * same lifespan as the module and can be safely unloaded with the module.
17  */
18 #define MOD_CODETAG_SECTIONS()
19 
20 #define MOD_SEPARATE_CODETAG_SECTION(_name)	\
21 	.codetag.##_name : {			\
22 		SECTION_WITH_BOUNDARIES(_name)	\
23 	}
24 
25 /*
26  * For codetags which might be used after module unload, therefore might stay
27  * longer in memory. Each such codetag type has its own section so that we can
28  * unload them individually once unused.
29  */
30 #define MOD_SEPARATE_CODETAG_SECTIONS()		\
31 	MOD_SEPARATE_CODETAG_SECTION(alloc_tags)
32 
33 #endif /* __ASM_GENERIC_CODETAG_LDS_H */
34