diff options
| author | Ian Rogers <irogers@google.com> | 2026-09-15 23:12:10 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-09-22 14:44:13 +0200 |
| commit | c4c43343501bd9fc24ec501ecaf43b7ef2da44d2 (patch) | |
| tree | 602763ebf46667e8260d4b8f0787098bef903ea2 /tools | |
| parent | 0b26b346a8a2bdcb3a7b6ab6f4e6450ee300eec3 (diff) | |
| download | linux-next-c4c43343501bd9fc24ec501ecaf43b7ef2da44d2.tar.gz linux-next-c4c43343501bd9fc24ec501ecaf43b7ef2da44d2.zip | |
perf libbfd: Fix the clang -Wthread-safety build failure
perf_bfd_lock() and perf_bfd_unlock() are the callbacks given to
bfd_thread_init(), so by design they acquire and release the lock on
libbfd's behalf and the lock state differs between entry and exit.
clang's thread safety analysis, which perf builds with as an error,
flags both:
util/libbfd.c:56:1: error: mutex 'bfd_mutex' is still held at the end of function [-Werror,-Wthread-safety-analysis]
util/libbfd.c:60:2: error: releasing mutex 'bfd_mutex' that was not held [-Werror,-Wthread-safety-analysis]
Mark both functions NO_THREAD_SAFETY_ANALYSIS so that libbfd.c compiles
with "make CC=clang BUILD_NONDISTRO=1".
Fixes: b72b8132d8fd2d6b ("perf libbfd: Ensure libbfd is initialized prior to use")
Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/util/libbfd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c index 936555217e81..d1d1c9b2ef22 100644 --- a/tools/perf/util/libbfd.c +++ b/tools/perf/util/libbfd.c @@ -39,13 +39,13 @@ struct a2l_data { asymbol **syms; }; -static bool perf_bfd_lock(void *bfd_mutex) +static bool perf_bfd_lock(void *bfd_mutex) NO_THREAD_SAFETY_ANALYSIS { mutex_lock(bfd_mutex); return true; } -static bool perf_bfd_unlock(void *bfd_mutex) +static bool perf_bfd_unlock(void *bfd_mutex) NO_THREAD_SAFETY_ANALYSIS { mutex_unlock(bfd_mutex); return true; |
