return count;
}
+static uint16_t machine_or_dso_e_machine(struct machine *machine, struct dso *dso)
+{
+ uint16_t e_machine = EM_NONE;
+ /* DSO should be most accurate */
+ if (dso)
+ e_machine = dso__e_machine(dso, machine, /*e_flags=*/NULL);
+
+ if (e_machine != EM_NONE)
+ return e_machine;
+
+ /* Check the global environment next. */
+ if (machine && machine->env && machine->env->e_machine != EM_NONE)
+ return machine->env->e_machine;
+
+ return perf_env__e_machine(machine ? machine->env : NULL, /*e_flags=*/NULL);
+}
+
/*
* Split the symbols into maps, making sure there are no overlaps, i.e. the
* kernel range is broken in several maps, named [kernel].N, as we don't have
struct rb_root_cached *root = dso__symbols(dso);
struct rb_node *next = rb_first_cached(root);
int kernel_range = 0;
- bool x86_64;
+ uint16_t e_machine = EM_NONE;
if (!kmaps)
return -1;
machine = maps__machine(kmaps);
-
- x86_64 = machine__is(machine, "x86_64");
+ e_machine = machine_or_dso_e_machine(machine, dso);
while (next) {
char *module;
*/
pos->start = map__map_ip(curr_map, pos->start);
pos->end = map__map_ip(curr_map, pos->end);
- } else if (x86_64 && is_entry_trampoline(pos->name)) {
+ } else if (e_machine == EM_X86_64 && is_entry_trampoline(pos->name)) {
/*
* These symbols are not needed anymore since the
* trampoline maps refer to the text section and it's
free(new_node);
}
- if (machine__is(machine, "x86_64")) {
+ if (machine_or_dso_e_machine(machine, dso) == EM_X86_64) {
u64 addr;
/*
ret = dso__load_guest_kernel_sym(dso, map);
machine = maps__machine(map__kmaps(map));
- if (machine__is(machine, "x86_64"))
+ if (machine && machine_or_dso_e_machine(machine, dso) == EM_X86_64)
machine__map_x86_64_entry_trampolines(machine, dso);
goto out;
}