diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h --- a/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -427,10 +427,6 @@ virtual void EmitFunctionEntryLabel(); - virtual void EmitFunctionDescriptor() { - llvm_unreachable("Function descriptor is target-specific."); - } - virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV); /// Targets can override this to change how global constants that are part of diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h --- a/llvm/include/llvm/MC/MCAsmInfo.h +++ b/llvm/include/llvm/MC/MCAsmInfo.h @@ -400,9 +400,6 @@ // %hi(), and similar unary operators. bool HasMipsExpressions = false; - // If true, emit function descriptor symbol on AIX. - bool NeedsFunctionDescriptors = false; - public: explicit MCAsmInfo(); virtual ~MCAsmInfo(); @@ -665,7 +662,6 @@ bool canRelaxRelocations() const { return RelaxELFRelocations; } void setRelaxELFRelocations(bool V) { RelaxELFRelocations = V; } bool hasMipsExpressions() const { return HasMipsExpressions; } - bool needsFunctionDescriptors() const { return NeedsFunctionDescriptors; } }; } // end namespace llvm diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -667,7 +667,7 @@ OutStreamer->SwitchSection(getObjFileLowering().SectionForGlobal(&F, TM)); EmitVisibility(CurrentFnSym, F.getVisibility()); - if (MAI->needsFunctionDescriptors() && + if (TM.getTargetTriple().isOSAIX() && F.getLinkage() != GlobalValue::InternalLinkage) EmitLinkage(&F, CurrentFnDescSym); @@ -706,11 +706,6 @@ } } - // Emit the function descriptor. This is a virtual function to allow targets - // to emit their specific function descriptor. - if (MAI->needsFunctionDescriptors()) - EmitFunctionDescriptor(); - // Emit the CurrentFnSym. This is a virtual function to allow targets to do // their wild and crazy things as required. EmitFunctionEntryLabel(); @@ -1665,9 +1660,7 @@ const Function &F = MF.getFunction(); // Get the function symbol. - if (MAI->needsFunctionDescriptors()) { - assert(TM.getTargetTriple().isOSAIX() && "Function descriptor is only" - " supported on AIX."); + if (TM.getTargetTriple().isOSAIX()) { assert(CurrentFnDescSym && "The function descriptor symbol needs to be" " initalized first."); diff --git a/llvm/lib/MC/MCAsmInfoXCOFF.cpp b/llvm/lib/MC/MCAsmInfoXCOFF.cpp --- a/llvm/lib/MC/MCAsmInfoXCOFF.cpp +++ b/llvm/lib/MC/MCAsmInfoXCOFF.cpp @@ -20,7 +20,6 @@ UseDotAlignForAlignment = true; AsciiDirective = nullptr; // not supported AscizDirective = nullptr; // not supported - NeedsFunctionDescriptors = true; HasDotLGloblDirective = true; Data64bitsDirective = "\t.llong\t"; SupportsQuotedNames = false; diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -165,7 +165,7 @@ void EmitGlobalVariable(const GlobalVariable *GV) override; - void EmitFunctionDescriptor() override; + void EmitFunctionEntryLabel() override; void EmitEndOfAsmFile(Module &) override; }; @@ -1670,7 +1670,7 @@ EmitGlobalConstant(GV->getParent()->getDataLayout(), GV->getInitializer()); } -void PPCAIXAsmPrinter::EmitFunctionDescriptor() { +void PPCAIXAsmPrinter::EmitFunctionEntryLabel() { const DataLayout &DL = getDataLayout(); const unsigned PointerSize = DL.getPointerSizeInBits() == 64 ? 8 : 4; @@ -1693,6 +1693,7 @@ OutStreamer->EmitIntValue(0, PointerSize); OutStreamer->SwitchSection(Current.first, Current.second); + AsmPrinter::EmitFunctionEntryLabel(); } void PPCAIXAsmPrinter::EmitEndOfAsmFile(Module &M) {