[libc-commits] [libc] [libc] Generate a stub for libresolv.a (PR #242188)
via libc-commits
libc-commits at lists.llvm.org
Thu Nov 12 22:27:40 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Brooks Moses (brooksmoses)
<details>
<summary>Changes</summary>
Create an empty libresolv.a static archive on Linux to avoid link errors when build rules (such as Go's `net cgo` package) explicitly pass `-lresolv` to the linker. Resolver symbols reside in the main `libc.a` archive instead (as in glibc 2.34+).
Follows the pattern set in commits https://github.com/llvm/llvm-project/commit/ede01decbcb34bd2f04b9102ab96664cc6d5aa4b and https://github.com/llvm/llvm-project/commit/ae5117cb45b860bf473337523d7fe4a6367dd8d1.
Assisted-by: Automated tooling, human reviewed.
---
Full diff: https://github.com/llvm/llvm-project/pull/242188.diff
1 Files Affected:
- (modified) libc/lib/CMakeLists.txt (+1-1)
``````````diff
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt
index b7947cace695e..09f5d42cd6f08 100644
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -109,7 +109,7 @@ endforeach()
# bits of libc to be located in separate files (e.g. libpthread).
set(added_empty_archives "")
if(LLVM_LIBC_FULL_BUILD AND ${LIBC_TARGET_OS} STREQUAL "linux")
- list(APPEND libc_empty_archive_names pthread dl rt)
+ list(APPEND libc_empty_archive_names pthread dl rt resolv)
foreach(archive ${libc_empty_archive_names})
set(empty_archive_path ${LIBC_LIBRARY_DIR}/lib${archive}.a)
add_custom_command(
``````````
</details>
https://github.com/llvm/llvm-project/pull/242188
More information about the libc-commits
mailing list