[cfe-commits] r127815 - in /cfe/trunk: lib/Driver/Tools.cpp lib/Driver/Tools.h test/Driver/apple-kext-mkernel.c
Daniel Dunbar
daniel at zuster.org
Thu Mar 17 10:10:06 PDT 2011
Author: ddunbar
Date: Thu Mar 17 12:10:06 2011
New Revision: 127815
URL: http://llvm.org/viewvc/llvm-project?rev=127815&view=rev
Log:
Driver/Darwin/ARM: Kernel/kext code has more strict alignment requirements.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
cfe/trunk/test/Driver/apple-kext-mkernel.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=127815&r1=127814&r2=127815&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar 17 12:10:06 2011
@@ -420,7 +420,8 @@
}
void Clang::AddARMTargetArgs(const ArgList &Args,
- ArgStringList &CmdArgs) const {
+ ArgStringList &CmdArgs,
+ bool KernelOrKext) const {
const Driver &D = getToolChain().getDriver();
llvm::Triple Triple = getToolChain().getTriple();
@@ -587,8 +588,17 @@
// Setting -msoft-float effectively disables NEON because of the GCC
// implementation, although the same isn't true of VFP or VFP3.
if (FloatABI == "soft") {
- CmdArgs.push_back("-target-feature");
- CmdArgs.push_back("-neon");
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("-neon");
+ }
+
+ // Kernel code has more strict alignment requirements.
+ if (KernelOrKext) {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("-arm-long-calls");
+
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("-arm-strict-align");
}
}
@@ -1173,7 +1183,7 @@
case llvm::Triple::arm:
case llvm::Triple::thumb:
- AddARMTargetArgs(Args, CmdArgs);
+ AddARMTargetArgs(Args, CmdArgs, KernelOrKext);
break;
case llvm::Triple::mips:
Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=127815&r1=127814&r2=127815&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Thu Mar 17 12:10:06 2011
@@ -34,7 +34,8 @@
const InputInfo &Output,
const InputInfoList &Inputs) const;
- void AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
+ void AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs,
+ bool KernelOrKext) const;
void AddMIPSTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
void AddSparcTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
void AddX86TargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
Modified: cfe/trunk/test/Driver/apple-kext-mkernel.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/apple-kext-mkernel.c?rev=127815&r1=127814&r2=127815&view=diff
==============================================================================
--- cfe/trunk/test/Driver/apple-kext-mkernel.c (original)
+++ cfe/trunk/test/Driver/apple-kext-mkernel.c Thu Mar 17 12:10:06 2011
@@ -1,6 +1,18 @@
-// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -mkernel -### -fsyntax-only %s 2> %t
-// RUN grep "-disable-red-zone" %t
-// RUN grep "-fapple-kext" %t
-// RUN grep "-fno-builtin" %t
-// RUN grep "-fno-rtti" %t
-// RUN grep "-fno-common" %t
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 \
+// RUN: -mkernel -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-X86 < %t %s
+
+// CHECK-X86: "-disable-red-zone"
+// CHECK-X86: "-fno-builtin"
+// CHECK-X86: "-fno-rtti"
+// CHECK-X86: "-fno-common"
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 \
+// RUN: -arch armv7 -mkernel -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ARM < %t %s
+
+// CHECK-ARM: "-target-feature" "-arm-long-calls"
+// CHECK-ARM: "-target-feature" "-arm-strict-align"
+// CHECK-ARM: "-fno-builtin"
+// CHECK-ARM: "-fno-rtti"
+// CHECK-ARM: "-fno-common"
More information about the cfe-commits
mailing list