Add target data to indicate if libatomic is available.

gcc/ChangeLog:

        * config/rtems.h (TARGET_HAVE_LIBATOMIC): Define.
        * doc/tm.texi: Regenerate.
        * doc/tm.texi.in (TARGET_HAVE_LIBATOMIC): Add.
        * target.def (have_libatomic): New.
---
 gcc/config/rtems.h | 2 ++
 gcc/doc/tm.texi    | 5 +++++
 gcc/doc/tm.texi.in | 2 ++
 gcc/target.def     | 8 ++++++++
 4 files changed, 17 insertions(+)

diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h
index 8641ea15271d..2c006e4c1e54 100644
--- a/gcc/config/rtems.h
+++ b/gcc/config/rtems.h
@@ -53,6 +53,8 @@
 
 #define TARGET_POSIX_IO
 
+#define TARGET_HAVE_LIBATOMIC true
+
 /* Prefer int for int32_t (see stdint-newlib.h).  */
 #undef STDINT_LONG32
 #define STDINT_LONG32 (INT_TYPE_SIZE != 32 && LONG_TYPE_SIZE == 32)
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index d93b33099dd4..04cd12de792c 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -12435,3 +12435,8 @@ The default clears the top byte of the original pointer.
 This value is true if the target platform supports
 @option{-fsanitize=shadow-call-stack}.  The default value is false.
 @end deftypevr
+
+@deftypevr {Target Hook} bool TARGET_HAVE_LIBATOMIC
+This value is true if the target platform supports
+libatomic.  The default value is false.
+@end deftypevr
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 9061a5b26af9..19d21999317a 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7982,3 +7982,5 @@ maintainer is familiar with.
 @hook TARGET_MEMTAG_UNTAGGED_POINTER
 
 @hook TARGET_HAVE_SHADOW_CALL_STACK
+
+@hook TARGET_HAVE_LIBATOMIC
diff --git a/gcc/target.def b/gcc/target.def
index 5c10c702a26e..bf0d6e0aeda1 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -7126,6 +7126,14 @@ DEFHOOKPOD
 @option{-fsanitize=shadow-call-stack}.  The default value is false.",
  bool, false)
 
+/* This value represents whether libatomic is available on
+   the target platform.  */
+DEFHOOKPOD
+(have_libatomic,
+ "This value is true if the target platform supports\n\
+libatomic.  The default value is false.",
+ bool, false)
+
 /* Close the 'struct gcc_target' definition.  */
 HOOK_VECTOR_END (C90_EMPTY_HACK)
 
-- 
2.35.3

Reply via email to