Define a build-time configuration option for the XRay runtime to
determine whether the archive will add an entry to the .preinit_array
section of the binary. We also allow for initializing the XRay data
structures with an explicit call to __xray_init(). This allows us to
give users the capability to initialize the XRay data structures on
demand.
This can allow us to start porting XRay to platforms where
.preinit_array isn't a supported section. It also allows us to limit
the effects of XRay in the initialization sequence for applications that
are sensitive to this kind of interference (i.e. large binaries) or
those that want to package XRay control in libraries.
Future changes should allow us to build two different library archives
for the XRay runtime, and allow clang users to determine which version
to link.
Are callers expected to synchronize before calling __xray_init()? Is it even legal to call this function more than once? This should be documented in the header.