[llvm] [BOLT] Fix test for systems where dl/pthread are not part of libc (PR #206944)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 03:53:48 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: DmitriiMartynov
<details>
<summary>Changes</summary>
The bolt/test/runtime/setup-race.cpp test (including the original one) crashes with a segfault on Ubuntu 20.04 (glibc 2.31) because the dlsym symbol is not found.
According to the glibc 2.34 release notes, libpthread, libdl, libutil, and libanl have been integrated into libc. For older glibc versions, it is still necessary to link against libdl (for dlsym) and libpthread (for pthread_* symbols).
---
Full diff: https://github.com/llvm/llvm-project/pull/206944.diff
1 Files Affected:
- (modified) bolt/test/runtime/setup-race.cpp (+1-1)
``````````diff
diff --git a/bolt/test/runtime/setup-race.cpp b/bolt/test/runtime/setup-race.cpp
index a601731967aac..728903e50626d 100644
--- a/bolt/test/runtime/setup-race.cpp
+++ b/bolt/test/runtime/setup-race.cpp
@@ -3,7 +3,7 @@
// when libstdcxx.so invokes global constructors that call malloc.
// REQUIRES: system-linux
-// RUN: %clangxx %cxxflags -Wl,-q %s -o %t.exe -D_GNU_SOURCE -g
+// RUN: %clangxx %cxxflags -Wl,-q %s -o %t.exe -D_GNU_SOURCE -g -ldl -lpthread
// RUN: llvm-bolt -instrument %t.exe -o %t.bolt.exe
// RUN: %t.bolt.exe
``````````
</details>
https://github.com/llvm/llvm-project/pull/206944
More information about the llvm-commits
mailing list