[Lldb-commits] [lldb] r109792 - /lldb/trunk/source/Expression/ClangExpression.cpp

Sean Callanan scallanan at apple.com
Thu Jul 29 12:03:08 PDT 2010


Author: spyffe
Date: Thu Jul 29 14:03:08 2010
New Revision: 109792

URL: http://llvm.org/viewvc/llvm-project?rev=109792&view=rev
Log:
Fixed the expression code to use the right
code model with the JIT.

Modified:
    lldb/trunk/source/Expression/ClangExpression.cpp

Modified: lldb/trunk/source/Expression/ClangExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpression.cpp?rev=109792&r1=109791&r2=109792&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpression.cpp Thu Jul 29 14:03:08 2010
@@ -194,6 +194,8 @@
         m_target_triple = target_triple;
     else
         m_target_triple = llvm::sys::getHostTriple();
+    
+    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
 }
 
 
@@ -539,17 +541,6 @@
             m_jit_mm_ptr = new RecordingMemoryManager();
 
         //llvm::InitializeNativeTarget();
-                        
-        if (m_execution_engine.get() == 0)
-            m_execution_engine.reset(llvm::ExecutionEngine::createJIT (module, 
-                                                                       &error, 
-                                                                       m_jit_mm_ptr,
-                                                                       CodeGenOpt::Default,
-                                                                       true,
-                                                                       CodeModel::Default));
-        
-        m_execution_engine->DisableLazyCompilation();
-        llvm::Function *function = module->getFunction (llvm::StringRef (name));
         
         if (log)
         {
@@ -557,22 +548,33 @@
             
             switch (llvm::TargetMachine::getRelocationModel())
             {
-            case llvm::Reloc::Default:
-                relocation_model_string = "Default";
-                break;
-            case llvm::Reloc::Static:
-                relocation_model_string = "Static";
-                break;
-            case llvm::Reloc::PIC_:
-                relocation_model_string = "PIC_++";
-                break;
-            case llvm::Reloc::DynamicNoPIC:
-                relocation_model_string = "DynamicNoPIC";
-                break;
+                case llvm::Reloc::Default:
+                    relocation_model_string = "Default";
+                    break;
+                case llvm::Reloc::Static:
+                    relocation_model_string = "Static";
+                    break;
+                case llvm::Reloc::PIC_:
+                    relocation_model_string = "PIC_";
+                    break;
+                case llvm::Reloc::DynamicNoPIC:
+                    relocation_model_string = "DynamicNoPIC";
+                    break;
             }
             
             log->Printf("Target machine's relocation model: %s", relocation_model_string);
         }
+                        
+        if (m_execution_engine.get() == 0)
+            m_execution_engine.reset(llvm::ExecutionEngine::createJIT (module, 
+                                                                       &error, 
+                                                                       m_jit_mm_ptr,
+                                                                       CodeGenOpt::Default,
+                                                                       true,
+                                                                       CodeModel::Small)); // set to small so RIP-relative relocations work in PIC
+        
+        m_execution_engine->DisableLazyCompilation();
+        llvm::Function *function = module->getFunction (llvm::StringRef (name));
             
         // We don't actually need the function pointer here, this just forces it to get resolved.
         void *fun_ptr = m_execution_engine->getPointerToFunction(function);





More information about the lldb-commits mailing list