mirror of
https://github.com/torvalds/linux.git
synced 2026-11-10 17:11:02 +01:00
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: b72b8132d8 ("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>
This commit is contained in:
parent
0b26b346a8
commit
c4c4334350
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user