Commit 36878102 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo
Browse files

perf symbol-elf: Avoid a weak cxx_demangle_sym function



cxx_demangle_sym is weak in case demangle-cxx.c replaces the
definition in symbol-elf.c. When demangle-cxx.c is built
HAVE_CXA_DEMANGLE_SUPPORT is defined, as such the define can be used
to avoid a weak symbol.

As weak symbols are outside of the C standard their use can lead to
strange behaviors, in particular with LTO, as well as causing issues to
be hidden at link time.

Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241119031754.1021858-1-irogers@google.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4f90ed0a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -287,7 +287,8 @@ static bool want_demangle(bool is_kernel_sym)
 * Demangle C++ function signature, typically replaced by demangle-cxx.cpp
 * version.
 */
__weak char *cxx_demangle_sym(const char *str __maybe_unused, bool params __maybe_unused,
#ifndef HAVE_CXA_DEMANGLE_SUPPORT
char *cxx_demangle_sym(const char *str __maybe_unused, bool params __maybe_unused,
		       bool modifiers __maybe_unused)
{
#ifdef HAVE_LIBBFD_SUPPORT
@@ -302,6 +303,7 @@ __weak char *cxx_demangle_sym(const char *str __maybe_unused, bool params __mayb
	return NULL;
#endif
}
#endif /* !HAVE_CXA_DEMANGLE_SUPPORT */

static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
{