The atomics configury for sh in libstdc++ is quite poor, and duplicates the
generic atomicity files if  __SH4A__ is undefined. This is the only cpu
directory to do this, and leads to issues when the genric atomicity code is
updated: twice now the sh config has been left behind. This is no good. Let's
try to fix it.

See:
config/cpu/sh/atomicity.h

Some of this is probably related to the multiplicity of sh ISAs and the lack of
a specific SH atomic-instructions-presence macro coordinated with a target_cpu
value. For this, I blame sh or the gcc support of sh.

However, it's not sh's fault that there isn't a better way to do this in
libstdc++ and the file has to be duplicated.

Sometimes I think that we should redo atomics config yet again to do the
following:

1) compile-time check for atomic builtins, use if found
2) if not found, try one of the asm hacks, and *RUN* something with the found
config to see if it actually works
3) if none of the above work, use the *SINGLE* generic code with mutexes

And, all of these have to work for multilibs, and whatever weird thread config
that is passed down.

However, I'm a bit timid about doing this, since we really need compiler
support for 2 so that we can determine what the arch is for real when doing
multilibs. That, and I've thrashed the atomics config enough for one year while
ending up very close to the same place I started.


-- 
           Summary: atomics config for sh is wierd
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
  GCC host triplet: sh*-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29366

Reply via email to