From a85f0e82dc17687fea7534bee70ffd387d7a6953 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Mon, 6 Apr 2015 23:51:08 +0000 Subject: [PATCH] Fixed a crash because we weren't generating type-safe relocations against @reloc_placeholder. llvm-svn: 234260 --- lldb/source/Expression/IRForTarget.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index ca20afc7d472..842272602692 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -2455,10 +2455,11 @@ IRForTarget::BuildRelocation(llvm::Type *type, uint64_t offset) llvm::ArrayRef offsets(offset_array, 1); - llvm::Constant *reloc_getelementptr = ConstantExpr::getGetElementPtr(type, m_reloc_placeholder, offsets); - llvm::Constant *reloc_getbitcast = ConstantExpr::getBitCast(reloc_getelementptr, type); + 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_bitcast = ConstantExpr::getBitCast(reloc_getelementptr, type); - return reloc_getbitcast; + return reloc_bitcast; } bool