This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH [gcc and libstdc++] for memory barriers in staticinitalization
On Fri, 24 Dec 2004 10:29:17 -0500
Jason Merrill <jason@redhat.com> wrote:
> Good to know. So do you think the SPARC port should define the macros or
> not?
To be absolutely safe, probably yes, and then you're in a real pickle wrt.
implementing the atomic_word.h header file. :-)
The problem is that you can't emit the "membar #foo" memory barrier
instructions unless we're generating code where we know we will execute
on a v9 processor. Yet, since v7/v8 programs execute on v9 processors
you will need the memory barriers there somehow.
v7 provides no memory barrier instructions
v8 provides on a "stbar" which orders stores with respect to
each other, but nothing more
Good luck :-)
If you don't define the macros, things will work on all current
systems I am aware of which provide effectively TSO semantics
to userland in one way or another. But some system may break
one day on Ultra-I/II/IIi chips if RMO is used in userland at
some point.