This is the mail archive of the gcc-help@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: Invoking atomic functions from a C++ shared lib (or should I force linking with -lgcc?)


On 11/19/2010 10:14 AM, Christophe Lyon wrote:
> 
>>
>> What I have found is that g++ (unlike gcc) links with -lgcc_s instead of
>> -lgcc and that the atomic functions are present in libgcc.a and not in
>> libgcc_s.so.
>>
> 
> Anyone knows the rationale for the absence of functions such as
> __sync_fetch_and_add (and more generally all __sunc* functions) from
> libgcc_s.so ?

It was to make them faster by avoiding a trip through the PLT.

> Is it a bug/feature specific to the ARM port? (on x86 for instance, such
> functions do not exist, the corresponding builtin is fully expanded and
> requires not lib call).

There are a couple of targets that use libcalls for atomics.

You should be able simply to link with

  -lgcc_s -lgcc

Andrew.


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