Implement protected visibility. This partly implements PR1363. Linker

should be taught to deal with protected symbols.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov
2007-04-29 18:35:00 +00:00
parent c6c98af9e5
commit 6f9896fcc8
14 changed files with 57 additions and 18 deletions

View File

@@ -125,9 +125,13 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
break;
}
if (F->hasHiddenVisibility())
if (F->hasHiddenVisibility()) {
if (const char *Directive = TAI->getHiddenDirective())
O << Directive << CurrentFnName << "\n";
} else if (F->hasProtectedVisibility()) {
if (const char *Directive = TAI->getProtectedDirective())
O << Directive << CurrentFnName << "\n";
}
if (Subtarget->isTargetELF())
O << "\t.type " << CurrentFnName << ",@function\n";
@@ -322,7 +326,8 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
if (isCallOp && isa<Function>(GV)) {
if (printGOT(TM, Subtarget)) {
// Assemble call via PLT for non-local symbols
if (!GV->hasHiddenVisibility() || GV->isDeclaration())
if (!(GV->hasHiddenVisibility() || GV->hasProtectedVisibility()) ||
GV->isDeclaration())
O << "@PLT";
}
if (Subtarget->isTargetCygMing() && GV->isDeclaration())

View File

@@ -155,9 +155,14 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
unsigned Size = TD->getTypeSize(Type);
unsigned Align = TD->getPreferredAlignmentLog(I);
if (I->hasHiddenVisibility())
if (I->hasHiddenVisibility()) {
if (const char *Directive = TAI->getHiddenDirective())
O << Directive << name << "\n";
} else if (I->hasProtectedVisibility()) {
if (const char *Directive = TAI->getProtectedDirective())
O << Directive << name << "\n";
}
if (Subtarget->isTargetELF())
O << "\t.type " << name << ",@object\n";