mcstreamerize .no_dead_strip and .reference for static ctors/dtors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94290 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp
index 9a1c41c..1b72f73 100644
--- a/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -245,8 +245,9 @@
     // This name has no connection to the function, so it might get
     // dead-stripped when the function is not, erroneously.  Prohibit
     // dead-stripping unconditionally.
-    if (const char *UsedDirective = MAI->getUsedDirective())
-      O << UsedDirective << *EHFrameInfo.FunctionEHSym << "\n\n";
+    if (MAI->hasNoDeadStrip())
+      Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
+                                           MCStreamer::NoDeadStrip);
   } else {
     O << *EHFrameInfo.FunctionEHSym << ":\n";
 
@@ -313,8 +314,9 @@
     // on unused functions (calling undefined externals) being dead-stripped to
     // link correctly.  Yes, there really is.
     if (MMI->isUsedFunction(EHFrameInfo.function))
-      if (const char *UsedDirective = MAI->getUsedDirective())
-        O << UsedDirective << *EHFrameInfo.FunctionEHSym << "\n\n";
+      if (MAI->hasNoDeadStrip())
+        Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym,
+                                             MCStreamer::NoDeadStrip);
   }
   Asm->O << '\n';
 }
@@ -982,7 +984,7 @@
   EmitLabel("eh_func_end", SubprogramCount);
   EmitExceptionTable();
 
-  const MCSymbol *FunctionEHSym =
+  MCSymbol *FunctionEHSym =
     Asm->GetSymbolWithGlobalValueBase(MF->getFunction(), ".eh",
                                       Asm->MAI->is_EHSymbolPrivate());