Rewrite cxa guard implementation.

This patch does three main things:
  (1) It re-writes the cxa guard implementation to make it testable.
  (2) Adds support for recursive init detection on non-apple platforms.
  (3) It adds a futex based implementation.

The futex based implementation locks and notifies on a per-object basis, unlike the
current implementation which uses a global lock for all objects. Once this patch settles
I'll turn it on by default when supported.

llvm-svn: 359060
GitOrigin-RevId: 70ebeabfb8330f805a26dbb2f8af77fb0ab0c5f0
5 files changed