summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorAndrew Kaylor <andrew.kaylor@intel.com>2013-02-21 23:45:19 +0000
committerAndrew Kaylor <andrew.kaylor@intel.com>2013-02-21 23:45:19 +0000
commitcd5c7247ab895dfe4197e08736d025e807ce9bca (patch)
tree2a75e1650cde024a09b08babf1531b53d12b5691 /lldb
parent5f46c485148917307d544f943269b13f0c80dd32 (diff)
downloadbcm5719-llvm-cd5c7247ab895dfe4197e08736d025e807ce9bca.tar.gz
bcm5719-llvm-cd5c7247ab895dfe4197e08736d025e807ce9bca.zip
Change to JITDefault code model for ELF targets
On x86-64 platforms, the small code model assumes that code will be loaded below the 2GB boundary. With the static relocation model, the fact that the expression code is initially loaded (in the LLDB debugger address space) above that boundary causes problems. Switching to the JITDefault code model causes the large code model to be used for 64-bit targets and small code model of 32-bit targets. llvm-svn: 175828
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Expression/ClangExpressionParser.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp
index 05e26e18f05..1d86c9161b6 100644
--- a/lldb/source/Expression/ClangExpressionParser.cpp
+++ b/lldb/source/Expression/ClangExpressionParser.cpp
@@ -609,10 +609,18 @@ ClangExpressionParser::PrepareForExecution (lldb::addr_t &func_allocation_addr,
llvm::Triple triple(module_ap->getTargetTriple());
llvm::Function *function = module_ap->getFunction (function_name.c_str());
llvm::Reloc::Model relocModel;
+ llvm::CodeModel::Model codeModel;
if (triple.isOSBinFormatELF())
+ {
relocModel = llvm::Reloc::Static;
+ // This will be small for 32-bit and large for 64-bit.
+ codeModel = llvm::CodeModel::JITDefault;
+ }
else
+ {
relocModel = llvm::Reloc::PIC_;
+ codeModel = llvm::CodeModel::Small;
+ }
EngineBuilder builder(module_ap.release());
builder.setEngineKind(EngineKind::JIT)
.setErrorStr(&error_string)
@@ -620,7 +628,7 @@ ClangExpressionParser::PrepareForExecution (lldb::addr_t &func_allocation_addr,
.setJITMemoryManager(jit_memory_manager)
.setOptLevel(CodeGenOpt::Less)
.setAllocateGVsWithCode(true)
- .setCodeModel(CodeModel::Small)
+ .setCodeModel(codeModel)
.setUseMCJIT(true);
StringRef mArch;
OpenPOWER on IntegriCloud