add support for hidden visibility to darwin/ppc and linux/ppc targets
authorChris Lattner <sabre@nondot.org>
Sun, 14 Jan 2007 06:37:54 +0000 (06:37 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 14 Jan 2007 06:37:54 +0000 (06:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33200 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/PowerPC/PPCTargetAsmInfo.cpp

index 194a499b8b4dc9db115cf385b7e4e6df2220077b..7db96a7f7899cbb8946c30871b0e96513e0383ca 100644 (file)
@@ -550,6 +550,11 @@ bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
     O << "\t.weak\t" << CurrentFnName << '\n';
     break;
   }
+  
+  if (F->hasHiddenVisibility())
+    if (const char *Directive = TAI->getHiddenDirective())
+      O << Directive << CurrentFnName << "\n";
+  
   EmitAlignment(2, F);
   O << CurrentFnName << ":\n";
 
@@ -608,8 +613,13 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
     // Check to see if this is a special global used by LLVM, if so, emit it.
     if (EmitSpecialLLVMGlobal(I))
       continue;
-    
+
     std::string name = Mang->getValueName(I);
+
+    if (I->hasHiddenVisibility())
+      if (const char *Directive = TAI->getHiddenDirective())
+        O << Directive << name << "\n";
+    
     Constant *C = I->getInitializer();
     unsigned Size = TD->getTypeSize(C->getType());
     unsigned Align = TD->getPreferredAlignmentLog(I);
@@ -749,6 +759,11 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
     O << "\t.weak_definition\t" << CurrentFnName << "\n";
     break;
   }
+  
+  if (F->hasHiddenVisibility())
+    if (const char *Directive = TAI->getHiddenDirective())
+      O << Directive << CurrentFnName << "\n";
+  
   EmitAlignment(4, F);
   O << CurrentFnName << ":\n";
 
@@ -840,6 +855,11 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
       continue;
     
     std::string name = Mang->getValueName(I);
+    
+    if (I->hasHiddenVisibility())
+      if (const char *Directive = TAI->getHiddenDirective())
+        O << Directive << name << "\n";
+    
     Constant *C = I->getInitializer();
     unsigned Size = TD->getTypeSize(C->getType());
     unsigned Align = TD->getPreferredAlignmentLog(I);
index 3def0316a7a6e9d1acc4fee5cfb6ac6ae77c5e71..6045cfa161d9e1ee958d24482122493bc3c194b5 100644 (file)
@@ -55,6 +55,7 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
   StaticDtorsSection = ".mod_term_func";
   UsedDirective = "\t.no_dead_strip\t";
   WeakRefDirective = "\t.weak_reference\t";
+  HiddenDirective = "\t.private_extern\t";
 }
 
 LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)