Fix folly::Singleton to work in dynamically linked binaries
Summary:This implements StaticSingletonManager which is then used to create all leaked Meyers singletons.
StaticSingletonManager is a singleton itself, which is created in a separate compilation unit (Singleton.cpp) and so we can be sure that other compilation units will always see a single instance of StaticSingletonManager, even if linked dynamically.
StaticSingletonManager then keeps a dictionary of typeid -> object pointer, which is used to de-duplicate same singleton being re-created from different compilation units (linked dynamically), usually because of code inlining.
override-unit-failures
Reviewed By: yfeldblum
Differential Revision:
D2913027
fb-gh-sync-id:
1f5015a79a7a8297ebf5f0fe3fd0cc7eb44f706b
shipit-source-id:
1f5015a79a7a8297ebf5f0fe3fd0cc7eb44f706b