Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -590,6 +590,8 @@ // Determine to which section this global should be emitted. MCSection *TheSection = getObjFileLowering().SectionForGlobal(GV, GVKind, TM); + ((GlobalVariable *) GV)->setSection(TheSection->getName()); + // If we have a bss global going to a section that supports the // zerofill directive, do so here. if (GVKind.isBSS() && MAI->hasMachoZeroFillDirective() &&