It's not legal to output a GV in a coalesced section if it's used in an ARM PIC relat...
[oota-llvm.git] / lib / Target / Mips / MipsTargetAsmInfo.cpp
index d1fadc0e7359c8a51500c8790272e6c145acf039..eff69abc6db28c066254edbf051109537ee20d30 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "MipsTargetAsmInfo.h"
 #include "MipsTargetMachine.h"
+#include "llvm/GlobalVariable.h"
 
 using namespace llvm;
 
@@ -32,9 +33,8 @@ MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM):
   ReadOnlySection             = "\t.rdata";
   ZeroDirective               = "\t.space\t";
   BSSSection                  = "\t.section\t.bss";
-  LCOMMDirective              = "\t.lcomm\t";
   CStringSection              = ".rodata.str";
-  FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
+  FourByteConstantSection     = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
 
   if (!Subtarget->hasABICall()) {
     JumpTableDirective = "\t.word\t";
@@ -46,14 +46,22 @@ MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM):
 
 }
 
-SectionKind::Kind
-MipsTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
+unsigned MipsTargetAsmInfo::
+SectionFlagsForGlobal(const GlobalValue *GV, const char* Name) const {
+  unsigned Flags = ELFTargetAsmInfo::SectionFlagsForGlobal(GV, Name);
+  // Mask out Small Section flag bit, Mips doesnt support 's' section symbol
+  // for its small sections.
+  return (Flags & (~SectionFlags::Small));
+}
+
+SectionKind::Kind MipsTargetAsmInfo::
+SectionKindForGlobal(const GlobalValue *GV) const {
   SectionKind::Kind K = ELFTargetAsmInfo::SectionKindForGlobal(GV);
 
   if (Subtarget->hasABICall())
     return K;
 
-  if (K != SectionKind::Data && K != SectionKind::BSS && 
+  if (K != SectionKind::Data && K != SectionKind::BSS &&
       K != SectionKind::RODataMergeConst)
     return K;
 
@@ -61,7 +69,7 @@ MipsTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
     const TargetData *TD = ETM->getTargetData();
     unsigned Size = TD->getABITypeSize(GV->getType()->getElementType());
     unsigned Threshold = Subtarget->getSSectionThreshold();
-     
+
     if (Size > 0 && Size <= Threshold) {
       if (K == SectionKind::BSS)
         return SectionKind::SmallBSS;
@@ -73,8 +81,8 @@ MipsTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
   return K;
 }
 
-const Section*
-MipsTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
+const Section* MipsTargetAsmInfo::
+SelectSectionForGlobal(const GlobalValue *GV, bool NoCoalesce) const {
   SectionKind::Kind K = SectionKindForGlobal(GV);
   const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV);