Driver/Darwin/ARM: Kernel/kext code has more strict alignment requirements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2011-03-17 17:10:06 +00:00
Родитель a085da8624
Коммит fa41d69750
3 изменённых файлов: 34 добавлений и 11 удалений

Просмотреть файл

@ -420,7 +420,8 @@ static bool isSignedCharDefault(const llvm::Triple &Triple) {
}
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 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
// 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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
case llvm::Triple::arm:
case llvm::Triple::thumb:
AddARMTargetArgs(Args, CmdArgs);
AddARMTargetArgs(Args, CmdArgs, KernelOrKext);
break;
case llvm::Triple::mips:

Просмотреть файл

@ -34,7 +34,8 @@ namespace tools {
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;

Просмотреть файл

@ -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"