[llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp

Anton Korobeynikov asl at math.spbu.ru
Fri Jan 12 11:21:21 PST 2007



Changes in directory llvm/lib/Target/CBackend:

CBackend.cpp updated: 1.313 -> 1.314
---
Log message:

* PIC codegen for X86/Linux has been implemented
* PIC-aware internal structures in X86 Codegen have been refactored
* Visibility (default/weak) has been added
* Docs fixes (external weak linkage, visibility, formatting)


---
Diffs of the changes:  (+12 -0)

 CBackend.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+)


Index: llvm/lib/Target/CBackend/CBackend.cpp
diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.313 llvm/lib/Target/CBackend/CBackend.cpp:1.314
--- llvm/lib/Target/CBackend/CBackend.cpp:1.313	Fri Jan 12 01:05:13 2007
+++ llvm/lib/Target/CBackend/CBackend.cpp	Fri Jan 12 13:20:47 2007
@@ -1290,6 +1290,11 @@
       << "#define __ATTRIBUTE_WEAK__\n"
       << "#endif\n\n";
 
+  // Add hidden visibility support. FIXME: APPLE_CC?
+  Out << "#if defined(__GNUC__)\n"
+      << "#define __HIDDEN__ __attribute__((visibility(\"hidden\")))\n"
+      << "#endif\n\n";
+    
   // Define NaN and Inf as GCC builtins if using GCC, as 0 otherwise
   // From the GCC documentation:
   //
@@ -1500,6 +1505,8 @@
         Out << " __ATTRIBUTE_CTOR__";
       if (StaticDtors.count(I))
         Out << " __ATTRIBUTE_DTOR__";
+      if (I->hasHiddenVisibility())
+        Out << " __HIDDEN__";
       
       if (I->hasName() && I->getName()[0] == 1)
         Out << " LLVM_ASM(\"" << I->getName().c_str()+1 << "\")";
@@ -1531,6 +1538,8 @@
           Out << " __ATTRIBUTE_WEAK__";
         else if (I->hasExternalWeakLinkage())
           Out << " __EXTERNAL_WEAK__";
+        if (I->hasHiddenVisibility())
+          Out << " __HIDDEN__";
         Out << ";\n";
       }
   }
@@ -1559,6 +1568,9 @@
         else if (I->hasWeakLinkage())
           Out << " __ATTRIBUTE_WEAK__";
 
+        if (I->hasHiddenVisibility())
+          Out << " __HIDDEN__";
+        
         // If the initializer is not null, emit the initializer.  If it is null,
         // we try to avoid emitting large amounts of zeros.  The problem with
         // this, however, occurs when the variable has weak linkage.  In this






More information about the llvm-commits mailing list