[libc-commits] [libc] Add libresolv.a to stub libraries (PR #242188)

Brooks Moses via libc-commits libc-commits at lists.llvm.org
Thu Nov 12 22:20:35 PST 2026


https://github.com/brooksmoses created https://github.com/llvm/llvm-project/pull/242188

- **[libc] Generate a stub for libresolv.a**


>From 62975bf70fda62516cf8fe3e744b3754a840c285 Mon Sep 17 00:00:00 2001
From: Brooks Moses <bmoses at google.com>
Date: Thu, 12 Nov 2026 22:06:22 -0800
Subject: [PATCH] [libc] Generate a stub for libresolv.a

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 ede01decbcb34bd2f04b9102ab96664cc6d5aa4b
and ae5117cb45b860bf473337523d7fe4a6367dd8d1.

Assisted-by: Automated tooling, human reviewed.
---
 libc/lib/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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(



More information about the libc-commits mailing list