diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp --- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp +++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp @@ -824,7 +824,8 @@ if (Arg *A = Args.getLastArg(options::OPT_mexecute_only, options::OPT_mno_execute_only)) { if (A->getOption().matches(options::OPT_mexecute_only)) { if (getARMSubArchVersionNumber(Triple) < 7 && - llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::ArchKind::ARMV6T2) + llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::ArchKind::ARMV6T2 && + llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::ArchKind::ARMV6M) D.Diag(diag::err_target_unsupported_execute_only) << Triple.getArchName(); else if (Arg *B = Args.getLastArg(options::OPT_mno_movt)) D.Diag(diag::err_opt_not_valid_with_opt) diff --git a/clang/test/Driver/arm-execute-only.c b/clang/test/Driver/arm-execute-only.c --- a/clang/test/Driver/arm-execute-only.c +++ b/clang/test/Driver/arm-execute-only.c @@ -1,19 +1,22 @@ -// RUN: not %clang -c -target thumbv6m-eabi -mexecute-only %s 2>&1 | \ +// RUN: %clang -c -fdriver-only -Werror --target=arm-arm-none-eabi \ +// RUN: -march=armv6-m -mexecute-only %s 2>&1 | count 0 + +// RUN: %clang -### -c --target=arm-arm-none-eabi -march=armv6 -mexecute-only %s 2>&1 | \ // RUN: FileCheck --check-prefix CHECK-EXECUTE-ONLY-NOT-SUPPORTED %s -// CHECK-EXECUTE-ONLY-NOT-SUPPORTED: error: execute only is not supported for the thumbv6m sub-architecture +// CHECK-EXECUTE-ONLY-NOT-SUPPORTED: error: execute only is not supported for the armv6 sub-architecture -// RUN: not %clang -target armv8m.main-eabi -mexecute-only -mno-movt %s 2>&1 \ +// RUN: %clang -### --target=arm-arm-none-eabi -march=armv8-m.main -mexecute-only -mno-movt %s 2>&1 \ // RUN: | FileCheck %s -check-prefix CHECK-EXECUTE-ONLY-NO-MOVT // CHECK-EXECUTE-ONLY-NO-MOVT: error: option '-mexecute-only' cannot be specified with '-mno-movt' -// RUN: %clang -target armv7m-eabi -x assembler -mexecute-only %s -c -### 2>&1 \ +// RUN: %clang -### --target=arm-arm-none-eabi -march=armv7-m -x assembler -mexecute-only %s -c -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-EXECUTE-ONLY-ASM // CHECK-NO-EXECUTE-ONLY-ASM: warning: argument unused during compilation: '-mexecute-only' // -mpure-code flag for GCC compatibility -// RUN: not %clang -c -target thumbv6m-eabi -mpure-code %s 2>&1 | \ +// RUN: %clang -### -c --target=arm-arm-none-eabi -march=armv6 -mpure-code %s 2>&1 | \ // RUN: FileCheck --check-prefix CHECK-EXECUTE-ONLY-NOT-SUPPORTED %s -// RUN: not %clang -target armv8m.main-eabi -mpure-code -mno-movt %s 2>&1 \ +// RUN: %clang -### --target=arm-arm-none-eabi -march=armv8-m.main -mpure-code -mno-movt %s 2>&1 \ // RUN: | FileCheck %s -check-prefix CHECK-PURE-CODE-NO-MOVT // CHECK-PURE-CODE-NO-MOVT: error: option '-mpure-code' cannot be specified with '-mno-movt'