]> granicus.if.org Git - clang/commitdiff
[driver] -mkernel implies -mstrict-align; don't add the redundant option.
authorChad Rosier <mcrosier@apple.com>
Thu, 29 Nov 2012 00:42:06 +0000 (00:42 +0000)
committerChad Rosier <mcrosier@apple.com>
Thu, 29 Nov 2012 00:42:06 +0000 (00:42 +0000)
rdar://12771737

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168841 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/apple-kext-mkernel.c

index 34fbfcf14eee8c92b12a5345eabbc939b0a34bcc..4d562d3f8bdc5b0fac848f00c321b54cc195ff23 100644 (file)
@@ -2508,7 +2508,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     StringRef alignment = Args.getLastArgValue(options::OPT_mstack_alignment);
     CmdArgs.push_back(Args.MakeArgString("-mstack-alignment=" + alignment));
   }
-  if (Args.hasArg(options::OPT_mstrict_align)) {
+  // -mkernel implies -mstrict-align; don't add the redundant option.
+  if (Args.hasArg(options::OPT_mstrict_align) && !KernelOrKext) {
     CmdArgs.push_back("-backend-option");
     CmdArgs.push_back("-arm-strict-align");
   }
index f8b7b90844a5b18108d73e2bfa13729ac3fb312f..8282c05dd8f18fc75968510c8a1420a3daa49550 100644 (file)
@@ -8,11 +8,12 @@
 // CHECK-X86: "-fno-common"
 
 // RUN: %clang -target x86_64-apple-darwin10 \
-// RUN:   -arch armv7 -mkernel -### -fsyntax-only %s 2> %t
+// RUN:   -arch armv7 -mkernel -mstrict-align -### -fsyntax-only %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ARM < %t %s
 
 // CHECK-ARM: "-backend-option" "-arm-long-calls"
 // CHECK-ARM: "-backend-option" "-arm-strict-align"
+// CHECK-ARM-NOT: "-backend-option" "-arm-strict-align"
 // CHECK-ARM: "-fno-builtin"
 // CHECK-ARM: "-fno-rtti"
 // CHECK-ARM: "-fno-common"