[PATCH] D116233: [clang][ARM] re-use arm::isHardTPSupported for hardware TLS check

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 23 12:15:25 PST 2021


nickdesaulniers created this revision.
nickdesaulniers added reviewers: nathanchance, ardb, peter.smith.
Herald added a subscriber: kristof.beyls.
nickdesaulniers requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This conditional check for -mstack-protector-guard=tls got out of sync
with the conditional check for -mtp=cp15 by me in D114116 <https://reviews.llvm.org/D114116>, because I
forgot about the similar check added in D113026 <https://reviews.llvm.org/D113026>.

Re-use the code in arm::isHardTPSupported so that these aren't out of
sync.

Interestingly, our CI reported this when testing
-mstack-protector-guard=tls; it was only reproducible with Debian's LLVM
and not upstream LLVM due to this out of tree patch:
https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/snapshot/debian/patches/930008-arm.diff

Fixes: https://github.com/ClangBuiltLinux/linux/issues/1502


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116233

Files:
  clang/lib/Driver/ToolChains/Clang.cpp


Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3217,9 +3217,7 @@
         return;
       }
       // Check whether the target subarch supports the hardware TLS register
-      if (arm::getARMSubArchVersionNumber(EffectiveTriple) < 7 &&
-          llvm::ARM::parseArch(EffectiveTriple.getArchName()) !=
-              llvm::ARM::ArchKind::ARMV6T2) {
+      if (!arm::isHardTPSupported(EffectiveTriple)) {
         D.Diag(diag::err_target_unsupported_tp_hard)
             << EffectiveTriple.getArchName();
         return;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116233.396074.patch
Type: text/x-patch
Size: 676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211223/00d28cf5/attachment.bin>


More information about the cfe-commits mailing list