Fix handling of multiple unnamed globals with the same type
[oota-llvm.git] / lib / VMCore / AsmWriter.cpp
index 349e1bd15fdc56e50e7805a2057cd302cce74966..ecdc521457f68ddc9261f1a8059e213a00ac07d6 100644 (file)
@@ -832,7 +832,12 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
     assert(C &&  "GlobalVar initializer isn't constant?");
     writeOperand(GV->getInitializer(), false, isa<GlobalValue>(C));
   }
-
+  
+  if (GV->hasSection())
+    Out << ", section \"" << GV->getSection() << '"';
+  if (GV->getAlignment())
+    Out << ", align " << GV->getAlignment();
+  
   printInfoComment(*GV);
   Out << "\n";
 }
@@ -940,6 +945,11 @@ void AssemblyWriter::printFunction(const Function *F) {
   }
   Out << ')';
 
+  if (F->hasSection())
+    Out << " section \"" << F->getSection() << '"';
+  if (F->getAlignment())
+    Out << " align " << F->getAlignment();
+
   if (F->isExternal()) {
     Out << "\n";
   } else {