Make the big switch: Change MCSectionMachO to represent a section *semantically*
instead of syntactically as a string.  This means that it keeps track of the 
segment, section, flags, etc directly and asmprints them in the right format.
This also includes parsing and validation support for llvm-mc and 
"attribute(section)", so we should now start getting errors about invalid 
section attributes from the compiler instead of the assembler on darwin.

Still todo: 
1) Uniquing of darwin mcsections
2) Move all the Darwin stuff out to MCSectionMachO.[cpp|h]
3) there are a few FIXMEs, for example what is the syntax to get the
   S_GB_ZEROFILL segment type?



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78547 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index ca61d55..9f79938 100644
--- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -1286,19 +1286,21 @@
     O << '\n';
     
     if (!FnStubs.empty()) {
-      const MCSection *StubSection;
-      if (TM.getRelocationModel() == Reloc::PIC_)
-        StubSection = TLOFMacho.getMachOSection(".section __TEXT,__picsymbolstu"
-                                                "b4,symbol_stubs,none,16", true,
-                                                SectionKind::getText());
-      else
-        StubSection = TLOFMacho.getMachOSection(".section __TEXT,__symbol_stub4"
-                                                ",symbol_stubs,none,12", true,
-                                                SectionKind::getText());
+      unsigned StubSize = 12;
+      const char *StubSectionName = "__symbol_stub4";
+      
+      if (TM.getRelocationModel() == Reloc::PIC_) {
+        StubSize = 16;
+        StubSectionName = "__picsymbolstub4";
+      }
+      
+      const MCSection *StubSection
+        = TLOFMacho.getMachOSection("__TEXT", StubSectionName,
+                                    MCSectionMachO::S_SYMBOL_STUBS,
+                                    StubSize, SectionKind::getText());
 
       const MCSection *LazySymbolPointerSection
-        = TLOFMacho.getMachOSection(".lazy_symbol_pointer", true,
-                                    SectionKind::getMetadata());
+        = TLOFMacho.getLazySymbolPointerSection();
     
       // Output stubs for dynamically-linked functions
       for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(),
@@ -1333,9 +1335,8 @@
     
     // Output non-lazy-pointers for external and common global variables.
     if (!GVNonLazyPtrs.empty()) {
-      SwitchToSection(TLOFMacho.getMachOSection(".non_lazy_symbol_pointer",
-                                                true,
-                                                SectionKind::getMetadata()));
+      // Switch with ".non_lazy_symbol_pointer" directive.
+      SwitchToSection(TLOFMacho.getNonLazySymbolPointerSection());
       for (StringMap<std::string>::iterator I = GVNonLazyPtrs.begin(),
            E = GVNonLazyPtrs.end(); I != E; ++I) {
         O << I->second << ":\n";