From d1376d137030d8b6aa628cedab8fd7e1e400ab5e Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 18 May 2014 06:42:02 +0000 Subject: [PATCH] Driver: force restricted IT blocks for Windows on ARM Windows on ARM expects ARMv8 (restricted IT) conditional instructions only. Force enable the restricted IT mode via the backend option when targeting WoA. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209086 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 5 +++++ test/Driver/woa-restrict-it.c | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 test/Driver/woa-restrict-it.c diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index b0425cbe08..7862ffb446 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3451,6 +3451,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-backend-option"); CmdArgs.push_back("-arm-no-restrict-it"); } + } else if (TT.isOSWindows() && (TT.getArch() == llvm::Triple::arm || + TT.getArch() == llvm::Triple::thumb)) { + // Windows on ARM expects restricted IT blocks + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-arm-restrict-it"); } // Forward -f options with positive and negative forms; we translate diff --git a/test/Driver/woa-restrict-it.c b/test/Driver/woa-restrict-it.c new file mode 100644 index 0000000000..c046991ae1 --- /dev/null +++ b/test/Driver/woa-restrict-it.c @@ -0,0 +1,4 @@ +// RUN: %clang -target armv7-windows -### %s 2>&1 | FileCheck %s + +// CHECK: "-backend-option" "-arm-restrict-it" + -- 2.40.0