[libc-commits] [libc] 8bdaa12 - [libc] Fix undefined exit symbol for the NVPTX build

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu Sep 4 10:11:26 PDT 2025


Author: Joseph Huber
Date: 2025-09-04T12:11:11-05:00
New Revision: 8bdaa12b7ca4450d0f29b93646f1be27c0d717bd

URL: https://github.com/llvm/llvm-project/commit/8bdaa12b7ca4450d0f29b93646f1be27c0d717bd
DIFF: https://github.com/llvm/llvm-project/commit/8bdaa12b7ca4450d0f29b93646f1be27c0d717bd.diff

LOG: [libc] Fix undefined exit symbol for the NVPTX build

Summary:
NVPTX does not support external weak symbols being defined, disable this
to get the bots working.

Added: 
    

Modified: 
    libc/src/stdlib/exit.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/stdlib/exit.cpp b/libc/src/stdlib/exit.cpp
index ef3b8dd246305..f26d48ac00d7f 100644
--- a/libc/src/stdlib/exit.cpp
+++ b/libc/src/stdlib/exit.cpp
@@ -24,8 +24,12 @@ extern "C" [[gnu::weak]] void __cxa_thread_finalize();
 
 // TODO: use recursive mutex to protect this routine.
 [[noreturn]] LLVM_LIBC_FUNCTION(void, exit, (int status)) {
+// FIXME: The NVPTX target does not support external weak symbols correctly
+//        despite being an ELF platform. Disable pending a future split.
+#if !defined(LIBC_TARGET_ARCH_IS_NVPTX)
   if (__cxa_thread_finalize)
     __cxa_thread_finalize();
+#endif
   __cxa_finalize(nullptr);
   internal::exit(status);
 }


        


More information about the libc-commits mailing list