[llvm] Add a filegroup containing _all_ sources to the libc build rules (PR #169155)

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 22 01:38:29 PST 2025


https://github.com/chandlerc created https://github.com/llvm/llvm-project/pull/169155

These rules already expose a filegroup containing the _dependencies_, but that misses the source files directly in the top level library.

Without this filegroup, there isn't a way to access the source files used by libcxx when building it, etc.

That said, if there is a better way to do this or a different design, let me know. Not super familiar with the Bazel logic for llvm-libc.

>From e524424ed32e945bdced8c19ca480f461d04397a Mon Sep 17 00:00:00 2001
From: Chandler Carruth <chandlerc at gmail.com>
Date: Thu, 20 Nov 2025 03:05:36 +0000
Subject: [PATCH] Add a filegroup containing _all_ sources to the libc build
 rules

These rules already expose a filegroup containing the _dependencies_,
but that misses the source files directly in the top level library.

Without this filegroup, there isn't a way to access the source files
used by libcxx when building it, etc.
---
 utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
index 0f2965369c296..c871334dd95b3 100644
--- a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
@@ -247,6 +247,12 @@ def libc_header_library(name, hdrs, deps = [], **kwargs):
         **kwargs
     )
 
+    _libc_srcs_filegroup(
+        name = name + "_hdrs",
+        libs = [":" + name],
+        enforce_headers_only = True,
+    )
+
 def libc_generated_header(name, hdr, yaml_template, other_srcs = []):
     """Generates a libc header file from YAML template.
 



More information about the llvm-commits mailing list