[llvm] Exclude libc math C++ builtins from compiler-rt Bazel overlay (PR #208861)

Richard Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 17:08:18 PDT 2026


https://github.com/zygoloid created https://github.com/llvm/llvm-project/pull/208861

In CMake, addtf3.cpp is only compiled when COMPILER_RT_USE_LIBC_MATH is ON, replacing addtf3.c. In the Bazel overlay, builtins_generic_srcs globbed all lib/builtins/*.cpp without excluding addtf3.cpp, causing compile failures when not using libc math.

Assisted-by: Gemini via Antigravity

>From 73b10f124d76c5a22800c9dd6006a95de996afe2 Mon Sep 17 00:00:00 2001
From: Richard Smith <richard at metafoo.co.uk>
Date: Sat, 11 Jul 2026 00:07:36 +0000
Subject: [PATCH] Exclude libc math C++ builtins from compiler-rt Bazel overlay

In CMake, addtf3.cpp is only compiled when COMPILER_RT_USE_LIBC_MATH is ON,
replacing addtf3.c. In the Bazel overlay, builtins_generic_srcs globbed
all lib/builtins/*.cpp without excluding addtf3.cpp, causing compile failures
when not using libc math.

Assisted-by: Gemini via Antigravity
---
 utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
index 0c5e0af4cb483..afa726a14a5b1 100644
--- a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
@@ -470,6 +470,11 @@ filegroup(
     ),
 )
 
+BUILTINS_LIBC_MATH_EXCLUDES = [
+    # Sources requiring COMPILER_RT_USE_LIBC_MATH (e.g. LIBC_NAMESPACE::shared::*).
+    "lib/builtins/addtf3.cpp",
+]
+
 # Source files for portable components of the compiler builtins library.
 filegroup(
     name = "builtins_generic_srcs",
@@ -487,7 +492,8 @@ filegroup(
             BUILTINS_TF_EXCLUDES +
             BUILTINS_TF_SRCS_PATTERNS +
             BUILTNS_ATOMICS_SRCS +
-            BUILTINS_MACOS_ATOMIC_SRCS_PATTERNS
+            BUILTINS_MACOS_ATOMIC_SRCS_PATTERNS +
+            BUILTINS_LIBC_MATH_EXCLUDES
         ),
     ),
 )



More information about the llvm-commits mailing list