Commit ac931f87a647ca156f65a4c00e7297165e4fa2d8
Committed by
Ingo Molnar
1 parent
6aaba7c901
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
perf: Fix building warning on ARM 32
Commit 85c116a6cb91 ("perf callchain: Make get_srcline fall back to sym+offset") introduces asprintf() call and matches '%ld' to a u64 argument, which is incorrect on ARM: CC /home/wn/util/srcline.o util/srcline.c: In function 'get_srcline': util/srcline.c:297:6: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'u64' [-Werror=format] cc1: all warnings being treated as errors make[1]: *** [/home/wn/util/srcline.o] Error 1 In addition, all users of get_srcline() use u64 addr, and libbfd also use 64 bit bfd_vma as address. This patch also fix prototype of get_srcline() and addr2line() to use u64 addr instead of unsigned long. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: <lizefan@huawei.com> Cc: <a.p.zijlstra@chello.nl> Cc: <paulus@samba.org> Cc: <acme@kernel.org> Cc: <ak@linux.intel.com> Link: http://lkml.kernel.org/r/1418710746-35943-1-git-send-email-wangnan0@huawei.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Showing 2 changed files with 7 additions and 7 deletions Side-by-side Diff
tools/perf/util/srcline.c
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | |
21 | 21 | struct a2l_data { |
22 | 22 | const char *input; |
23 | - unsigned long addr; | |
23 | + u64 addr; | |
24 | 24 | |
25 | 25 | bool found; |
26 | 26 | const char *filename; |
... | ... | @@ -147,7 +147,7 @@ |
147 | 147 | free(a2l); |
148 | 148 | } |
149 | 149 | |
150 | -static int addr2line(const char *dso_name, unsigned long addr, | |
150 | +static int addr2line(const char *dso_name, u64 addr, | |
151 | 151 | char **file, unsigned int *line, struct dso *dso) |
152 | 152 | { |
153 | 153 | int ret = 0; |
... | ... | @@ -193,7 +193,7 @@ |
193 | 193 | |
194 | 194 | #else /* HAVE_LIBBFD_SUPPORT */ |
195 | 195 | |
196 | -static int addr2line(const char *dso_name, unsigned long addr, | |
196 | +static int addr2line(const char *dso_name, u64 addr, | |
197 | 197 | char **file, unsigned int *line_nr, |
198 | 198 | struct dso *dso __maybe_unused) |
199 | 199 | { |
... | ... | @@ -252,7 +252,7 @@ |
252 | 252 | */ |
253 | 253 | #define A2L_FAIL_LIMIT 123 |
254 | 254 | |
255 | -char *get_srcline(struct dso *dso, unsigned long addr, struct symbol *sym, | |
255 | +char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, | |
256 | 256 | bool show_sym) |
257 | 257 | { |
258 | 258 | char *file = NULL; |
259 | 259 | |
... | ... | @@ -293,10 +293,10 @@ |
293 | 293 | dso__free_a2l(dso); |
294 | 294 | } |
295 | 295 | if (sym) { |
296 | - if (asprintf(&srcline, "%s+%ld", show_sym ? sym->name : "", | |
296 | + if (asprintf(&srcline, "%s+%" PRIu64, show_sym ? sym->name : "", | |
297 | 297 | addr - sym->start) < 0) |
298 | 298 | return SRCLINE_UNKNOWN; |
299 | - } else if (asprintf(&srcline, "%s[%lx]", dso->short_name, addr) < 0) | |
299 | + } else if (asprintf(&srcline, "%s[%" PRIx64 "]", dso->short_name, addr) < 0) | |
300 | 300 | return SRCLINE_UNKNOWN; |
301 | 301 | return srcline; |
302 | 302 | } |
tools/perf/util/util.h
... | ... | @@ -310,7 +310,7 @@ |
310 | 310 | struct dso; |
311 | 311 | struct symbol; |
312 | 312 | |
313 | -char *get_srcline(struct dso *dso, unsigned long addr, struct symbol *sym, | |
313 | +char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, | |
314 | 314 | bool show_sym); |
315 | 315 | void free_srcline(char *srcline); |
316 | 316 |