summaryrefslogtreecommitdiff
path: root/libbacktrace/configure.ac
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-19 01:09:47 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-19 01:09:47 +0000
commitbcafb4a81d1fc8deefed6e6fa567d66417857c9a (patch)
treea715cbe6fb809ff31f1487b709ea67a6f616cec5 /libbacktrace/configure.ac
parent5dbddbd9cba08722841cff67404dd01e2654c099 (diff)
downloadgcc-bcafb4a81d1fc8deefed6e6fa567d66417857c9a.tar.gz
* configure.ac: Check for support of __atomic extensions.
* internal.h: Declare or #define atomic functions for use in backtrace code. * atomic.c: New file. * dwarf.c (dwarf_lookup_pc): Use atomic functions. (dwarf_fileline, backtrace_dwarf_add): Likewise. * elf.c (elf_add_syminfo_data, elf_syminfo): Likewise. (backtrace_initialize): Likewise. * fileline.c (fileline_initialize): Likewise. * Makefile.am (libbacktrace_la_SOURCES): Add atomic.c. * configure, config.h.in, Makefile.in: Rebuild. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204994 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libbacktrace/configure.ac')
-rw-r--r--libbacktrace/configure.ac18
1 files changed, 18 insertions, 0 deletions
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 48c86203837..f97afbc8b74 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -194,6 +194,24 @@ if test "$libbacktrace_cv_sys_sync" = "yes"; then
fi
AC_SUBST(BACKTRACE_SUPPORTS_THREADS)
+# Test for __atomic support.
+AC_CACHE_CHECK([__atomic extensions],
+[libbacktrace_cv_sys_atomic],
+[if test -n "${with_target_subdir}"; then
+ libbacktrace_cv_sys_atomic=yes
+ else
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([int i;],
+ [__atomic_load_n (&i, __ATOMIC_ACQUIRE);
+ __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])],
+ [libbacktrace_cv_sys_atomic=yes],
+ [libbacktrace_cv_sys_atomic=no])
+ fi])
+if test "$libbacktrace_cv_sys_atomic" = "yes"; then
+ AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1,
+ [Define to 1 if you have the __atomic functions])
+fi
+
# The library needs to be able to read the executable itself. Compile
# a file to determine the executable format. The awk script
# filetype.awk prints out the file type.