llvm.org GIT mirror llvm / 446531e
Add DisableGVCompilation which forces the JIT to assert when it tries to allocate space for a GlobalVariable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56557 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 12 years ago
3 changed file(s) with 16 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
6464 const TargetData *TD;
6565 ExecutionEngineState state;
6666 bool LazyCompilationDisabled;
67 bool GVCompilationDisabled;
6768 bool SymbolSearchingDisabled;
6869
6970 protected:
253254 bool isLazyCompilationDisabled() const {
254255 return LazyCompilationDisabled;
255256 }
257
258 /// DisableGVCompilation - If called, the JIT will abort if it's asked to allocate
259 /// space and populate a GlobalVariable.
260 void DisableGVCompilation(bool Disabled = true) {
261 GVCompilationDisabled = Disabled;
262 }
263 bool isGVCompilationDisabled() const {
264 return GVCompilationDisabled;
265 }
266
256267 /// DisableSymbolSearching - If called, the JIT will not try to lookup unknown
257268 /// symbols with dlsym. A client can still use InstallLazyFunctionCreator to
258269 /// resolve symbols in a custom way.
3939
4040 ExecutionEngine::ExecutionEngine(ModuleProvider *P) : LazyFunctionCreator(0) {
4141 LazyCompilationDisabled = false;
42 GVCompilationDisabled = false;
4243 SymbolSearchingDisabled = false;
4344 Modules.push_back(P);
4445 assert(P && "ModuleProvider is null?");
551551 addGlobalMapping(GV, Ptr);
552552 }
553553 } else {
554 if (isGVCompilationDisabled()) {
555 cerr << "Compilation of GlobalVariable is disabled!\n";
556 abort();
557 }
554558 // If the global hasn't been emitted to memory yet, allocate space and
555559 // emit it into memory. It goes in the same array as the generated
556560 // code, jump tables, etc.