https://github.com/xingxue-ibm created 
https://github.com/llvm/llvm-project/pull/184629

The compiler uses TLS for thread‑private data, which results in references to 
symbols such as `__tls_get_addr` in `libpthreads`. Therefore, this PR adds 
`libpthreads` to the link command when `-fopenmp` is specified.

>From 9054917fc46ac60dfafc7472118d30e535d1b07f Mon Sep 17 00:00:00 2001
From: Xing Xue <[email protected]>
Date: Wed, 4 Mar 2026 07:56:48 -0500
Subject: [PATCH] Add libpthreads for -fopenmp.

---
 clang/lib/Driver/ToolChains/AIX.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 2078ad57aee18..e7f4792ac5bba 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -310,6 +310,8 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
           // Already diagnosed.
           break;
         }
+        // libpthreads is required for -fopenmp.
+        CmdArgs.push_back("-lpthreads");
       }
 
       // Support POSIX threads if "-pthreads" or "-pthread" is present.

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to