Provide default implementation of different small-sections related stuff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53920 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 9125546..ad80413 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -231,6 +231,13 @@
      case SectionKind::RODataMergeConst:
       // No additional flags here
       break;
+     case SectionKind::SmallData:
+     case SectionKind::SmallBSS:
+      Flags |= SectionFlags::Writeable;
+      // FALLS THROUGH
+     case SectionKind::SmallROData:
+      Flags |= SectionFlags::Small;
+      break;
      default:
       assert(0 && "Unexpected section kind!");
     }
@@ -245,7 +252,9 @@
 
     // Some lame default implementation based on some magic section names.
     if (strncmp(Name, ".gnu.linkonce.b.", 16) == 0 ||
-        strncmp(Name, ".llvm.linkonce.b.", 17) == 0)
+        strncmp(Name, ".llvm.linkonce.b.", 17) == 0 ||
+        strncmp(Name, ".gnu.linkonce.sb.", 17) == 0 ||
+        strncmp(Name, ".llvm.linkonce.sb.", 18) == 0)
       Flags |= SectionFlags::BSS;
     else if (strcmp(Name, ".tdata") == 0 ||
              strncmp(Name, ".tdata.", 7) == 0 ||
@@ -297,12 +306,15 @@
   } else {
     if (Kind == SectionKind::Text)
       return getTextSection_();
-    else if (Kind == SectionKind::BSS && getBSSSection_())
+    else if ((Kind == SectionKind::BSS ||
+              Kind == SectionKind::SmallBSS) &&
+             getBSSSection_())
       return getBSSSection_();
     else if (getReadOnlySection_() &&
              (Kind == SectionKind::ROData ||
               Kind == SectionKind::RODataMergeConst ||
-              Kind == SectionKind::RODataMergeStr))
+              Kind == SectionKind::RODataMergeStr ||
+              Kind == SectionKind::SmallROData))
       return getReadOnlySection_();
   }
 
@@ -317,12 +329,18 @@
     return ".gnu.linkonce.t." + GV->getName();
    case SectionKind::Data:
     return ".gnu.linkonce.d." + GV->getName();
+   case SectionKind::SmallData:
+    return ".gnu.linkonce.s." + GV->getName();
    case SectionKind::BSS:
     return ".gnu.linkonce.b." + GV->getName();
+   case SectionKind::SmallBSS:
+    return ".gnu.linkonce.sb." + GV->getName();
    case SectionKind::ROData:
    case SectionKind::RODataMergeConst:
    case SectionKind::RODataMergeStr:
     return ".gnu.linkonce.r." + GV->getName();
+   case SectionKind::SmallROData:
+    return ".gnu.linkonce.s2." + GV->getName();
    case SectionKind::ThreadData:
     return ".gnu.linkonce.td." + GV->getName();
    case SectionKind::ThreadBSS: