https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120086

--- Comment #20 from John David Anglin <danglin at gcc dot gnu.org> ---
(In reply to John David Anglin from comment #19)
> It's not clear why gcov-30 passes on Linux.  I searched the entire tree and
> couldn't find how TARGET_HAVE_LIBATOMIC gets set on Linux.  Also, always
> setting TARGET_HAVE_LIBATOMIC to true doesn't seem 100% correct because I
> believe it's possible to disable building libatomic.

It's not set on Linux.

I see issue.  We have in tree-profile.cc:

 /* Verify whether we can utilize atomic update operations.  */
  bool can_support_atomic = targetm.have_libatomic;
  unsigned HOST_WIDE_INT gcov_type_size
    = tree_to_uhwi (TYPE_SIZE_UNIT (get_gcov_type ()));
  bool have_atomic_4
    = HAVE_sync_compare_and_swapsi || HAVE_atomic_compare_and_swapsi;
  bool have_atomic_8
    = HAVE_sync_compare_and_swapdi || HAVE_atomic_compare_and_swapdi;
  bool needs_split = gcov_type_size == 8 && !have_atomic_8 && have_atomic_4;
  if (!can_support_atomic)
    {
      if (gcov_type_size == 4)
        can_support_atomic = have_atomic_4;
      else if (gcov_type_size == 8)
        can_support_atomic = have_atomic_8;
    }

HAVE_sync_compare_and_swapdi isn't defined because this operation is
implemented as a libcall.  This is also true on Linux but we have
in pa-linux.h:

/* 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 1
#define HAVE_sync_compare_and_swaphi 1
#define HAVE_sync_compare_and_swapsi 1
#define HAVE_sync_compare_and_swapdi 1

Reply via email to