Re: sync_add_and_fetch problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OK, I built a small test app, just a main that made this call. It didn't
compile. When I built with gcc -march=i486 test.c, it built and ran
fine. So, the compiler is OK (not really surprised, are you?).

That means something isn't right with my build environment. I am running
FC9, my co-workers are using Ubuntu 8.4(?). We use the same makefiles
and build procedure. I edited the makefile that builds this library and
added the -march=i486, but it didn't fix the problem. Here is the gcc
line in the makefile.

gcc -shared -fPIC -march=i486 -g -Wl,--version-script=merlotcore.ver -o
$@ $^ $(XLIBS)

Here is the source line. It is a one line function that
calls ::InterlockedIncrement in Windows. lpValue is an unsigned int*.

(Should the __sync... call actually use *lpValue? Is that the problem?)

	__sync_add_and_fetch( lpValue, 1 );

Here is the actual error text.

./mimio-mimiosys: symbol lookup
error: /home/Chuck/SWEngineering/builds/latest/Debug/products/mimio/mimiosys.so: undefined symbol: __sync_add_and_fetch_4

I assume that the appended _4 is due to an function overload.

Any ideas?

Despite what it sounds like, I really do appreciate the help that I have
been given. I am just very frustrated with this problem and my whole
Linux experience. I can't seem to get anything to work.

Chuck

On Wed, 2008-12-03 at 18:18 -0800, David Daney wrote:
> Charles Crisler wrote:
> > Thank you. I had already found your reference.
> > 
> > Which file contains the definition of this built-in function?
> > 
> 
> It is built-in to the compiler (that is why it is called a "Built-in 
> function for atomic memory access"), so it doesn't really exist in any 
> file external to the compiler.  The only place it is documented is in 
> the compiler's manual.
> 
> 
> > I suppose that I could write a main() that called an increment function
> > and that function could call this function.
> > 
> > What would you need? If I supply just source it would seem that wouldn't
> > be worth much.
> 
> I don't really understand your question.
> 
> You could look in the compiler's testsuite at these programs to see how 
> to use it:
> 
> gcc/testsuite/gcc.dg/sync-1.c
> gcc/testsuite/gcc.dg/sync-2.c
> gcc/testsuite/gcc.dg/sync-3.c
> 
> > 
> > My co-workers are using v. 4.2.4, though one just built the entire
> > system with 4.3.2 and it did not have this problem. However, I would
> > kind of like to isolate the problem before I upgrade, which is why I
> > asked about the file it is defined in. I greped -inr
> > "__sync_add_and_fetch" /usr/include/*.h and didn't find it. Since that
> > module compiles without a warning, that suggests that the compiler found
> > it.
> 
> See above, it doesn't exist external to the compiler.
> 
> 
> David Daney


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux