Skip to content

Commit 5e43418

Browse files
authored
[ARM] Forbid use of TLS with execute-only (#124806)
Thread-local code generation requires constant pools because most of the relocations needed for it operate on data, so it cannot be used with -mexecute-only (or -mpure-code, which is aliased in the driver). Without this we hit an assertion in the backend when trying to generate a constant pool.
1 parent f20b8e3 commit 5e43418

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

clang/lib/Basic/Targets/ARM.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,8 @@ bool ARMTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
608608
HasBTI = 1;
609609
} else if (Feature == "+fullbf16") {
610610
HasFullBFloat16 = true;
611+
} else if (Feature == "+execute-only") {
612+
TLSSupported = false;
611613
}
612614
}
613615

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %clang_cc1 -triple arm-none-eabi -fsyntax-only -verify=default %s
2+
// RUN: %clang_cc1 -triple arm-none-eabi -target-feature +execute-only -fsyntax-only -verify=execute-only %s
3+
4+
// default-no-diagnostics
5+
6+
/// Thread-local code generation requires constant pools because most of the
7+
/// relocations needed for it operate on data, so it cannot be used with
8+
/// -mexecute-only (or -mpure-code, which is aliased in the driver).
9+
10+
_Thread_local int t; // execute-only-error {{thread-local storage is not supported for the current target}}

0 commit comments

Comments
 (0)