[llvm-commits] [llvm] r63269 - /llvm/trunk/lib/System/DynamicLibrary.cpp
Chris Lattner
sabre at nondot.org
Wed Jan 28 20:43:42 PST 2009
Author: lattner
Date: Wed Jan 28 22:43:42 2009
New Revision: 63269
URL: http://llvm.org/viewvc/llvm-project?rev=63269&view=rev
Log:
Fix PR3424, a static constructor ordering issue. Patch by Robert Schuster!
Modified:
llvm/trunk/lib/System/DynamicLibrary.cpp
Modified: llvm/trunk/lib/System/DynamicLibrary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrary.cpp?rev=63269&r1=63268&r2=63269&view=diff
==============================================================================
--- llvm/trunk/lib/System/DynamicLibrary.cpp (original)
+++ llvm/trunk/lib/System/DynamicLibrary.cpp Wed Jan 28 22:43:42 2009
@@ -18,11 +18,14 @@
#include <map>
// Collection of symbol name/value pairs to be searched prior to any libraries.
-static std::map<std::string, void *> g_symbols;
+std::map<std::string, void *> &g_symbols() {
+ static std::map<std::string, void *> symbols;
+ return symbols;
+}
void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName,
void *symbolValue) {
- g_symbols[symbolName] = symbolValue;
+ g_symbols()[symbolName] = symbolValue;
}
// It is not possible to use ltdl.c on VC++ builds as the terms of its LGPL
@@ -76,8 +79,8 @@
// check_ltdl_initialization();
// First check symbols added via AddSymbol().
- std::map<std::string, void *>::iterator I = g_symbols.find(symbolName);
- if (I != g_symbols.end())
+ std::map<std::string, void *>::iterator I = g_symbols().find(symbolName);
+ if (I != g_symbols().end())
return I->second;
// Now search the libraries.
More information about the llvm-commits
mailing list