Fix several bugs in named sections handling

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53312 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 6d27d1f..483af12 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -235,7 +235,7 @@
   }
 
   // Add flags from sections, if any.
-  if (Name) {
+  if (Name && *Name) {
     Flags |= SectionFlags::Named;
 
     // Some lame default implementation based on some magic section names.
@@ -279,7 +279,7 @@
   // directive and also append funky flags. Otherwise - section name is just
   // some magic assembler directive.
   if (Flags & SectionFlags::Named)
-    Name = SwitchToSectionDirective + Name + PrintSectionFlags(Flags);
+    Name = getSwitchToSectionDirective() + Name + PrintSectionFlags(Flags);
 
   return Name;
 }