Making the CPU features variable non-static avoids the need for locking to ensure that the initialization is thread-safe which in turns eliminates the runtime dependency on libc++abi library (for cxa_guard_acquire and cxa_guard_release) which makes it possible to link scudo against pure C programs.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Herald added me as a reviewer because libc++ was in the title, but this looks OK to me.
If you want to continue stashing the results of getCPUFeatures() without requiring runtime guards I imagine something like this would work (At least in optimized builds):
bool testCPUFeatures(CPUFeature Feat) { static CPUIDRegs FeaturesRegs = {}; // shouldn't generate a guard. static bool RegsInit = false; // also shouldn't generate a guard. if (!RegsInit) { FeatureRegs = getCPUFeatures();; // Not thread safe but initialization doesn't depend on libc++abi. } // ... }