Generalize

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54542 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index f7443c3..984c6b2 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -126,7 +126,8 @@
 
 X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
   X86TargetAsmInfo(TM), DarwinTargetAsmInfo(TM) {
-  bool is64Bit = DTM->getSubtarget<X86Subtarget>().is64Bit();
+  const X86Subtarget* Subtarget = &DTM->getSubtarget<X86Subtarget>();
+  bool is64Bit = Subtarget->is64Bit();
 
   AlignmentIsInBytes = false;
   TextAlignFillValue = 0x90;
@@ -156,7 +157,8 @@
   LCOMMDirective = "\t.lcomm\t";
   SwitchToSectionDirective = "\t.section ";
   StringConstantPrefix = "\1LC";
-  COMMDirectiveTakesAlignment = false;
+  // Leopard and above support aligned common symbols.
+  COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
   HasDotTypeDotSizeDirective = false;
   if (TM.getRelocationModel() == Reloc::Static) {
     StaticCtorsSection = ".constructor";