xref: /openbmc/linux/tools/perf/arch/arm64/util/machine.c (revision b38269ec)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <inttypes.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include "debug.h"
7 #include "symbol.h"
8 
9 /* On arm64, kernel text segment starts at high memory address,
10  * for example 0xffff 0000 8xxx xxxx. Modules start at a low memory
11  * address, like 0xffff 0000 00ax xxxx. When only small amount of
12  * memory is used by modules, gap between end of module's text segment
13  * and start of kernel text segment may reach 2G.
14  * Therefore do not fill this gap and do not assign it to the kernel dso map.
15  */
16 
17 #define SYMBOL_LIMIT (1 << 12) /* 4K */
18 
19 void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
20 {
21 	if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
22 			(strchr(p->name, '[') == NULL && strchr(c->name, '[')))
23 		/* Limit range of last symbol in module and kernel */
24 		p->end += SYMBOL_LIMIT;
25 	else
26 		p->end = c->start;
27 	pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
28 }
29