diff options
Diffstat (limited to 'tools/perf/util/symbol-elf.c')
| -rw-r--r-- | tools/perf/util/symbol-elf.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 476268c99431..a7ab6063e038 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
| @@ -776,6 +776,7 @@ int dso__load_sym(struct dso *dso, struct map *map, | |||
| 776 | symbol_filter_t filter, int kmodule) | 776 | symbol_filter_t filter, int kmodule) |
| 777 | { | 777 | { |
| 778 | struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL; | 778 | struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL; |
| 779 | struct map_groups *kmaps = kmap ? map__kmaps(map) : NULL; | ||
| 779 | struct map *curr_map = map; | 780 | struct map *curr_map = map; |
| 780 | struct dso *curr_dso = dso; | 781 | struct dso *curr_dso = dso; |
| 781 | Elf_Data *symstrs, *secstrs; | 782 | Elf_Data *symstrs, *secstrs; |
| @@ -791,6 +792,9 @@ int dso__load_sym(struct dso *dso, struct map *map, | |||
| 791 | int nr = 0; | 792 | int nr = 0; |
| 792 | bool remap_kernel = false, adjust_kernel_syms = false; | 793 | bool remap_kernel = false, adjust_kernel_syms = false; |
| 793 | 794 | ||
| 795 | if (kmap && !kmaps) | ||
| 796 | return -1; | ||
| 797 | |||
| 794 | dso->symtab_type = syms_ss->type; | 798 | dso->symtab_type = syms_ss->type; |
| 795 | dso->is_64_bit = syms_ss->is_64_bit; | 799 | dso->is_64_bit = syms_ss->is_64_bit; |
| 796 | dso->rel = syms_ss->ehdr.e_type == ET_REL; | 800 | dso->rel = syms_ss->ehdr.e_type == ET_REL; |
| @@ -958,8 +962,10 @@ int dso__load_sym(struct dso *dso, struct map *map, | |||
| 958 | map->map_ip = map__map_ip; | 962 | map->map_ip = map__map_ip; |
| 959 | map->unmap_ip = map__unmap_ip; | 963 | map->unmap_ip = map__unmap_ip; |
| 960 | /* Ensure maps are correctly ordered */ | 964 | /* Ensure maps are correctly ordered */ |
| 961 | map_groups__remove(kmap->kmaps, map); | 965 | if (kmaps) { |
| 962 | map_groups__insert(kmap->kmaps, map); | 966 | map_groups__remove(kmaps, map); |
| 967 | map_groups__insert(kmaps, map); | ||
| 968 | } | ||
| 963 | } | 969 | } |
| 964 | 970 | ||
| 965 | /* | 971 | /* |
| @@ -983,7 +989,7 @@ int dso__load_sym(struct dso *dso, struct map *map, | |||
| 983 | snprintf(dso_name, sizeof(dso_name), | 989 | snprintf(dso_name, sizeof(dso_name), |
| 984 | "%s%s", dso->short_name, section_name); | 990 | "%s%s", dso->short_name, section_name); |
| 985 | 991 | ||
| 986 | curr_map = map_groups__find_by_name(kmap->kmaps, map->type, dso_name); | 992 | curr_map = map_groups__find_by_name(kmaps, map->type, dso_name); |
| 987 | if (curr_map == NULL) { | 993 | if (curr_map == NULL) { |
| 988 | u64 start = sym.st_value; | 994 | u64 start = sym.st_value; |
| 989 | 995 | ||
| @@ -1013,7 +1019,7 @@ int dso__load_sym(struct dso *dso, struct map *map, | |||
| 1013 | curr_map->unmap_ip = identity__map_ip; | 1019 | curr_map->unmap_ip = identity__map_ip; |
| 1014 | } | 1020 | } |
| 1015 | curr_dso->symtab_type = dso->symtab_type; | 1021 | curr_dso->symtab_type = dso->symtab_type; |
| 1016 | map_groups__insert(kmap->kmaps, curr_map); | 1022 | map_groups__insert(kmaps, curr_map); |
| 1017 | /* | 1023 | /* |
| 1018 | * The new DSO should go to the kernel DSOS | 1024 | * The new DSO should go to the kernel DSOS |
| 1019 | */ | 1025 | */ |
| @@ -1075,7 +1081,7 @@ new_symbol: | |||
| 1075 | * We need to fixup this here too because we create new | 1081 | * We need to fixup this here too because we create new |
| 1076 | * maps here, for things like vsyscall sections. | 1082 | * maps here, for things like vsyscall sections. |
| 1077 | */ | 1083 | */ |
| 1078 | __map_groups__fixup_end(kmap->kmaps, map->type); | 1084 | __map_groups__fixup_end(kmaps, map->type); |
| 1079 | } | 1085 | } |
| 1080 | } | 1086 | } |
| 1081 | err = nr; | 1087 | err = nr; |
