[Lldb-commits] [lldb] r234918 - Updated IRForTarget to change the way we generate

Sean Callanan scallanan at apple.com
Tue Apr 14 11:17:35 PDT 2015


Author: spyffe
Date: Tue Apr 14 13:17:35 2015
New Revision: 234918

URL: http://llvm.org/viewvc/llvm-project?rev=234918&view=rev
Log:
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.

Modified:
    lldb/trunk/source/Expression/IRForTarget.cpp
    lldb/trunk/test/lang/c/modules/TestCModules.py

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=234918&r1=234917&r2=234918&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Tue Apr 14 13:17:35 2015
@@ -2453,9 +2453,11 @@ IRForTarget::BuildRelocation(llvm::Type
     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;

Modified: lldb/trunk/test/lang/c/modules/TestCModules.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/modules/TestCModules.py?rev=234918&r1=234917&r2=234918&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/modules/TestCModules.py (original)
+++ lldb/trunk/test/lang/c/modules/TestCModules.py Tue Apr 14 13:17:35 2015
@@ -16,7 +16,6 @@ class CModulesTestCase(TestBase):
 
     @skipUnlessDarwin
     @dsym_test
-    @unittest2.expectedFailure("rdar://20416388")
     def test_expr_with_dsym(self):
         self.buildDsym()
         self.expr()
@@ -24,7 +23,6 @@ class CModulesTestCase(TestBase):
     @dwarf_test
     @skipIfFreeBSD
     @skipIfLinux
-    @unittest2.expectedFailure("rdar://20416388")
     def test_expr_with_dwarf(self):
         self.buildDwarf()
         self.expr()





More information about the lldb-commits mailing list