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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37421 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-06-04 20:39:18 +00:00
parent 3ec425470f
commit 916d07cdfa

View File

@ -327,16 +327,18 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
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;
}