[PATCH] D113026: [ARM] reject -mtp=cp15 if target subarch does not support it

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 2 11:06:31 PDT 2021


nickdesaulniers added a comment.

Thanks for the patch! Don't forget to run `git-clang-format HEAD~`.



================
Comment at: clang/lib/Driver/ToolChains/Arch/ARM.cpp:160-161
+    if (ThreadPointer == ReadTPMode::Cp15 &&
+        getARMSubArchVersionNumber(Triple) < 7 &&
+        llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::ArchKind::ARMV6T2) {
+          D.Diag(diag::err_target_unsupported_tp_hard) << Triple.getArchName();
----------------
The last two checks seems redundant (`getARMSubArchVersionNumber(Triple) < 7 && llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::ArchKind::ARMV6T2`).  If the `ArchKind` was `ARMV6T2` then `getARMSubArchVersionNumber` should return `6`.

Or do we want to support ARMv6T2, in which case the patch description should be edited:

> ensure that -mtp=cp15 is rejected for ARMv6T2 or earlier.

s/ARMv6T2 or earlier/ARMv6 (except ARMv6T2) or earlier/


================
Comment at: clang/test/Driver/clang-translation.c:118-119
+// RUN: %clang -target armv5t-linux -mtp=cp15 -### -S %s 2>&1 | \
+// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER_UNSUPPORTED %s
+// ARMv7_THREAD_POINTER_UNSUPPORTED: error: hardware TLS register is not supported for the armv5 sub-architecture
+
----------------
The `-check-prefix` should probably s/ARMv7/ARMv5T/.

It might be interesting to additionally test armv6 vs armv6t, depending on the answer to my question above.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113026/new/

https://reviews.llvm.org/D113026



More information about the cfe-commits mailing list