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

Andrew Lenharth alenhar2 at cs.uiuc.edu
Sat Feb 4 11:13:21 PST 2006



Changes in directory llvm/lib/Target/Alpha:

AlphaAsmPrinter.cpp updated: 1.29 -> 1.30
---
Log message:

linkage fix for weak functions

---
Diffs of the changes:  (+16 -3)

 AlphaAsmPrinter.cpp |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp
diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.29 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.30
--- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.29	Sun Jan 22 17:37:17 2006
+++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp	Sat Feb  4 13:13:09 2006
@@ -173,9 +173,22 @@
   EmitConstantPool(MF.getConstantPool());
 
   // Print out labels for the function.
-  SwitchSection("\t.section .text", MF.getFunction());
-  EmitAlignment(4);
-  O << "\t.globl " << CurrentFnName << "\n";
+  const Function *F = MF.getFunction();
+  SwitchSection(".text", F);
+  EmitAlignment(4, F);
+  switch (F->getLinkage()) {
+  default: assert(0 && "Unknown linkage type!");
+  case Function::InternalLinkage:  // Symbols default to internal.
+    break;
+   case Function::ExternalLinkage:
+     O << "\t.globl " << CurrentFnName << "\n";
+     break;
+  case Function::WeakLinkage:
+  case Function::LinkOnceLinkage:
+    O << "\t.weak " << CurrentFnName << "\n";
+    break;
+  }
+
   O << "\t.ent " << CurrentFnName << "\n";
 
   O << CurrentFnName << ":\n";






More information about the llvm-commits mailing list