hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/tools/perf/tests/vmlinux-kallsyms.c
....@@ -3,9 +3,11 @@
33 #include <linux/rbtree.h>
44 #include <inttypes.h>
55 #include <string.h>
6
+#include <stdlib.h>
7
+#include "dso.h"
68 #include "map.h"
79 #include "symbol.h"
8
-#include "util.h"
10
+#include <internal/lib.h> // page_size
911 #include "tests.h"
1012 #include "debug.h"
1113 #include "machine.h"
....@@ -161,9 +163,16 @@
161163
162164 continue;
163165 }
164
- } else
166
+ } else if (mem_start == kallsyms.vmlinux_map->end) {
167
+ /*
168
+ * Ignore aliases to _etext, i.e. to the end of the kernel text area,
169
+ * such as __indirect_thunk_end.
170
+ */
171
+ continue;
172
+ } else {
165173 pr_debug("ERR : %#" PRIx64 ": %s not on kallsyms\n",
166174 mem_start, sym->name);
175
+ }
167176
168177 err = -1;
169178 }
....@@ -173,7 +182,7 @@
173182
174183 header_printed = false;
175184
176
- for (map = maps__first(maps); map; map = map__next(map)) {
185
+ maps__for_each_entry(maps, map) {
177186 struct map *
178187 /*
179188 * If it is the kernel, kallsyms is always "[kernel.kallsyms]", while
....@@ -181,10 +190,9 @@
181190 * so use the short name, less descriptive but the same ("[kernel]" in
182191 * both cases.
183192 */
184
- pair = map_groups__find_by_name(&kallsyms.kmaps,
185
- (map->dso->kernel ?
186
- map->dso->short_name :
187
- map->dso->name));
193
+ pair = maps__find_by_name(&kallsyms.kmaps, (map->dso->kernel ?
194
+ map->dso->short_name :
195
+ map->dso->name));
188196 if (pair) {
189197 pair->priv = 1;
190198 } else {
....@@ -198,13 +206,13 @@
198206
199207 header_printed = false;
200208
201
- for (map = maps__first(maps); map; map = map__next(map)) {
209
+ maps__for_each_entry(maps, map) {
202210 struct map *pair;
203211
204212 mem_start = vmlinux_map->unmap_ip(vmlinux_map, map->start);
205213 mem_end = vmlinux_map->unmap_ip(vmlinux_map, map->end);
206214
207
- pair = map_groups__find(&kallsyms.kmaps, mem_start);
215
+ pair = maps__find(&kallsyms.kmaps, mem_start);
208216 if (pair == NULL || pair->priv)
209217 continue;
210218
....@@ -228,7 +236,7 @@
228236
229237 maps = machine__kernel_maps(&kallsyms);
230238
231
- for (map = maps__first(maps); map; map = map__next(map)) {
239
+ maps__for_each_entry(maps, map) {
232240 if (!map->priv) {
233241 if (!header_printed) {
234242 pr_info("WARN: Maps only in kallsyms:\n");