summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/IRForTarget.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2015-04-14 18:17:35 +0000
committerSean Callanan <scallanan@apple.com>2015-04-14 18:17:35 +0000
commit507b588a345adeeb74c4d6d520c6957ba3d35a7a (patch)
treefdd737cf27906bba39fcc19353b548c3382cde90 /lldb/source/Expression/IRForTarget.cpp
parent39fee0ae07bccdba5af67f3c7be5479914efc145 (diff)
downloadbcm5719-llvm-507b588a345adeeb74c4d6d520c6957ba3d35a7a.tar.gz
bcm5719-llvm-507b588a345adeeb74c4d6d520c6957ba3d35a7a.zip
Updated IRForTarget to change the way we generate
relocations. We used to do GEP on a pointer to the result type, which is wrong. We should be doing GEP on a pointer to char, which allows us to offset correctly. This fixes the C modules testcase, so it's no longer ExpectFail. llvm-svn: 234918
Diffstat (limited to 'lldb/source/Expression/IRForTarget.cpp')
-rw-r--r--lldb/source/Expression/IRForTarget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp
index 210ba65f665..b831baa7972 100644
--- a/lldb/source/Expression/IRForTarget.cpp
+++ b/lldb/source/Expression/IRForTarget.cpp
@@ -2453,9 +2453,11 @@ IRForTarget::BuildRelocation(llvm::Type *type, uint64_t offset)
offset_array[0] = offset_int;
llvm::ArrayRef<llvm::Constant *> offsets(offset_array, 1);
+ llvm::Type *char_type = llvm::Type::getInt8Ty(m_module->getContext());
+ llvm::Type *char_pointer_type = char_type->getPointerTo();
- llvm::Constant *reloc_placeholder_bitcast = ConstantExpr::getBitCast(m_reloc_placeholder, type->getPointerTo());
- llvm::Constant *reloc_getelementptr = ConstantExpr::getGetElementPtr(type, reloc_placeholder_bitcast, offsets);
+ llvm::Constant *reloc_placeholder_bitcast = ConstantExpr::getBitCast(m_reloc_placeholder, char_pointer_type);
+ llvm::Constant *reloc_getelementptr = ConstantExpr::getGetElementPtr(char_type, reloc_placeholder_bitcast, offsets);
llvm::Constant *reloc_bitcast = ConstantExpr::getBitCast(reloc_getelementptr, type);
return reloc_bitcast;
OpenPOWER on IntegriCloud