Skip to content

Commit 4cdf2b4

Browse files
committed
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 - numba#986 (comment)
1 parent 8af5294 commit 4cdf2b4

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
2+
index 640c7e7124c9..7bd3edb86eb1 100644
3+
--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
4+
+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
5+
@@ -399,7 +399,9 @@ endfunction()
6+
macro(darwin_add_builtin_libraries)
7+
set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes)
8+
9+
- set(CFLAGS -fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer)
10+
+ set(CFLAGS -fPIC -O3 -Wall -fomit-frame-pointer)
11+
+ append_list_if(COMPILER_RT_BUILTINS_HIDE_SYMBOLS -fvisibility=hidden CFLAGS)
12+
+ append_list_if(COMPILER_RT_BUILTINS_HIDE_SYMBOLS -DVISIBILITY_HIDDEN CFLAGS)
13+
set(CMAKE_C_FLAGS "")
14+
set(CMAKE_CXX_FLAGS "")
15+
set(CMAKE_ASM_FLAGS "")

conda-recipes/llvmdev_llvm15/meta.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% set shortversion = "15.0" %}
22
{% set version = "15.0.7" %}
33
{% set sha256_llvm = "8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6" %}
4-
{% set build_number = "0" %}
4+
{% set build_number = "1" %}
55

66
package:
77
name: llvmdev
@@ -15,6 +15,7 @@ source:
1515
- ../llvm15-remove-use-of-clonefile.patch
1616
- ../llvm15-svml.patch
1717
- ../compiler-rt-cfi-startproc-war.patch
18+
- ../compiler-rt-macos-build.patch
1819

1920
# Patches from conda-forge needed for windows to build
2021
# backport of zlib patches, can be dropped for vs15.0.3, see

0 commit comments

Comments
 (0)