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

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 5 09:24:17 PST 2025


================
@@ -0,0 +1,60 @@
+
+//===-- 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 %r6, %r15, 48(%r15)
+	aghi %r15, -240
+	std %f8, 232(%r15)
+	std %f9, 224(%r15)
+	std %f10, 216(%r15)
+	std %f11, 208(%r15)
+	std %f12, 200(%r15)
+	std %f13, 192(%r15)
+	std %f14, 184(%r15)
+	std %f15, 176(%r15)
----------------
uweigand wrote:

What's the point of saving all these registers?  They're not modified here, and the called `__orc_rt` routine will preserve them ...

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


More information about the llvm-commits mailing list