| .. | .. |
|---|
| 3 | 3 | #include <linux/rbtree.h> |
|---|
| 4 | 4 | #include <inttypes.h> |
|---|
| 5 | 5 | #include <string.h> |
|---|
| 6 | +#include <stdlib.h> |
|---|
| 7 | +#include "dso.h" |
|---|
| 6 | 8 | #include "map.h" |
|---|
| 7 | 9 | #include "symbol.h" |
|---|
| 8 | | -#include "util.h" |
|---|
| 10 | +#include <internal/lib.h> // page_size |
|---|
| 9 | 11 | #include "tests.h" |
|---|
| 10 | 12 | #include "debug.h" |
|---|
| 11 | 13 | #include "machine.h" |
|---|
| .. | .. |
|---|
| 161 | 163 | |
|---|
| 162 | 164 | continue; |
|---|
| 163 | 165 | } |
|---|
| 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 { |
|---|
| 165 | 173 | pr_debug("ERR : %#" PRIx64 ": %s not on kallsyms\n", |
|---|
| 166 | 174 | mem_start, sym->name); |
|---|
| 175 | + } |
|---|
| 167 | 176 | |
|---|
| 168 | 177 | err = -1; |
|---|
| 169 | 178 | } |
|---|
| .. | .. |
|---|
| 173 | 182 | |
|---|
| 174 | 183 | header_printed = false; |
|---|
| 175 | 184 | |
|---|
| 176 | | - for (map = maps__first(maps); map; map = map__next(map)) { |
|---|
| 185 | + maps__for_each_entry(maps, map) { |
|---|
| 177 | 186 | struct map * |
|---|
| 178 | 187 | /* |
|---|
| 179 | 188 | * If it is the kernel, kallsyms is always "[kernel.kallsyms]", while |
|---|
| .. | .. |
|---|
| 181 | 190 | * so use the short name, less descriptive but the same ("[kernel]" in |
|---|
| 182 | 191 | * both cases. |
|---|
| 183 | 192 | */ |
|---|
| 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)); |
|---|
| 188 | 196 | if (pair) { |
|---|
| 189 | 197 | pair->priv = 1; |
|---|
| 190 | 198 | } else { |
|---|
| .. | .. |
|---|
| 198 | 206 | |
|---|
| 199 | 207 | header_printed = false; |
|---|
| 200 | 208 | |
|---|
| 201 | | - for (map = maps__first(maps); map; map = map__next(map)) { |
|---|
| 209 | + maps__for_each_entry(maps, map) { |
|---|
| 202 | 210 | struct map *pair; |
|---|
| 203 | 211 | |
|---|
| 204 | 212 | mem_start = vmlinux_map->unmap_ip(vmlinux_map, map->start); |
|---|
| 205 | 213 | mem_end = vmlinux_map->unmap_ip(vmlinux_map, map->end); |
|---|
| 206 | 214 | |
|---|
| 207 | | - pair = map_groups__find(&kallsyms.kmaps, mem_start); |
|---|
| 215 | + pair = maps__find(&kallsyms.kmaps, mem_start); |
|---|
| 208 | 216 | if (pair == NULL || pair->priv) |
|---|
| 209 | 217 | continue; |
|---|
| 210 | 218 | |
|---|
| .. | .. |
|---|
| 228 | 236 | |
|---|
| 229 | 237 | maps = machine__kernel_maps(&kallsyms); |
|---|
| 230 | 238 | |
|---|
| 231 | | - for (map = maps__first(maps); map; map = map__next(map)) { |
|---|
| 239 | + maps__for_each_entry(maps, map) { |
|---|
| 232 | 240 | if (!map->priv) { |
|---|
| 233 | 241 | if (!header_printed) { |
|---|
| 234 | 242 | pr_info("WARN: Maps only in kallsyms:\n"); |
|---|