emit ELF .type directives through MCStreamer instead of doing it textually.

llvm-svn: 94436
This commit is contained in:
Chris Lattner 2010-01-25 18:33:40 +00:00
parent bc8f638531
commit bc696445e1
3 changed files with 4 additions and 9 deletions

View 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);

View 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");

View 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" <<