[clang] [llvm] [X86] Add Support for X86 TLSDESC Relocations (PR #83136)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 22:15:39 PST 2024


================
@@ -0,0 +1,165 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=i686-unknown-unknown --relocation-model=pic -enable-tlsdesc | FileCheck %s --check-prefix=X86
+; RUN: llc < %s -mtriple=x86_64-pc-linux-gnux32 --relocation-model=pic -enable-tlsdesc | FileCheck %s --check-prefix=X32
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown --relocation-model=pic -enable-tlsdesc | FileCheck %s --check-prefix=X64
+
+ at x = thread_local global i32 0, align 4
+ at y = internal thread_local global i32 0, align 4
----------------
phoebewang wrote:

Thanks @frobtech for the explanation. IIUC, GCC will use `_TLS_MODULE_BASE_` if there are more than 1 local TLS variables, right?

I have no idea how to do it smartly in codegen in LLVM since we lower it statelessly. Maybe let's land this first? @MaskRay @frobtech 

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


More information about the cfe-commits mailing list