Re: [PATCH] [RFC V1]s390/perf: fix 'start' address of module's map
From: Jiri Olsa
Date: Fri Jul 08 2016 - 11:21:09 EST
On Thu, Jul 07, 2016 at 09:49:36AM +0800, Song Shan Gong wrote:
SNIP
> + hex2u64(sep + 1, &text_start);
> +
> + *start = text_start;
> +out:
> + free(line);
> + fclose(file);
> + free(module_name - 1);
> + return err;
> +}
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index b177218..e5c2721 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1091,12 +1091,18 @@ static int machine__set_modules_path(struct machine *machine)
>
> return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0);
> }
> +int __weak arch__fix_module_baseaddr(struct machine *machine __maybe_unused,
> + u64 *start __maybe_unused, const char *name __maybe_unused)
> +{
> + return 0;
> +}
>
> static int machine__create_module(void *arg, const char *name, u64 start)
> {
> struct machine *machine = arg;
> struct map *map;
>
> + arch__fix_module_baseaddr(machine, &start, name);
you should check for its return value and fail if needed
jirka