[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

Evan Cheng evan.cheng at apple.com
Mon Jun 4 13:40:12 PDT 2007



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.164 -> 1.165
---
Log message:

Global ctors / dtors alignment shouldn't be hard-coded at 4. e.g. It could be 8 for 64-bit targets.

---
Diffs of the changes:  (+4 -2)

 AsmPrinter.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.164 llvm/lib/CodeGen/AsmPrinter.cpp:1.165
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.164	Thu May 31 13:57:45 2007
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Mon Jun  4 15:39:18 2007
@@ -327,16 +327,18 @@
     return true;
   }
 
+  const TargetData *TD = TM.getTargetData();
+  unsigned Align = Log2_32(TD->getPointerPrefAlignment());
   if (GV->getName() == "llvm.global_ctors" && GV->use_empty()) {
     SwitchToDataSection(TAI->getStaticCtorsSection());
-    EmitAlignment(2, 0);
+    EmitAlignment(Align, 0);
     EmitXXStructorList(GV->getInitializer());
     return true;
   } 
   
   if (GV->getName() == "llvm.global_dtors" && GV->use_empty()) {
     SwitchToDataSection(TAI->getStaticDtorsSection());
-    EmitAlignment(2, 0);
+    EmitAlignment(Align, 0);
     EmitXXStructorList(GV->getInitializer());
     return true;
   }






More information about the llvm-commits mailing list