[lld] [LLD][AArch64] Handle R_AARCH64_TLS_DTPREL64 in non-alloc sections (PR #183962)

Shivam Gupta via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 05:43:39 PST 2026


xgupta wrote:

Okay, we will first try for lldb, why it is necessary to have this relocation. 

Without this relocation in clang for test case 
`
thread_local unsigned long v = 1;
int main() { return v; }
`

llvm-dwarfdump shows
```
0x00000023:   DW_TAG_variable
                DW_AT_name      ("v")
                DW_AT_type      (0x0000002b "unsigned long")
                DW_AT_external  (true)
                DW_AT_decl_file ("/llvm-project/build/test.cpp")
                DW_AT_decl_line (1)
```
So it is missing the DW_AT_location attribute. New change in clang emitted it. Which that help, LLDB debug the variable. Without the location even after LLDB fix in https://github.com/llvm/llvm-project/pull/183993, LLDB could not use symbol table. 
```
(lldb) p v
error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory
```

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


More information about the llvm-commits mailing list