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: __sync_sychronize on ARM


Hi Ramana,

Thanks very much for getting back to me!

On Mon, 2012-01-30 at 08:50 +0000, Ramana Radhakrishnan wrote:
> On Mon, Jan 30, 2012 at 6:56 AM, Jon Masters <jonathan@jonmasters.org> wrote:
> > The __sync_synchronize "legacy" sync function is intended to be used to
> > perform an expensive data memory barrier operation. It is defined within
> > libgcc in such a way that I *believe* means that, on most architectures,
> > it is replaced with an inline assembly code emitted that performs a sync
> > operation. On ARM, and some other architectures with mixed ISAs wherein
> > there may not be a sync function nor one way to do this, this function
> > (__sync_synchronize) can be a real function call. In that case, it might
> > cause inline assembly generation, or e.g. call a kernel VDSO helper.
> 
> On ARM we don't have a kernel VDSO

You're right of course! I was confusing the VDSO-like user mode mapped
helpers (Documentation/arm/kernel_user_helpers.txt) with full VDSO. I
apologize for my mistake. Nonetheless, I believe for the purposes of
this thread, we can consider the behavior I described roughly consistent
with reality, because a kernel helper will be called in a VDSO-like way.

> sync_synchronize for older versions of
> the architecture ( anything prior to armv6k) should result in a call
> to sync_synchronize
> in libgcc.a which should take care of calling the kernel helper function.

This is what's confusing me :) Is one supposed (from some random source)
to be calling __sync_synchronize or sync_synchronize? Convention
suggests the latter, but I was sufficiently confused by the aliasing of
the names in the source vs. the documentation, so I'd like to ask you :)

> Therefore I'm assuming this is a breakage you face when building for
> armv5te

It is indeed. Thanks for noting that. 

> > The icu package contains a direct call to __sync_sychronize, especially
> > in the iotest test cases. I believe that this compiles fine on x86
> > because there is no function call. However, on ARM, the code fails to
> > link because the __sync_synchronize function is HIDDEN and not exported
> > (or so goes my understanding - is that correct?).
> 
> No, the HIDDEN shouldn't cause a link failure in this case - you
> should be able to pull this
> in when you link against the static libgcc where this should be defined.
> 
> I don't know what your linker command line is  so maybe that's a place
> to start investigating from.

Thanks! You're the second person to suggest that, so I'll look some
more. Could you let me know about the correct function name, above?

Appreciate the help.

Jon.



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