emit ELF .type directives through MCStreamer instead of doing it textually.
authorChris Lattner <sabre@nondot.org>
Mon, 25 Jan 2010 18:33:40 +0000 (18:33 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 25 Jan 2010 18:33:40 +0000 (18:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94436 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/MC/MCAsmStreamer.cpp
lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp

index ecf18dad6b3060c5f77ecc8b4acb0d1fe3f6e1e0..8935445ade5571310915395c369f8d3cc853bbeb 100644 (file)
@@ -156,13 +156,8 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
   MCSymbol *GVSym = GetGlobalValueSymbol(GV);
   printVisibility(GVSym, GV->getVisibility());
 
-  if (MAI->hasDotTypeDotSizeDirective()) {
-    O << "\t.type\t" << *GVSym;
-    if (MAI->getCommentString()[0] != '@')
-      O << ",@object\n";
-    else
-      O << ",%object\n";
-  }
+  if (MAI->hasDotTypeDotSizeDirective())
+    OutStreamer.EmitSymbolAttribute(GVSym, MCSA_ELF_TypeObject);
   
   SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
 
index f577ad4b4b6bff24884c4245328949606bfbec33..9d9f46a37861d98460058ae8a4f169998a092943 100644 (file)
@@ -234,7 +234,7 @@ void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
   case MCSA_ELF_TypeCommon:      /// .type _foo, STT_COMMON  # aka @common
   case MCSA_ELF_TypeNoType:      /// .type _foo, STT_NOTYPE  # aka @notype
     assert(MAI.hasDotTypeDotSizeDirective() && "Symbol Attr not supported");
-    OS << ".type " << *Symbol << ','
+    OS << "\t.type " << *Symbol << ','
        << ((MAI.getCommentString()[0] != '@') ? '@' : '%');
     switch (Attribute) {
     default: assert(0 && "Unknown ELF .type");
index 2ffa18ff5ac9c642cfa037de7f29f183f9c9abf8..85ff09a3be546bc9f267a5bbf9397b05a8bde07a 100644 (file)
@@ -106,7 +106,7 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
   printVisibility(CurrentFnSym, F->getVisibility());
 
   if (Subtarget->isTargetELF()) {
-    O << "\t.type\t" << *CurrentFnSym << ",@function\n";
+    OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_ELF_TypeFunction);
   } else if (Subtarget->isTargetCygMing()) {
     O << "\t.def\t " << *CurrentFnSym;
     O << ";\t.scl\t" <<