Index: compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp +++ compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp @@ -70,10 +70,12 @@ // This must not happen lazily at symbolication time, because dlsym uses // malloc and thread-local storage, which is not a good thing to do during // symbolication. -static void InitializeSwiftDemangler() { - swift_demangle_f = (swift_demangle_ft)dlsym(RTLD_DEFAULT, "swift_demangle"); - (void)dlerror(); // Cleanup error message in case of failure -} +static struct InitializeSwiftDemangler { + InitializeSwiftDemangler() { + swift_demangle_f = (swift_demangle_ft)dlsym(RTLD_DEFAULT, "swift_demangle"); + (void)dlerror(); + } +} Initializer; // Attempts to demangle a Swift name. The demangler will return nullptr if a // non-Swift name is passed in. @@ -501,10 +503,7 @@ return new(symbolizer_allocator_) Symbolizer(list); } -void Symbolizer::LateInitialize() { - Symbolizer::GetOrInit(); - InitializeSwiftDemangler(); -} +void Symbolizer::LateInitialize() { Symbolizer::GetOrInit(); } } // namespace __sanitizer