On 16/07/14 23:01, Johan Tibell wrote: > The documentation of the __sync atomic builtins [1] state that > >> Not all operations are supported by all target processors. If a >> particular operation cannot be implemented on the target processor, >> a warning is generated and a call an external function is >> generated. The external function carries the same name as the >> built-in version, with an additional suffix ‘_n’ where n is the >> size of the data type. > > I initial read this as a call to some function *defined by GCC* is > being emitted, but I now realize that this can be read as "the caller > is supposed to have defined such a fallback function". Which reading > is correct? The latter. Hwever, in some cases in may not even be possible: the hardware may be incapable of doing it. > I have some code that fails to compile on i386 with the error > > /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.9.20140716.so: > undefined reference to `__sync_fetch_and_add_8' > > so I guess that means that GCC is not defining these external fallback > functions? My guess is that you're building for an x86 that can't do it. -march=i586 ought to work. i386 won't. Andrew.