From: Chad Rosier Date: Thu, 29 Nov 2012 00:42:06 +0000 (+0000) Subject: [driver] -mkernel implies -mstrict-align; don't add the redundant option. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=586a061ad96f750e2a5aefcf3e2ce9e5474cdd61;p=clang [driver] -mkernel implies -mstrict-align; don't add the redundant option. rdar://12771737 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168841 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 34fbfcf14e..4d562d3f8b 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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"); } diff --git a/test/Driver/apple-kext-mkernel.c b/test/Driver/apple-kext-mkernel.c index f8b7b90844..8282c05dd8 100644 --- a/test/Driver/apple-kext-mkernel.c +++ b/test/Driver/apple-kext-mkernel.c @@ -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"