This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: GCC 4.7.0 and C++ atomics


On 03/07/12 10:44, Andrew MacLeod wrote:
> rth, you are familiar with how this part is suppose to hook up properly...
> 
> I traced the code in expand_mem_thread_fence, and the sync_synchronize is being emiited by:
> 
> else if (synchronize_libfunc != NULL_RTX)
>         emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode, 0);
> 
> presumably something just isn't being linked to the executable?  or maybe not being built into libgcc?

These functions are in libgcc, but only built for linux.
See libgcc/config/arm/t-linux-eabi.

  if (TARGET_AAPCS_BASED)
    synchronize_libfunc = init_one_libfunc ("__sync_synchronize");

I assume this is because the default fallback, lacking an optab,
for synchronize is a no-op, and this is actively incorrect for
many ARM cpu revisions.

I also assume that rtems is now encountering this because of the
switch from arm-elf to arm-elf-eabi.  In order to finish the port
to the eabi, rtems will need to provide this symbol somehow.

If rtems is always universally built explicitly targeting a
specific cpu revision, then this can be as simple as

void
__sync_synchronize (void)
{
#if defined(arm revisions supporting dmb)
  asm volatile("dmb" : : : "memory");
#else
  asm volatile("" : : : "memory");
#endif
}

Otherwise you may need help from the rtems kernel, as linux does.


r~


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