[libc-commits] [libc] [libc] Stub TLS functions on the GPU temporarily (PR #108267)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Sep 11 11:24:58 PDT 2024


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/108267

Summary:
There's an extern weak symbol for this, we should just factor these into
a more common interface. Stub them temporarily to make the bots happy.
PTXAS does not handle extern weak.


>From 3b3ba68b5d501984fa6ec052eea4786a32cea370 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 11 Sep 2024 13:23:45 -0500
Subject: [PATCH] [libc] Stub TLS functions on the GPU temporarily

Summary:
There's an extern weak symbol for this, we should just factor these into
a more common interface. Stub them temporarily to make the bots happy.
PTXAS does not handle extern weak.
---
 libc/startup/gpu/amdgpu/start.cpp | 3 +++
 libc/startup/gpu/nvptx/start.cpp  | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/libc/startup/gpu/amdgpu/start.cpp b/libc/startup/gpu/amdgpu/start.cpp
index f09541b0d55808..1ce56e5c7a1edf 100644
--- a/libc/startup/gpu/amdgpu/start.cpp
+++ b/libc/startup/gpu/amdgpu/start.cpp
@@ -17,6 +17,9 @@ extern "C" int main(int argc, char **argv, char **envp);
 
 namespace LIBC_NAMESPACE_DECL {
 
+// FIXME: Factor this out into common logic so we don't need to stub it here. 
+void teardown_main_tls() {}
+
 DataEnvironment app;
 
 extern "C" uintptr_t __init_array_start[];
diff --git a/libc/startup/gpu/nvptx/start.cpp b/libc/startup/gpu/nvptx/start.cpp
index ef1e63e5161a61..5bd8a9486e6703 100644
--- a/libc/startup/gpu/nvptx/start.cpp
+++ b/libc/startup/gpu/nvptx/start.cpp
@@ -19,6 +19,9 @@ namespace LIBC_NAMESPACE_DECL {
 
 DataEnvironment app;
 
+// FIXME: Factor this out into common logic so we don't need to stub it here. 
+void teardown_main_tls() {}
+
 extern "C" {
 // Nvidia's 'nvlink' linker does not provide these symbols. We instead need
 // to manually create them and update the globals in the loader implememtation.



More information about the libc-commits mailing list