Don't forget to emit the load from indirect symbol when using movw + movt to material...
[oota-llvm.git] / lib / Target / TargetLoweringObjectFile.cpp
index 0e67fe5d9877be59ef67df74e44bb328bfdaacef..681beec636bb63ed20ac31410113d0866c6d6be9 100644 (file)
@@ -169,6 +169,12 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV,
     switch (C->getRelocationInfo()) {
     default: assert(0 && "unknown relocation info kind");
     case Constant::NoRelocation:
+      // If the global is required to have a unique address, it can't be put
+      // into a mergable section: just drop it into the general read-only
+      // section instead.
+      if (!GVar->hasUnnamedAddr())
+        return SectionKind::getReadOnly();
+        
       // If initializer is a null-terminated string, put it in a "cstring"
       // section of the right width.
       if (const ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) {