https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119667
Bug ID: 119667
Summary: libstdc++ configure checks for libbacktrace need
atomics for void* and size_t
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
GLIBCXX_ENABLE_BACKTRACE in acinclude.m4 says:
# libbacktrace only needs atomics for int, which we've already tested
if test "$glibcxx_cv_atomic_int" = "yes"; then
BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_ATOMIC_FUNCTIONS=1"
fi
I based that comment on the checks in libbacktrace/configure.ac which only
checks __atomic_xxx builtins for int, presumably because it's only checking if
the compiler is new enough to support __atomic_ builtins at all. But for
libstdc++ we actually care about whether the builtins are supported natively,
and we don't want to use them if they're relying on libatomic. So we should be
checking for __atomic builtins being expanded to native instructions, rather
than an extern call to a libatomic symbol.
libbacktrace needs these operations:
extern void *backtrace_atomic_load_pointer (void *);
extern int backtrace_atomic_load_int (int *);
extern void backtrace_atomic_store_pointer (void *, void *);
extern void backtrace_atomic_store_size_t (size_t *, size_t);
extern void backtrace_atomic_store_int (int *, int);
so we should check for load+store on int, size_t and void*.