This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: <atomic.h> and single-byte CAS


* Andreas Schwab:

> On Jul 08 2019, Florian Weimer <fweimer@redhat.com> wrote:
>
>> atomic_compare_exchange_weak_relaxed with char * arguments, swapping
>> individual bytes.
>
> In which way is it not supported?

_Bool
test_atomic (char *p, char *q)
{
  return atomic_compare_exchange_weak_relaxed (p, q, 1);
}

results in this link-time error on x86-64:

  undefined reference to `__atomic_link_error'

This probably comes from this code:

/* We require 32b atomic operations; some archs also support 64b atomic
   operations.  */
void __atomic_link_error (void);
# if __HAVE_64B_ATOMICS == 1
#  define __atomic_check_size(mem) \
   if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8))			      \
     __atomic_link_error ();
# else
#  define __atomic_check_size(mem) \
   if (sizeof (*mem) != 4)						      \
     __atomic_link_error ();
# endif

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]