From 4cdf2b4d0c29b0e9e0f49cb88566abadfaa95b35 Mon Sep 17 00:00:00 2001 From: Graham Markall Date: Fri, 12 Apr 2024 09:19:29 +0100 Subject: [PATCH] Fix symbol visiblility for compiler-rt builtins on MacOS The symbols in the compiler-rt builtins library are private external by default on MacOS. We need them to be visible so we can link against them (e.g. when building libllvmlite.so). This patch makes the symbols visible when the CMake option `COMPILER_RT_BUILTINS_HIDE_SYMBOLS` is off. Note that this is an existing option for the compiler-rt build, and the flags requiring modification in this patch appear to be an oversight. References: - https://discourse.llvm.org/t/lld-automatically-hide-symbols-with-prefix/73192 - https://github.com/numba/llvmlite/pull/986#issuecomment-1703872099 --- conda-recipes/compiler-rt-macos-build.patch | 15 +++++++++++++++ conda-recipes/llvmdev_llvm15/meta.yaml | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 conda-recipes/compiler-rt-macos-build.patch diff --git a/conda-recipes/compiler-rt-macos-build.patch b/conda-recipes/compiler-rt-macos-build.patch new file mode 100644 index 000000000..88feff94d --- /dev/null +++ b/conda-recipes/compiler-rt-macos-build.patch @@ -0,0 +1,15 @@ +diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake +index 640c7e7124c9..7bd3edb86eb1 100644 +--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake ++++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake +@@ -399,7 +399,9 @@ endfunction() + macro(darwin_add_builtin_libraries) + set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes) + +- set(CFLAGS -fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer) ++ set(CFLAGS -fPIC -O3 -Wall -fomit-frame-pointer) ++ append_list_if(COMPILER_RT_BUILTINS_HIDE_SYMBOLS -fvisibility=hidden CFLAGS) ++ append_list_if(COMPILER_RT_BUILTINS_HIDE_SYMBOLS -DVISIBILITY_HIDDEN CFLAGS) + set(CMAKE_C_FLAGS "") + set(CMAKE_CXX_FLAGS "") + set(CMAKE_ASM_FLAGS "") diff --git a/conda-recipes/llvmdev_llvm15/meta.yaml b/conda-recipes/llvmdev_llvm15/meta.yaml index 6ae0848fe..32d15a790 100644 --- a/conda-recipes/llvmdev_llvm15/meta.yaml +++ b/conda-recipes/llvmdev_llvm15/meta.yaml @@ -1,7 +1,7 @@ {% set shortversion = "15.0" %} {% set version = "15.0.7" %} {% set sha256_llvm = "8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6" %} -{% set build_number = "0" %} +{% set build_number = "1" %} package: name: llvmdev @@ -15,6 +15,7 @@ source: - ../llvm15-remove-use-of-clonefile.patch - ../llvm15-svml.patch - ../compiler-rt-cfi-startproc-war.patch + - ../compiler-rt-macos-build.patch # Patches from conda-forge needed for windows to build # backport of zlib patches, can be dropped for vs15.0.3, see