Skip to content

Commit bf57d64

Browse files
petrpavluKPD
authored andcommitted
codetag: Avoid unused alloc_tags sections/symbols
With CONFIG_MEM_ALLOC_PROFILING=n, vmlinux and all modules unnecessarily contain the symbols __start_alloc_tags and __stop_alloc_tags, which define an empty range. In the case of modules, the presence of these symbols also forces the linker to create an empty .codetag.alloc_tags section. Update codetag.lds.h to make the data conditional on CONFIG_MEM_ALLOC_PROFILING. Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev> Reviewed-by: Suren Baghdasaryan <surenb@google.com>
1 parent d6fb02c commit bf57d64

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/asm-generic/codetag.lds.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
#ifndef __ASM_GENERIC_CODETAG_LDS_H
33
#define __ASM_GENERIC_CODETAG_LDS_H
44

5+
#ifdef CONFIG_MEM_ALLOC_PROFILING
6+
#define IF_MEM_ALLOC_PROFILING(...) __VA_ARGS__
7+
#else
8+
#define IF_MEM_ALLOC_PROFILING(...)
9+
#endif
10+
511
#define SECTION_WITH_BOUNDARIES(_name) \
612
. = ALIGN(8); \
713
__start_##_name = .; \
814
KEEP(*(_name)) \
915
__stop_##_name = .;
1016

1117
#define CODETAG_SECTIONS() \
12-
SECTION_WITH_BOUNDARIES(alloc_tags)
18+
IF_MEM_ALLOC_PROFILING(SECTION_WITH_BOUNDARIES(alloc_tags))
1319

1420
/*
1521
* Module codetags which aren't used after module unload, therefore have the
@@ -28,6 +34,6 @@
2834
* unload them individually once unused.
2935
*/
3036
#define MOD_SEPARATE_CODETAG_SECTIONS() \
31-
MOD_SEPARATE_CODETAG_SECTION(alloc_tags)
37+
IF_MEM_ALLOC_PROFILING(MOD_SEPARATE_CODETAG_SECTION(alloc_tags))
3238

3339
#endif /* __ASM_GENERIC_CODETAG_LDS_H */

0 commit comments

Comments
 (0)