From 0a1817392d3ad7ec2681e6bf495f490c443ec0b7 Mon Sep 17 00:00:00 2001 From: Lauro Ramos Venancio Date: Mon, 30 Apr 2007 00:23:51 +0000 Subject: [PATCH] Enable protected visibility on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36583 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMAsmPrinter.cpp | 19 +++++++++++++++---- lib/Target/ARM/ARMTargetAsmInfo.cpp | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index d8733789863..6cda7ebe1f6 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -210,9 +210,14 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) { break; } + const char *VisibilityDirective = NULL; if (F->hasHiddenVisibility()) - if (const char *Directive = TAI->getHiddenDirective()) - O << Directive << CurrentFnName << "\n"; + VisibilityDirective = TAI->getHiddenDirective(); + else if (F->hasProtectedVisibility()) + VisibilityDirective = TAI->getProtectedDirective(); + + if (VisibilityDirective) + O << VisibilityDirective << CurrentFnName << "\n"; if (AFI->isThumbFunction()) { EmitAlignment(AFI->getAlign(), F); @@ -791,9 +796,15 @@ bool ARMAsmPrinter::doFinalization(Module &M) { unsigned Size = TD->getTypeSize(Type); unsigned Align = TD->getPreferredAlignmentLog(I); + const char *VisibilityDirective = NULL; if (I->hasHiddenVisibility()) - if (const char *Directive = TAI->getHiddenDirective()) - O << Directive << name << "\n"; + VisibilityDirective = TAI->getHiddenDirective(); + else if (I->hasProtectedVisibility()) + VisibilityDirective = TAI->getProtectedDirective(); + + if (VisibilityDirective) + O << VisibilityDirective << name << "\n"; + if (Subtarget->isTargetELF()) O << "\t.type " << name << ",%object\n"; diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp index 3d24d60c6a6..b4b4da1826c 100644 --- a/lib/Target/ARM/ARMTargetAsmInfo.cpp +++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp @@ -27,6 +27,7 @@ ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) { SetDirective = "\t.set"; WeakRefDirective = "\t.weak_reference\t"; HiddenDirective = "\t.private_extern\t"; + ProtectedDirective = NULL; JumpTableDataSection = ".const"; CStringSection = "\t.cstring"; FourByteConstantSection = "\t.literal4\n";