'static const void *X = &&y' can only be put in the
authorChris Lattner <sabre@nondot.org>
Wed, 28 Oct 2009 04:12:16 +0000 (04:12 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 28 Oct 2009 04:12:16 +0000 (04:12 +0000)
readonly section if a reference to the containing function
is valid in the readonly section.

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

lib/VMCore/Constants.cpp

index c2402da257bd519767e51a939a8f43fa69f960a1..31d850cfc0e30ff3980e272a5829b4655c57a12b 100644 (file)
@@ -182,6 +182,9 @@ Constant::PossibleRelocationsTy Constant::getRelocationInfo() const {
     return GlobalRelocations;    // Global reference.
   }
   
+  if (const BlockAddress *BA = dyn_cast<BlockAddress>(this))
+    return BA->getFunction()->getRelocationInfo();
+  
   PossibleRelocationsTy Result = NoRelocation;
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
     Result = std::max(Result, getOperand(i)->getRelocationInfo());