notes on current atomics config and usage

Paolo Carlini pcarlini@suse.de
Fri Jul 14 18:35:00 GMT 2006


Mark Mitchell wrote:

>Paolo Carlini wrote:
>
>>In fact, ideally, from the library point of view, we would like to
>>*inline* in the headers the builtin atomics and the user should not be
>>allowed to pass -march=i386 and obtain unresolved symbols at link time
>>too easily!
>>    
>>
>I'm not sure what you mean by this; if you use the intrinsics, then the
>compiler will do the inlining for you?  But, I think the headers should
>still permit compilation with -march=i386; there should be a macro to
>check, and libstdc++ should check it. :-)
>
As pointed out be Benjamin yesterday, there is a problem of consistency 
between the atomics used inside in the library and those used in the 
headers. If the user passes -march=i386 and doesn't want unresolved 
symbols at link time the only ways are: 1- Inline the mutexes, or, 2- 
Call mutexes inside the library. However, inside the library the atomics 
are using builtins, not mutexes, and that is the mechanism used by the 
whole library in its functioning, thus there are problems of 
interoperation between the library code and the user code.

Paolo.



More information about the Libstdc++ mailing list