[clang] 8f8590e - [OpenMP][AIX] Add libpthreads for -fopenmp (#184629)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 4 08:22:54 PST 2026
Author: Xing Xue
Date: 2026-03-04T11:22:49-05:00
New Revision: 8f8590e691fe772b321004118ae92f5230c8a94d
URL: https://github.com/llvm/llvm-project/commit/8f8590e691fe772b321004118ae92f5230c8a94d
DIFF: https://github.com/llvm/llvm-project/commit/8f8590e691fe772b321004118ae92f5230c8a94d.diff
LOG: [OpenMP][AIX] Add libpthreads for -fopenmp (#184629)
The compiler uses TLS for OpenMP 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.
Added:
Modified:
clang/lib/Driver/ToolChains/AIX.cpp
Removed:
################################################################################
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.
More information about the cfe-commits
mailing list