[compiler-rt] [llvm] [JITLink] Add TLS support for SystemZ (PR #171559)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 09:39:05 PST 2025


================
@@ -0,0 +1,43 @@
+
+//===-- orc_rt_elfnix_tls_systemz.s -------------------------------*- ASM -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of the ORC runtime support library.
+//
+//===----------------------------------------------------------------------===//
+
+// The special thing about the s390 TLS ABI is that we do not have the
+// standard __tls_get_addr function but the __tls_get_offset function
+// which differs in two important aspects:
+// 1) __tls_get_offset gets a got offset instead of a pointer to the
+//    tls_index structure
+// 2) __tls_get_offset returns the offset of the requested variable to
+//    the thread descriptor instead of a pointer to the variable.
+
+// The content of this file is systemz-only
+
+#if defined(__s390x__)
+
+        .text
+	// returns offset of TLV from TP in %r2, all other registers preserved
+	.globl ___orc_rt_elfnix_tls_get_offset
+___orc_rt_elfnix_tls_get_offset:
+	stmg %r14, %r15, 48(%r15)
----------------
uweigand wrote:

If we just store 14-15, they go at 112(%r15) per the ABI.

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


More information about the llvm-commits mailing list