]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
hpux: Fix detection of atomic support when profiling
authorJohn David Anglin <danglin@gcc.gnu.org>
Mon, 19 May 2025 21:28:00 +0000 (17:28 -0400)
committerJohn David Anglin <danglin@gcc.gnu.org>
Mon, 19 May 2025 21:30:50 +0000 (17:30 -0400)
The pa target lacks atomic sync compare and swap instructions.
These are implemented as libcalls and in libatomic.  As on linux,
we lie about their availability.

This fixes the gcov-30.c test on hppa64-hpux11.

2025-05-19  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa-hpux.h (TARGET_HAVE_LIBATOMIC): Define.
(HAVE_sync_compare_and_swapqi): Likewise.
(HAVE_sync_compare_and_swaphi): Likewise.
(HAVE_sync_compare_and_swapsi): Likewise.
(HAVE_sync_compare_and_swapdi): Likewise.

gcc/config/pa/pa-hpux.h

index 74e30eda9b5c85c43e6d5770e6deaf0a44dd0a62..1439447fdbed40e5caaa724f618fd6299bf2835b 100644 (file)
@@ -114,3 +114,17 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef TARGET_LIBC_HAS_FUNCTION
 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
+/* Assume we have libatomic if sync libcalls are disabled.  */
+#undef TARGET_HAVE_LIBATOMIC
+#define TARGET_HAVE_LIBATOMIC (!flag_sync_libcalls)
+
+/* The SYNC operations are implemented as library functions, not
+   INSN patterns.  As a result, the HAVE defines for the patterns are
+   not defined.  We need to define them to generate the corresponding
+   __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* and __GCC_ATOMIC_*_LOCK_FREE
+   defines.  */
+#define HAVE_sync_compare_and_swapqi (flag_sync_libcalls)
+#define HAVE_sync_compare_and_swaphi (flag_sync_libcalls)
+#define HAVE_sync_compare_and_swapsi (flag_sync_libcalls)
+#define HAVE_sync_compare_and_swapdi (flag_sync_libcalls)