https://gcc.gnu.org/g:23a8659a3e3a1877f70d196ae498a76d0fd2783c

commit r16-739-g23a8659a3e3a1877f70d196ae498a76d0fd2783c
Author: John David Anglin <dang...@gcc.gnu.org>
Date:   Mon May 19 17:28:00 2025 -0400

    hpux: Fix detection of atomic support when profiling
    
    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  <dang...@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.

Diff:
---
 gcc/config/pa/pa-hpux.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h
index 74e30eda9b5c..1439447fdbed 100644
--- a/gcc/config/pa/pa-hpux.h
+++ b/gcc/config/pa/pa-hpux.h
@@ -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)

Reply via email to