Strip the pointer casts from the constants here.
authorBill Wendling <isanbard@gmail.com>
Wed, 15 Feb 2012 09:14:08 +0000 (09:14 +0000)
committerBill Wendling <isanbard@gmail.com>
Wed, 15 Feb 2012 09:14:08 +0000 (09:14 +0000)
The c'tor list is stored as a list of 'void ()*'s, so all of the functions are
bitcast to that. However, the dyn_cast doesn't automagically look through
bitcasts. Do that for it.
<rdar://problem/10813350>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150572 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMAsmPrinter.cpp

index 234cf5166fb1040e4c0de8e809f67699024db1ed..2297390f664ebe095aabf4f90e3c17ca773683dd 100644 (file)
@@ -302,7 +302,7 @@ void ARMAsmPrinter::EmitXXStructor(const Constant *CV) {
   uint64_t Size = TM.getTargetData()->getTypeAllocSize(CV->getType());
   assert(Size && "C++ constructor pointer had zero size!");
 
-  const GlobalValue *GV = dyn_cast<GlobalValue>(CV);
+  const GlobalValue *GV = dyn_cast<GlobalValue>(CV->stripPointerCasts());
   assert(GV && "C++ constructor pointer was not a GlobalValue!");
 
   const MCExpr *E = MCSymbolRefExpr::Create(Mang->getSymbol(GV),