Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf dso: Fix build when libunwind is enabled

Now that symsrc_filename is always accessed through an accessor, we also
need a free() function for it to avoid the following compilation error:

util/unwind-libunwind-local.c:416:12: error: lvalue required as unary
‘&’ operand
416 | zfree(&dso__symsrc_filename(dso));

Fixes: 1553419c3c10 ("perf dso: Fix address sanitizer build")
Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Tested-by: Leo Yan <leo.yan@arm.com>
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Yunseong Kim <yskelg@gmail.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Link: https://lore.kernel.org/r/20240715094715.3914813-1-james.clark@linaro.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

James Clark and committed by
Namhyung Kim
92717bc0 2085948e

+7 -2
+1 -1
tools/perf/util/dso.c
··· 1501 1501 auxtrace_cache__free(RC_CHK_ACCESS(dso)->auxtrace_cache); 1502 1502 dso_cache__free(dso); 1503 1503 dso__free_a2l(dso); 1504 - zfree(&RC_CHK_ACCESS(dso)->symsrc_filename); 1504 + dso__free_symsrc_filename(dso); 1505 1505 nsinfo__zput(RC_CHK_ACCESS(dso)->nsinfo); 1506 1506 mutex_destroy(dso__lock(dso)); 1507 1507 RC_CHK_FREE(dso);
+5
tools/perf/util/dso.h
··· 602 602 RC_CHK_ACCESS(dso)->symsrc_filename = val; 603 603 } 604 604 605 + static inline void dso__free_symsrc_filename(struct dso *dso) 606 + { 607 + zfree(&RC_CHK_ACCESS(dso)->symsrc_filename); 608 + } 609 + 605 610 static inline enum dso_binary_type dso__symtab_type(const struct dso *dso) 606 611 { 607 612 return RC_CHK_ACCESS(dso)->symtab_type;
+1 -1
tools/perf/util/unwind-libunwind-local.c
··· 413 413 __func__, 414 414 dso__symsrc_filename(dso), 415 415 debuglink); 416 - zfree(&dso__symsrc_filename(dso)); 416 + dso__free_symsrc_filename(dso); 417 417 } 418 418 dso__set_symsrc_filename(dso, debuglink); 419 419 } else {