[lld] [lldb] [llvm] [AArch64] Support TLS variables in debug info (PR #146572)

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 9 12:04:29 PDT 2026


================
@@ -274,9 +274,17 @@ void DwarfCompileUnit::addLocationAttribute(
     if (!Global && (!Expr || !Expr->isConstant()))
       continue;
 
-    if (Global && Global->isThreadLocal() &&
-        !Asm->getObjFileLowering().supportDebugThreadLocalLocation())
-      continue;
+    if (Global && Global->isThreadLocal()) {
+      // Do not emit TLS location for preemptible TLS variables
+      // (e.g. TLS in shared libraries). The TLS offset cannot be
+      // represented safely in DWARF. In that case let Debugger use
+      // Runtime TLS lookup via DTV (Dynmic thread vector).
+      if (Asm->TM.getTargetTriple().isAArch64() && !Global->isDSOLocal())
----------------
igorkudrin wrote:

What caused the failures in X86 test cases?

https://github.com/llvm/llvm-project/pull/146572


More information about the llvm-commits mailing list