Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
SergeyKa
Posts: 4
Registered: ‎08-23-2012
My Device: PlayBook

GCC built-in functions / intrinsics

Hi folks,

 

I'm porting a program that makes use of __sync_add_and_fetch()  and similar intrinsics.

 

Normally GCC would turn them to an assembly instruction, or to a function call with a matching function in libgcc.a

 

In BB NDK 2.1 I get them as function calls (despite there's no -fno-builtin in cc1 command line) and libgcc.a doesn't have these functions.

 

 

Question: has anyone used GCC intrinsics with BB NDK?

BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: GCC built-in functions / intrinsics

We created an app with code using "__sync_add_and_fetch".  This compiled in NDK 10.0.6 qde with target set to the device.  However, similar code didn't compile in NDK2.1 qde with target set to device; we get error for undefined reference for "__sync_add_and_fetch_4".    The symbol does not appear to be in libgcc.a in 10.0.6.

 

I'll check with our internal contacts.

Does anyone have a solution to this already?

 

Stuart

New Contributor
SergeyKa
Posts: 4
Registered: ‎08-23-2012
My Device: PlayBook

Re: GCC built-in functions / intrinsics

Cheers Stuart, I fell back to mutexes for now.

Seems like compiler and libgcc are out of sync...
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: GCC built-in functions / intrinsics

>We created an app with code using "__sync_add_and_fetch".  This compiled in NDK 10.0.6 qde with target set to the device.

>The symbol does not appear to be in libgcc.a in 10.0.6.

Is there a typo here? how can you compile if it there is no such symbol in any library?

BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: GCC built-in functions / intrinsics

[ Edited ]

No, just the symbol does not appear to be in that specific library in the case that works.

 

Stuart

New Contributor
SergeyKa
Posts: 4
Registered: ‎08-23-2012
My Device: PlayBook

Re: GCC built-in functions / intrinsics

> Is there a typo here? how can you compile if it there is no such symbol in any library?

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: GCC built-in functions / intrinsics

so we should read this:

>We created an app with code using "__sync_add_and_fetch".  This compiled in NDK 10.0.6 qde with target set to the device.

>The symbol does not appear to be in libgcc.a in 10.0.6.

as "compiler replaces these functions with assembly", right?

New Contributor
SergeyKa
Posts: 4
Registered: ‎08-23-2012
My Device: PlayBook

Re: GCC built-in functions / intrinsics

Yep