http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50457
--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-09-25 10:53:36 UTC --- (In reply to comment #4) > There is no glibc port for SH2* and highly unlikely someone will > add it. SH2* linux uses and will use totally different environment > instead of glibc/nptl. Those CPUs have no user/privilege modes and > folks tend to use disable/enable interrupts for the atomicity on them > like as in #0. > *-linux configuration of gcc assumes glibc/nptl everywhere. It means > that only sh[34]*-linux configuration will work well. For this PR, > the current atomic functions or builtins should be disabled for > sh2*-linux configuration and add something that works on SH2*. > You would have a free hand to the implementation in this case, > since currently there is nothing correct for SH2*. Thanks for the feedback. I'd like to propose to do the following ... - Add new option to select atomics model -matomic= With the following supported models: soft-gusa (SH3*, SH4* only) soft-tcb,gbr-offset=xxxx (SH1*,SH2*,SH3*,SH4*) hard-llcs (SH4A only) I think this is easier to handle than multiple individual options. - Make current option -msoft-atomic an alias for -matomic=soft-gusa. - Remove option -mhard-atomic. It's new in 4.8 and thus we don't need an alias for that. - Issue compiler error on unsupported atomic model for a given target (e.g. -m2a -matomic=soft-gusa --> error) - Add TCB (thread control block) soft atomics variations. BTW, they would be compatible across all SH 1..4 types. E.g. running precompiled SH2 libraries/binaries on SH4 would work -- if anyone wanted to do so. Does this make sense?