This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: notes on current atomics config and usage


Benjamin Kosnik wrote:

One of the weaknesses of the above three-part plan is that with this in
place, and somebody who builds libstdc++ with CXXFLAGS="-march=i686",
then they get the builtin atomics. Cool: this is probably exactly what
they were expecting.

However, if they install this as a system lib then all users are going
to have to use the -march flag exactly as configured or else they'll
get synthesized calls to non-existent builtin atomics functions. (since
without the -march flag the default arch for this platform is i386,
with no builtin atomics.)


I see this point in a slightly different way. It all depends on whether the atomics (implemented in terms of underlying builtins) are part of the library, i.e., exported, or not. If they are part of the library, then the user code, irrespective of the -march, will call into the library and all will be fine. If, on the other hand, the atomics are inlined, then the issue is for our *headers* to recognize the actual -march (via __GCC_ATOMIC_BUILTINS, I can't see any other way...) and do the right thing.

Of course, I'm not considering *static* linking, which would give us troubles anyway, I think it *already* does if one builds a program on a machine using the atomics in config/cpu/i486 and then tries to use it on an i386...

Paolo.


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