[llvm] [Bazel] Use .dylib for macOS configured library suffixes (PR #218184)
Corentin Kerisit via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 22 20:08:45 PDT 2026
https://github.com/cerisier created https://github.com/llvm/llvm-project/pull/218184
CMake and GN configure both LTDL_SHLIB_EXT and LLVM_PLUGIN_EXT as .dylib on macOS, but the Bazel overlay inherited the POSIX .so values. Separate common POSIX definitions from ELF-style suffixes and assign .dylib only to macOS. Linux, FreeBSD, and Emscripten retain .so, Windows retains .dll, and the configured extension now matches the existing Bazel macOS plugin output.
>From 6352bcf371466dd5214e2d798e57cd84b684809c Mon Sep 17 00:00:00 2001
From: Corentin Kerisit <corentin.kerisit at gmail.com>
Date: Sun, 23 Aug 2026 01:38:06 +0900
Subject: [PATCH] [Bazel] Use dylib suffixes in the macOS config
---
utils/bazel/llvm-project-overlay/llvm/config.bzl | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/llvm/config.bzl b/utils/bazel/llvm-project-overlay/llvm/config.bzl
index 49f70f95d2c79..3c21d36f396f1 100644
--- a/utils/bazel/llvm-project-overlay/llvm/config.bzl
+++ b/utils/bazel/llvm-project-overlay/llvm/config.bzl
@@ -28,8 +28,6 @@ def native_arch_defines(arch, triple):
posix_defines = [
"LLVM_ON_UNIX=1",
- r'LTDL_SHLIB_EXT=\".so\"',
- r'LLVM_PLUGIN_EXT=\".so\"',
"LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS=1",
"LLVM_ENABLE_PLUGINS=1",
"LLVM_ENABLE_THREADS=1",
@@ -46,6 +44,11 @@ posix_defines = [
"HAVE_UNISTD_H=1",
]
+posix_so_defines = posix_defines + [
+ r'LTDL_SHLIB_EXT=\".so\"',
+ r'LLVM_PLUGIN_EXT=\".so\"',
+]
+
emscripten_defines = [
"LLVM_ON_UNIX=1",
r'LTDL_SHLIB_EXT=\".so\"',
@@ -81,7 +84,7 @@ mallinfo_defines = select({
"//conditions:default": [],
})
-linux_defines = posix_defines + fenv_defines + [
+linux_defines = posix_so_defines + fenv_defines + [
"_GNU_SOURCE",
"HAVE_GETAUXVAL=1",
"HAVE_SBRK=1",
@@ -89,6 +92,8 @@ linux_defines = posix_defines + fenv_defines + [
]
macos_defines = posix_defines + fenv_defines + [
+ r'LTDL_SHLIB_EXT=\".dylib\"',
+ r'LLVM_PLUGIN_EXT=\".dylib\"',
"HAVE_MACH_MACH_H=1",
"HAVE_MALLOC_MALLOC_H=1",
"HAVE_MALLOC_ZONE_STATISTICS=1",
@@ -116,7 +121,7 @@ win32_defines = [
# to express.
os_defines = select({
"@platforms//os:emscripten": emscripten_defines,
- "@platforms//os:freebsd": posix_defines + fenv_defines,
+ "@platforms//os:freebsd": posix_so_defines + fenv_defines,
"@platforms//os:macos": macos_defines,
"@platforms//os:windows": win32_defines,
"//conditions:default": linux_defines,
More information about the llvm-commits
mailing list