From 76d3f19bbb4a844fbe756754bcf7f9bf9be17a3d Mon Sep 17 00:00:00 2001 From: oliverhu Date: Tue, 8 Aug 2023 21:53:21 -0700 Subject: [PATCH 01/15] Update llvmdev to build compiler-rt --- conda-recipes/llvmdev/bld.bat | 54 ++++++++++++++++++- conda-recipes/llvmdev/build.sh | 13 ++++- conda-recipes/llvmdev/meta.yaml | 6 +++ conda-recipes/llvmdev_manylinux2014/build.sh | 45 +++++++++++++++- conda-recipes/llvmdev_manylinux2014/meta.yaml | 9 ++++ 5 files changed, 123 insertions(+), 4 deletions(-) diff --git a/conda-recipes/llvmdev/bld.bat b/conda-recipes/llvmdev/bld.bat index 4d16d84b1..aa25f95cf 100644 --- a/conda-recipes/llvmdev/bld.bat +++ b/conda-recipes/llvmdev/bld.bat @@ -3,6 +3,8 @@ FOR /D %%d IN (llvm-*.src) DO (MKLINK /J llvm %%d if !errorlevel! neq 0 exit /b %errorlevel%) FOR /D %%d IN (lld-*.src) DO (MKLINK /J lld %%d if !errorlevel! neq 0 exit /b %errorlevel%) +FOR /D %%d IN (rt\compiler-rt-*.src) DO (MKLINK /J compiler-rt %%d +if !errorlevel! neq 0 exit /b %errorlevel%) FOR /D %%d IN (unwind\libunwind-*.src) DO (MKLINK /J libunwind %%d if !errorlevel! neq 0 exit /b %errorlevel%) @@ -33,13 +35,16 @@ REM the 64bit linker anyway. This must be passed in to certain generators as REM '-Thost x64'. set PreferredToolArchitecture=x64 -set MAX_INDEX_CMAKE_GENERATOR=0 +set MAX_INDEX_CMAKE_GENERATOR=1 set "CMAKE_GENERATOR[0]=Visual Studio 16 2019" +set "CMAKE_GENERATOR[1]=Visual Studio 17 2022" set "CMAKE_GENERATOR_ARCHITECTURE[0]=%GEN_ARCH%" +set "CMAKE_GENERATOR_ARCHITECTURE[1]=%GEN_ARCH%" set "CMAKE_GENERATOR_TOOLSET[0]=v142" +set "CMAKE_GENERATOR_TOOLSET[1]=v142" REM Reduce build times and package size by removing unused stuff REM BENCHMARKS (new for llvm8) don't build under Visual Studio 14 2015 @@ -53,6 +58,8 @@ set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="%LLVM_TARGETS_TO_BUILD%" ^ -DLLVM_USE_INTEL_JITEVENTS=ON ^ -DLLVM_INCLUDE_BENCHMARKS=OFF ^ -DLLVM_ENABLE_DIA_SDK=OFF ^ + -DLLVM_ENABLE_LIBXML2:BOOL=OFF ^ + -DCLANG_ENABLE_LIBXML=OFF ^ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly REM try all compatible visual studio toolsets to find one that is installed @@ -92,3 +99,48 @@ REM enhanced unix-like shell which has functions like `grep` available. REM cd ..\test REM "%PYTHON%" "..\build\%BUILD_CONFIG%\bin\llvm-lit.py" -vv Transforms ExecutionEngine Analysis CodeGen/X86 REM if errorlevel 1 exit 1 + + +REM Build compiler-rt separately, because it fails on Windows with LLVM 14.0.6 +REM if built as an LLVM project. +REM See also: https://stackoverflow.com/questions/46108390/building-llvm-with-cmake-and-visual-stuidio-fails-to-install + +cd "%SRC_DIR%\compiler-rt" +mkdir build +cd build + +set CMAKE_CUSTOM=-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON ^ + -DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_CRT:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_XRAY:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_ORC:BOOL=OFF ^ + -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF ^ + -DLLVM_CONFIG_PATH="%SRC_DIR%\build\%BUILD_CONFIG%\bin\llvm-config.exe" + +REM try all compatible visual studio toolsets to find one that is installed +setlocal enabledelayedexpansion +for /l %%n in (0,1,%MAX_INDEX_CMAKE_GENERATOR%) do ( + cmake -G "!CMAKE_GENERATOR[%%n]!" ^ + -A "!CMAKE_GENERATOR_ARCHITECTURE[%%n]!" ^ + -T "!CMAKE_GENERATOR_TOOLSET[%%n]!" ^ + -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" ^ + -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^ + -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^ + %CMAKE_CUSTOM% .. + if not errorlevel 1 goto crt_configuration_successful + del CMakeCache.txt +) +if errorlevel 1 exit 1 + +:crt_configuration_successful +endlocal + +cmake --build . --config "%BUILD_CONFIG%" +if errorlevel 1 exit 1 + +cmake --build . --config "%BUILD_CONFIG%" --target install +if errorlevel 1 exit 1 diff --git a/conda-recipes/llvmdev/build.sh b/conda-recipes/llvmdev/build.sh index caccfe127..ef21f54c0 100644 --- a/conda-recipes/llvmdev/build.sh +++ b/conda-recipes/llvmdev/build.sh @@ -16,12 +16,13 @@ fi mv llvm-*.src llvm mv lld-*.src lld +mv rt/compiler-rt-*.src compiler-rt mv unwind/libunwind-*.src libunwind declare -a _cmake_config _cmake_config+=(-DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}) _cmake_config+=(-DCMAKE_BUILD_TYPE:STRING=Release) -_cmake_config+=(-DLLVM_ENABLE_PROJECTS:STRING="lld") +_cmake_config+=(-DLLVM_ENABLE_PROJECTS:STRING="lld;compiler-rt") # The bootstrap clang I use was built with a static libLLVMObject.a and I trying to get the same here # _cmake_config+=(-DBUILD_SHARED_LIBS:BOOL=ON) _cmake_config+=(-DLLVM_ENABLE_ASSERTIONS:BOOL=ON) @@ -43,6 +44,16 @@ _cmake_config+=(-DLLVM_ENABLE_RTTI=OFF) _cmake_config+=(-DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}) _cmake_config+=(-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly) _cmake_config+=(-DLLVM_INCLUDE_UTILS=ON) # for llvm-lit +_cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) +_cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) _cmake_config+=(-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF) # doesn't build without the rest of LLVM project # TODO :: It would be nice if we had a cross-ecosystem 'BUILD_TIME_LIMITED' env var we could use to # disable these unnecessary but useful things. diff --git a/conda-recipes/llvmdev/meta.yaml b/conda-recipes/llvmdev/meta.yaml index 7676d234e..b4d975fc2 100644 --- a/conda-recipes/llvmdev/meta.yaml +++ b/conda-recipes/llvmdev/meta.yaml @@ -3,6 +3,7 @@ {% set sha256_llvm = "050922ecaaca5781fdf6631ea92bc715183f202f9d2f15147226f023414f619a" %} {% set sha256_lld = "0c28ce0496934d37d20fec96591032dd66af8d10178a45762e0e75e85cf95ad3" %} {% set sha256_libunwind = "3bbe9c23c73259fe39c045dc87d0b283236ba6e00750a226b2c2aeac4a51d86b" %} +{% set sha256_compiler_rt = "88df303840ca8fbff944e15e61c141226fe79f5d2b8e89fb024264d77841a02e" %} {% set build_number = "3" %} package: @@ -26,6 +27,11 @@ source: sha256: {{ sha256_libunwind }} folder: unwind + - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/compiler-rt-{{ version }}.src.tar.xz + fn: compiler-rt-{{ version }}.src.tar.xz + sha256: {{ sha256_compiler_rt }} + folder: rt + build: number: {{ build_number }} script_env: diff --git a/conda-recipes/llvmdev_manylinux2014/build.sh b/conda-recipes/llvmdev_manylinux2014/build.sh index 3955c1e5b..70ac87a83 100644 --- a/conda-recipes/llvmdev_manylinux2014/build.sh +++ b/conda-recipes/llvmdev_manylinux2014/build.sh @@ -75,8 +75,8 @@ fi # _cmake_config+=(--trace-expand) # CPU_COUNT=1 -mkdir build -cd build +mkdir llvm/build +cd llvm/build cmake -G'Unix Makefiles' \ "${_cmake_config[@]}" \ @@ -93,3 +93,44 @@ make check-llvm-unit || exit $? # From: https://github.com/conda-forge/llvmdev-feedstock/pull/53 make install || exit $? + +# run the tests, skip some on linux-32 +cd ../test +if [[ $ARCH == 'i686' ]]; then + ../build/bin/llvm-lit -vv Transforms Analysis CodeGen/X86 +else + ../build/bin/llvm-lit -vv Transforms ExecutionEngine Analysis CodeGen/X86 +fi + +# Next, build compiler-rt + +declare -a _compiler_rt_cmake_config +_compiler_rt_cmake_config+=(-DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}) +_compiler_rt_cmake_config+=(-DCMAKE_BUILD_TYPE:STRING=Release) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) +_compiler_rt_cmake_config+=(-DLLVM_CONFIG_PATH=../../llvm/build/bin/llvm-config) + +cd ../../compiler-rt +mkdir build +cd build + +cmake -G'Unix Makefiles' \ + "${_compiler_rt_cmake_config[@]}" \ + .. + +if [ $ARCH == 'armv7l' ]; then # RPi need thread count throttling + make -j2 VERBOSE=1 +else + make -j${CPU_COUNT} VERBOSE=1 +fi + +make install \ No newline at end of file diff --git a/conda-recipes/llvmdev_manylinux2014/meta.yaml b/conda-recipes/llvmdev_manylinux2014/meta.yaml index bcc1ca39a..4e6e9a28f 100644 --- a/conda-recipes/llvmdev_manylinux2014/meta.yaml +++ b/conda-recipes/llvmdev_manylinux2014/meta.yaml @@ -4,6 +4,8 @@ {% set sha256_lld = "0c28ce0496934d37d20fec96591032dd66af8d10178a45762e0e75e85cf95ad3" %} {% set sha256_libunwind = "3bbe9c23c73259fe39c045dc87d0b283236ba6e00750a226b2c2aeac4a51d86b" %} {% set build_number = "1" %} +{% set sha256_compiler_rt = "88df303840ca8fbff944e15e61c141226fe79f5d2b8e89fb024264d77841a02e" %} +{% set build_number = "2" %} package: name: llvmdev @@ -13,6 +15,7 @@ source: - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/llvm-{{ version }}.src.tar.xz fn: llvm-{{ version }}.src.tar.xz sha256: {{ sha256_llvm }} + folder: llvm patches: - ../llvm14-clear-gotoffsetmap.patch - ../llvm14-remove-use-of-clonefile.patch @@ -20,12 +23,18 @@ source: - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/lld-{{ version }}.src.tar.xz fn: lld-{{ version }}.src.tar.xz sha256: {{ sha256_lld }} + folder: llvm/tools/lld - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/libunwind-{{ version }}.src.tar.xz fn: libunwind-{{ version }}.src.tar.xz sha256: {{ sha256_libunwind }} folder: unwind + - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/compiler-rt-{{ version }}.src.tar.xz + fn: compiler-rt-{{ version }}.src.tar.xz + sha256: {{ sha256_compiler_rt }} + folder: compiler-rt + build: number: {{ build_number }} string: "manylinux2014h{{ PKG_HASH }}" From adec803de26fbf978578880d307cc8a6186041d8 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Tue, 8 Aug 2023 23:16:43 -0700 Subject: [PATCH 02/15] fix linux2014 --- conda-recipes/llvmdev_manylinux2014/build.sh | 5 +++-- conda-recipes/llvmdev_manylinux2014/meta.yaml | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conda-recipes/llvmdev_manylinux2014/build.sh b/conda-recipes/llvmdev_manylinux2014/build.sh index 70ac87a83..15f331e2c 100644 --- a/conda-recipes/llvmdev_manylinux2014/build.sh +++ b/conda-recipes/llvmdev_manylinux2014/build.sh @@ -16,6 +16,7 @@ fi mv llvm-*.src llvm mv lld-*.src lld +mv rt/compiler-rt-*.src compiler-rt mv unwind/libunwind-*.src libunwind declare -a _cmake_config @@ -75,8 +76,8 @@ fi # _cmake_config+=(--trace-expand) # CPU_COUNT=1 -mkdir llvm/build -cd llvm/build +mkdir build +cd build cmake -G'Unix Makefiles' \ "${_cmake_config[@]}" \ diff --git a/conda-recipes/llvmdev_manylinux2014/meta.yaml b/conda-recipes/llvmdev_manylinux2014/meta.yaml index 4e6e9a28f..bff7aec74 100644 --- a/conda-recipes/llvmdev_manylinux2014/meta.yaml +++ b/conda-recipes/llvmdev_manylinux2014/meta.yaml @@ -15,15 +15,14 @@ source: - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/llvm-{{ version }}.src.tar.xz fn: llvm-{{ version }}.src.tar.xz sha256: {{ sha256_llvm }} - folder: llvm patches: - ../llvm14-clear-gotoffsetmap.patch - ../llvm14-remove-use-of-clonefile.patch - ../llvm14-svml.patch + - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/lld-{{ version }}.src.tar.xz fn: lld-{{ version }}.src.tar.xz sha256: {{ sha256_lld }} - folder: llvm/tools/lld - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/libunwind-{{ version }}.src.tar.xz fn: libunwind-{{ version }}.src.tar.xz @@ -33,7 +32,7 @@ source: - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/compiler-rt-{{ version }}.src.tar.xz fn: compiler-rt-{{ version }}.src.tar.xz sha256: {{ sha256_compiler_rt }} - folder: compiler-rt + folder: rt build: number: {{ build_number }} From a9a917e938c07d7220a3e99c753251ac07383e99 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Wed, 9 Aug 2023 08:53:20 -0700 Subject: [PATCH 03/15] add patch to support older glibc, build all compiler-rt libs --- .../compiler-rt-14-fp-xstate-magic1.patch | 46 +++++++++++++++++++ conda-recipes/llvmdev/build.sh | 11 +---- conda-recipes/llvmdev/meta.yaml | 4 +- 3 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 conda-recipes/compiler-rt-14-fp-xstate-magic1.patch diff --git a/conda-recipes/compiler-rt-14-fp-xstate-magic1.patch b/conda-recipes/compiler-rt-14-fp-xstate-magic1.patch new file mode 100644 index 000000000..371996bca --- /dev/null +++ b/conda-recipes/compiler-rt-14-fp-xstate-magic1.patch @@ -0,0 +1,46 @@ +From 6f095babc2b7d564168c7afc5bf6afb2188fd6b4 Mon Sep 17 00:00:00 2001 +From: Tobias Burnus +Date: Thu, 5 May 2022 10:30:10 +0100 +Subject: [PATCH] sanitizer_common: Define FP_XSTATE_MAGIC1 for old glibc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +D116208 (commit 1298273e8206a8fc2) added FP_XSTATE_MAGIC1. +However, when building with glibc < 2.16 for backward-dependency +compatibility, it is not defined - and the build breaks. + +Note: The define comes from Linux's asm/sigcontext.h but the +file uses signal.h which includes glibc's bits/sigcontext.h - which +is synced from the kernel's file but lags behind. + +Solution: For backward compatility with ancient systems, define +FP_XSTATE_MAGIC1 if undefined. + +//For the old systems, we were building with Linux kernel 3.19 but to support really old glibc systems, we build with a sysroot of glibc 2.12. While our kernel (and the users' kernels) have FP_XSTATE_MAGIC1, glibc 2.12 is too old. – With this patch, building the sanitizer libs works again. This showed up for us today as GCC mainline/13 has now synced the sanitizer libs.// + +Reviewed By: #sanitizers, vitalybuka + +Differential Revision: https://reviews.llvm.org/D124927 +--- + .../lib/sanitizer_common/sanitizer_platform_limits_posix.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/compiler-rt-14.0.6.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt-14.0.6.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +index e5cecaaaffc2..8ed3e92d2704 100644 +--- a/compiler-rt-14.0.6.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/compiler-rt-14.0.6.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -218,6 +218,10 @@ namespace __sanitizer { + + unsigned ucontext_t_sz(void *ctx) { + # if SANITIZER_GLIBC && SANITIZER_X64 ++ // Added in Linux kernel 3.4.0, merged to glibc in 2.16 ++# ifndef FP_XSTATE_MAGIC1 ++# define FP_XSTATE_MAGIC1 0x46505853U ++# endif + // See kernel arch/x86/kernel/fpu/signal.c for details. + const auto *fpregs = static_cast(ctx)->uc_mcontext.fpregs; + // The member names differ across header versions, but the actual layout +-- +2.40.0 + diff --git a/conda-recipes/llvmdev/build.sh b/conda-recipes/llvmdev/build.sh index ef21f54c0..168d7b6c5 100644 --- a/conda-recipes/llvmdev/build.sh +++ b/conda-recipes/llvmdev/build.sh @@ -44,16 +44,7 @@ _cmake_config+=(-DLLVM_ENABLE_RTTI=OFF) _cmake_config+=(-DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}) _cmake_config+=(-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly) _cmake_config+=(-DLLVM_INCLUDE_UTILS=ON) # for llvm-lit -_cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) -_cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) # Requires clang to be built _cmake_config+=(-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF) # doesn't build without the rest of LLVM project # TODO :: It would be nice if we had a cross-ecosystem 'BUILD_TIME_LIMITED' env var we could use to # disable these unnecessary but useful things. diff --git a/conda-recipes/llvmdev/meta.yaml b/conda-recipes/llvmdev/meta.yaml index b4d975fc2..a8ebf764d 100644 --- a/conda-recipes/llvmdev/meta.yaml +++ b/conda-recipes/llvmdev/meta.yaml @@ -4,7 +4,7 @@ {% set sha256_lld = "0c28ce0496934d37d20fec96591032dd66af8d10178a45762e0e75e85cf95ad3" %} {% set sha256_libunwind = "3bbe9c23c73259fe39c045dc87d0b283236ba6e00750a226b2c2aeac4a51d86b" %} {% set sha256_compiler_rt = "88df303840ca8fbff944e15e61c141226fe79f5d2b8e89fb024264d77841a02e" %} -{% set build_number = "3" %} +{% set build_number = "4" %} package: name: llvmdev @@ -31,6 +31,8 @@ source: fn: compiler-rt-{{ version }}.src.tar.xz sha256: {{ sha256_compiler_rt }} folder: rt + patches: + - ../compiler-rt-14-fp-xstate-magic1.patch build: number: {{ build_number }} From 397eca85bf8e4869d7ce9a4d34bc05a09f64a532 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Wed, 9 Aug 2023 09:07:08 -0700 Subject: [PATCH 04/15] also update manylinux & windows meta.yaml --- conda-recipes/llvmdev/bld.bat | 11 +---------- conda-recipes/llvmdev_manylinux2014/build.sh | 9 --------- conda-recipes/llvmdev_manylinux2014/meta.yaml | 2 ++ 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/conda-recipes/llvmdev/bld.bat b/conda-recipes/llvmdev/bld.bat index aa25f95cf..c314ca93f 100644 --- a/conda-recipes/llvmdev/bld.bat +++ b/conda-recipes/llvmdev/bld.bat @@ -109,16 +109,7 @@ cd "%SRC_DIR%\compiler-rt" mkdir build cd build -set CMAKE_CUSTOM=-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON ^ - -DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_CRT:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_XRAY:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_ORC:BOOL=OFF ^ - -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF ^ +set CMAKE_CUSTOM=-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF ^ -DLLVM_CONFIG_PATH="%SRC_DIR%\build\%BUILD_CONFIG%\bin\llvm-config.exe" REM try all compatible visual studio toolsets to find one that is installed diff --git a/conda-recipes/llvmdev_manylinux2014/build.sh b/conda-recipes/llvmdev_manylinux2014/build.sh index 15f331e2c..9f602841c 100644 --- a/conda-recipes/llvmdev_manylinux2014/build.sh +++ b/conda-recipes/llvmdev_manylinux2014/build.sh @@ -108,15 +108,6 @@ fi declare -a _compiler_rt_cmake_config _compiler_rt_cmake_config+=(-DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}) _compiler_rt_cmake_config+=(-DCMAKE_BUILD_TYPE:STRING=Release) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) _compiler_rt_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) _compiler_rt_cmake_config+=(-DLLVM_CONFIG_PATH=../../llvm/build/bin/llvm-config) diff --git a/conda-recipes/llvmdev_manylinux2014/meta.yaml b/conda-recipes/llvmdev_manylinux2014/meta.yaml index bff7aec74..298fa8500 100644 --- a/conda-recipes/llvmdev_manylinux2014/meta.yaml +++ b/conda-recipes/llvmdev_manylinux2014/meta.yaml @@ -33,6 +33,8 @@ source: fn: compiler-rt-{{ version }}.src.tar.xz sha256: {{ sha256_compiler_rt }} folder: rt + patches: + - ../compiler-rt-14-fp-xstate-magic1.patch build: number: {{ build_number }} From 602a7fa3b679cfa115c462361211e4fe2de7496c Mon Sep 17 00:00:00 2001 From: oliverhu Date: Thu, 10 Aug 2023 22:44:33 -0700 Subject: [PATCH 05/15] update darwin build script --- conda-recipes/llvmdev/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conda-recipes/llvmdev/build.sh b/conda-recipes/llvmdev/build.sh index 168d7b6c5..2f8498d5b 100644 --- a/conda-recipes/llvmdev/build.sh +++ b/conda-recipes/llvmdev/build.sh @@ -10,8 +10,10 @@ LLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD:-"all"} # This is the clang compiler prefix if [[ $build_platform == osx-arm64 ]]; then DARWIN_TARGET=arm64-apple-darwin20.0.0 + DARWIN_ARCH=arm64 else DARWIN_TARGET=x86_64-apple-darwin13.4.0 + DARWIN_ARCH=arm64 fi mv llvm-*.src llvm @@ -65,7 +67,7 @@ if [[ $(uname) == Darwin ]]; then # Once we are using our libc++ (not until llvm_build_final), it will be single-arch only and not setting # this causes link failures building the santizers since they respect DARWIN_osx_ARCHS. We may as well # save some compilation time by setting this for all of our llvm builds. - _cmake_config+=(-DDARWIN_osx_ARCHS=x86_64) + _cmake_config+=(-DDARWIN_osx_ARCHS=${DARWIN_ARCH}) elif [[ $(uname) == Linux ]]; then _cmake_config+=(-DLLVM_USE_INTEL_JITEVENTS=ON) # _cmake_config+=(-DLLVM_BINUTILS_INCDIR=${PREFIX}/lib/gcc/${cpu_arch}-${vendor}-linux-gnu/${compiler_ver}/plugin/include) From 5c8a0511715c241e23b4efddb860252e93ce8be8 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Thu, 10 Aug 2023 23:17:42 -0700 Subject: [PATCH 06/15] skip non builtin static libraries --- conda-recipes/llvmdev/bld.bat | 12 +++++++++++- conda-recipes/llvmdev/build.sh | 10 ++++++++++ conda-recipes/llvmdev_manylinux2014/build.sh | 10 ++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/conda-recipes/llvmdev/bld.bat b/conda-recipes/llvmdev/bld.bat index c314ca93f..50aeb0a30 100644 --- a/conda-recipes/llvmdev/bld.bat +++ b/conda-recipes/llvmdev/bld.bat @@ -109,7 +109,17 @@ cd "%SRC_DIR%\compiler-rt" mkdir build cd build -set CMAKE_CUSTOM=-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF ^ +set CMAKE_CUSTOM=DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON ^ + -DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_CRT:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_XRAY:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_ORC:BOOL=OFF ^ + -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF ^ + -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF ^ -DLLVM_CONFIG_PATH="%SRC_DIR%\build\%BUILD_CONFIG%\bin\llvm-config.exe" REM try all compatible visual studio toolsets to find one that is installed diff --git a/conda-recipes/llvmdev/build.sh b/conda-recipes/llvmdev/build.sh index 2f8498d5b..87568bf85 100644 --- a/conda-recipes/llvmdev/build.sh +++ b/conda-recipes/llvmdev/build.sh @@ -46,6 +46,16 @@ _cmake_config+=(-DLLVM_ENABLE_RTTI=OFF) _cmake_config+=(-DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}) _cmake_config+=(-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly) _cmake_config+=(-DLLVM_INCLUDE_UTILS=ON) # for llvm-lit +_cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) +_cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) _cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) # Requires clang to be built _cmake_config+=(-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF) # doesn't build without the rest of LLVM project # TODO :: It would be nice if we had a cross-ecosystem 'BUILD_TIME_LIMITED' env var we could use to diff --git a/conda-recipes/llvmdev_manylinux2014/build.sh b/conda-recipes/llvmdev_manylinux2014/build.sh index 9f602841c..97c2fe1a9 100644 --- a/conda-recipes/llvmdev_manylinux2014/build.sh +++ b/conda-recipes/llvmdev_manylinux2014/build.sh @@ -108,6 +108,16 @@ fi declare -a _compiler_rt_cmake_config _compiler_rt_cmake_config+=(-DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}) _compiler_rt_cmake_config+=(-DCMAKE_BUILD_TYPE:STRING=Release) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) +_compiler_rt_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) _compiler_rt_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) _compiler_rt_cmake_config+=(-DLLVM_CONFIG_PATH=../../llvm/build/bin/llvm-config) From fa353ed51cdc124e8794705442197cd2e88d44d2 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Sat, 12 Aug 2023 09:50:49 -0700 Subject: [PATCH 07/15] update windows --- conda-recipes/llvmdev/bld.bat | 97 ++++++++--------------------------- 1 file changed, 21 insertions(+), 76 deletions(-) diff --git a/conda-recipes/llvmdev/bld.bat b/conda-recipes/llvmdev/bld.bat index 50aeb0a30..01607a224 100644 --- a/conda-recipes/llvmdev/bld.bat +++ b/conda-recipes/llvmdev/bld.bat @@ -35,21 +35,14 @@ REM the 64bit linker anyway. This must be passed in to certain generators as REM '-Thost x64'. set PreferredToolArchitecture=x64 -set MAX_INDEX_CMAKE_GENERATOR=1 - -set "CMAKE_GENERATOR[0]=Visual Studio 16 2019" -set "CMAKE_GENERATOR[1]=Visual Studio 17 2022" - -set "CMAKE_GENERATOR_ARCHITECTURE[0]=%GEN_ARCH%" -set "CMAKE_GENERATOR_ARCHITECTURE[1]=%GEN_ARCH%" - -set "CMAKE_GENERATOR_TOOLSET[0]=v142" -set "CMAKE_GENERATOR_TOOLSET[1]=v142" +set "CMAKE_GENERATOR=Visual Studio 16 2019" +set "CMAKE_GENERATOR_ARCHITECTURE=%GEN_ARCH%" +set "CMAKE_GENERATOR_TOOLSET=v142" REM Reduce build times and package size by removing unused stuff REM BENCHMARKS (new for llvm8) don't build under Visual Studio 14 2015 set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="%LLVM_TARGETS_TO_BUILD%" ^ - -DLLVM_ENABLE_PROJECTS:STRING=lld ^ + -DLLVM_ENABLE_PROJECTS:STRING=lld;compiler-rt ^ -DLLVM_ENABLE_ZLIB=OFF ^ -DLLVM_INCLUDE_UTILS=ON ^ -DLLVM_INCLUDE_DOCS=OFF ^ @@ -58,30 +51,28 @@ set CMAKE_CUSTOM=-DLLVM_TARGETS_TO_BUILD="%LLVM_TARGETS_TO_BUILD%" ^ -DLLVM_USE_INTEL_JITEVENTS=ON ^ -DLLVM_INCLUDE_BENCHMARKS=OFF ^ -DLLVM_ENABLE_DIA_SDK=OFF ^ - -DLLVM_ENABLE_LIBXML2:BOOL=OFF ^ - -DCLANG_ENABLE_LIBXML=OFF ^ - -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly ^ + -DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_CRT:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_XRAY:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF ^ + -DCOMPILER_RT_BUILD_ORC:BOOL=OFF ^ + -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF -REM try all compatible visual studio toolsets to find one that is installed -setlocal enabledelayedexpansion -for /l %%n in (0,1,%MAX_INDEX_CMAKE_GENERATOR%) do ( - cmake -G "!CMAKE_GENERATOR[%%n]!" ^ - -A "!CMAKE_GENERATOR_ARCHITECTURE[%%n]!" ^ - -T "!CMAKE_GENERATOR_TOOLSET[%%n]!" ^ - -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" ^ - -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^ - -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^ - %CMAKE_CUSTOM% "%SRC_DIR%\llvm" - if not errorlevel 1 goto configuration_successful - del CMakeCache.txt -) +cmake -G "%CMAKE_GENERATOR%" ^ + -A "%CMAKE_GENERATOR_ARCHITECTURE%" ^ + -T "%CMAKE_GENERATOR_TOOLSET%" ^ + -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" ^ + -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^ + -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^ + %CMAKE_CUSTOM% "%SRC_DIR%\llvm" REM no compatible visual studio toolset was found if errorlevel 1 exit 1 -:configuration_successful -endlocal - REM === Build step === cmake --build . --config "%BUILD_CONFIG%" if errorlevel 1 exit 1 @@ -98,50 +89,4 @@ REM This is technically how to run the suite, but it will only run in an REM enhanced unix-like shell which has functions like `grep` available. REM cd ..\test REM "%PYTHON%" "..\build\%BUILD_CONFIG%\bin\llvm-lit.py" -vv Transforms ExecutionEngine Analysis CodeGen/X86 -REM if errorlevel 1 exit 1 - - -REM Build compiler-rt separately, because it fails on Windows with LLVM 14.0.6 -REM if built as an LLVM project. -REM See also: https://stackoverflow.com/questions/46108390/building-llvm-with-cmake-and-visual-stuidio-fails-to-install - -cd "%SRC_DIR%\compiler-rt" -mkdir build -cd build - -set CMAKE_CUSTOM=DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON ^ - -DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_CRT:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_XRAY:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF ^ - -DCOMPILER_RT_BUILD_ORC:BOOL=OFF ^ - -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF ^ - -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF ^ - -DLLVM_CONFIG_PATH="%SRC_DIR%\build\%BUILD_CONFIG%\bin\llvm-config.exe" - -REM try all compatible visual studio toolsets to find one that is installed -setlocal enabledelayedexpansion -for /l %%n in (0,1,%MAX_INDEX_CMAKE_GENERATOR%) do ( - cmake -G "!CMAKE_GENERATOR[%%n]!" ^ - -A "!CMAKE_GENERATOR_ARCHITECTURE[%%n]!" ^ - -T "!CMAKE_GENERATOR_TOOLSET[%%n]!" ^ - -DCMAKE_BUILD_TYPE="%BUILD_CONFIG%" ^ - -DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^ - -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^ - %CMAKE_CUSTOM% .. - if not errorlevel 1 goto crt_configuration_successful - del CMakeCache.txt -) -if errorlevel 1 exit 1 - -:crt_configuration_successful -endlocal - -cmake --build . --config "%BUILD_CONFIG%" -if errorlevel 1 exit 1 - -cmake --build . --config "%BUILD_CONFIG%" --target install if errorlevel 1 exit 1 From 8663c7fbcdd6816e74ca5f890dc72494c59d7d80 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Sat, 12 Aug 2023 09:52:51 -0700 Subject: [PATCH 08/15] add patch --- conda-recipes/compiler-rt-windows-build.patch | 26 +++++++++++++++++++ conda-recipes/llvmdev/meta.yaml | 1 + 2 files changed, 27 insertions(+) create mode 100644 conda-recipes/compiler-rt-windows-build.patch diff --git a/conda-recipes/compiler-rt-windows-build.patch b/conda-recipes/compiler-rt-windows-build.patch new file mode 100644 index 000000000..74a6ed3ff --- /dev/null +++ b/conda-recipes/compiler-rt-windows-build.patch @@ -0,0 +1,26 @@ +From be79c54f618affc9c4797a5331486fc891d2a4a4 Mon Sep 17 00:00:00 2001 +From: Graham Markall +Date: Fri, 11 Aug 2023 11:31:08 +0100 +Subject: [PATCH] Fix out-of-tree compiler-rt build on Windows + +From: + +https://stackoverflow.com/questions/46108390/building-llvm-with-cmake-and-visual-stuidio-fails-to-install +--- + compiler-rt/cmake/Modules/AddCompilerRT.cmake | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/compiler-rt-14.0.6.src/cmake/Modules/AddCompilerRT.cmake b/compiler-rt-14.0.6.src/cmake/Modules/AddCompilerRT.cmake +index 4a496fc18f65..2ace529a595d 100644 +--- a/compiler-rt-14.0.6.src/cmake/Modules/AddCompilerRT.cmake ++++ b/compiler-rt-14.0.6.src/cmake/Modules/AddCompilerRT.cmake +@@ -9,6 +9,7 @@ function(set_target_output_directories target output_dir) + # set 'RUNTIME_OUTPUT_DIRECTORY_${CONF}': + # RUNTIME_OUTPUT_DIRECTORY_DEBUG, RUNTIME_OUTPUT_DIRECTORY_RELEASE, ... + if(CMAKE_CONFIGURATION_TYPES) ++ string(REGEX REPLACE "\\$\\(Configuration\\)" "$" output_dir "${output_dir}") + foreach(build_mode ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER "${build_mode}" CONFIG_SUFFIX) + set_target_properties("${target}" PROPERTIES +-- +2.40.0 diff --git a/conda-recipes/llvmdev/meta.yaml b/conda-recipes/llvmdev/meta.yaml index a8ebf764d..5ba003630 100644 --- a/conda-recipes/llvmdev/meta.yaml +++ b/conda-recipes/llvmdev/meta.yaml @@ -33,6 +33,7 @@ source: folder: rt patches: - ../compiler-rt-14-fp-xstate-magic1.patch + - ../compiler-rt-windows-build.patch build: number: {{ build_number }} From 9597a31ad2852a57fbbd279bdd55fa9bf378b223 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Mon, 14 Aug 2023 11:09:51 -0700 Subject: [PATCH 09/15] address feedback --- .../compiler-rt-14-fp-xstate-magic1.patch | 46 --------------- conda-recipes/llvmdev/bld.bat | 2 +- conda-recipes/llvmdev/build.sh | 3 +- conda-recipes/llvmdev/meta.yaml | 7 --- conda-recipes/llvmdev_manylinux2014/build.sh | 56 ++++--------------- conda-recipes/llvmdev_manylinux2014/meta.yaml | 7 --- 6 files changed, 14 insertions(+), 107 deletions(-) delete mode 100644 conda-recipes/compiler-rt-14-fp-xstate-magic1.patch diff --git a/conda-recipes/compiler-rt-14-fp-xstate-magic1.patch b/conda-recipes/compiler-rt-14-fp-xstate-magic1.patch deleted file mode 100644 index 371996bca..000000000 --- a/conda-recipes/compiler-rt-14-fp-xstate-magic1.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 6f095babc2b7d564168c7afc5bf6afb2188fd6b4 Mon Sep 17 00:00:00 2001 -From: Tobias Burnus -Date: Thu, 5 May 2022 10:30:10 +0100 -Subject: [PATCH] sanitizer_common: Define FP_XSTATE_MAGIC1 for old glibc -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -D116208 (commit 1298273e8206a8fc2) added FP_XSTATE_MAGIC1. -However, when building with glibc < 2.16 for backward-dependency -compatibility, it is not defined - and the build breaks. - -Note: The define comes from Linux's asm/sigcontext.h but the -file uses signal.h which includes glibc's bits/sigcontext.h - which -is synced from the kernel's file but lags behind. - -Solution: For backward compatility with ancient systems, define -FP_XSTATE_MAGIC1 if undefined. - -//For the old systems, we were building with Linux kernel 3.19 but to support really old glibc systems, we build with a sysroot of glibc 2.12. While our kernel (and the users' kernels) have FP_XSTATE_MAGIC1, glibc 2.12 is too old. – With this patch, building the sanitizer libs works again. This showed up for us today as GCC mainline/13 has now synced the sanitizer libs.// - -Reviewed By: #sanitizers, vitalybuka - -Differential Revision: https://reviews.llvm.org/D124927 ---- - .../lib/sanitizer_common/sanitizer_platform_limits_posix.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/compiler-rt-14.0.6.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt-14.0.6.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp -index e5cecaaaffc2..8ed3e92d2704 100644 ---- a/compiler-rt-14.0.6.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp -+++ b/compiler-rt-14.0.6.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp -@@ -218,6 +218,10 @@ namespace __sanitizer { - - unsigned ucontext_t_sz(void *ctx) { - # if SANITIZER_GLIBC && SANITIZER_X64 -+ // Added in Linux kernel 3.4.0, merged to glibc in 2.16 -+# ifndef FP_XSTATE_MAGIC1 -+# define FP_XSTATE_MAGIC1 0x46505853U -+# endif - // See kernel arch/x86/kernel/fpu/signal.c for details. - const auto *fpregs = static_cast(ctx)->uc_mcontext.fpregs; - // The member names differ across header versions, but the actual layout --- -2.40.0 - diff --git a/conda-recipes/llvmdev/bld.bat b/conda-recipes/llvmdev/bld.bat index 01607a224..f4035ab84 100644 --- a/conda-recipes/llvmdev/bld.bat +++ b/conda-recipes/llvmdev/bld.bat @@ -89,4 +89,4 @@ REM This is technically how to run the suite, but it will only run in an REM enhanced unix-like shell which has functions like `grep` available. REM cd ..\test REM "%PYTHON%" "..\build\%BUILD_CONFIG%\bin\llvm-lit.py" -vv Transforms ExecutionEngine Analysis CodeGen/X86 -if errorlevel 1 exit 1 +REM if errorlevel 1 exit 1 diff --git a/conda-recipes/llvmdev/build.sh b/conda-recipes/llvmdev/build.sh index 87568bf85..47663419e 100644 --- a/conda-recipes/llvmdev/build.sh +++ b/conda-recipes/llvmdev/build.sh @@ -46,6 +46,7 @@ _cmake_config+=(-DLLVM_ENABLE_RTTI=OFF) _cmake_config+=(-DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}) _cmake_config+=(-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly) _cmake_config+=(-DLLVM_INCLUDE_UTILS=ON) # for llvm-lit +_cmake_config+=(-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF) # doesn't build without the rest of LLVM project _cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) _cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) _cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) @@ -55,9 +56,7 @@ _cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) _cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) _cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) _cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) -_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) _cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) # Requires clang to be built -_cmake_config+=(-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF) # doesn't build without the rest of LLVM project # TODO :: It would be nice if we had a cross-ecosystem 'BUILD_TIME_LIMITED' env var we could use to # disable these unnecessary but useful things. if [[ ${CONDA_FORGE} == yes ]]; then diff --git a/conda-recipes/llvmdev/meta.yaml b/conda-recipes/llvmdev/meta.yaml index 5ba003630..374d05ce1 100644 --- a/conda-recipes/llvmdev/meta.yaml +++ b/conda-recipes/llvmdev/meta.yaml @@ -27,13 +27,6 @@ source: sha256: {{ sha256_libunwind }} folder: unwind - - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/compiler-rt-{{ version }}.src.tar.xz - fn: compiler-rt-{{ version }}.src.tar.xz - sha256: {{ sha256_compiler_rt }} - folder: rt - patches: - - ../compiler-rt-14-fp-xstate-magic1.patch - - ../compiler-rt-windows-build.patch build: number: {{ build_number }} diff --git a/conda-recipes/llvmdev_manylinux2014/build.sh b/conda-recipes/llvmdev_manylinux2014/build.sh index 97c2fe1a9..8af2f04da 100644 --- a/conda-recipes/llvmdev_manylinux2014/build.sh +++ b/conda-recipes/llvmdev_manylinux2014/build.sh @@ -22,7 +22,7 @@ mv unwind/libunwind-*.src libunwind declare -a _cmake_config _cmake_config+=(-DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}) _cmake_config+=(-DCMAKE_BUILD_TYPE:STRING=Release) -_cmake_config+=(-DLLVM_ENABLE_PROJECTS:STRING="lld") +_cmake_config+=(-DLLVM_ENABLE_PROJECTS:STRING="lld;compiler-rt") # The bootstrap clang I use was built with a static libLLVMObject.a and I trying to get the same here # _cmake_config+=(-DBUILD_SHARED_LIBS:BOOL=ON) _cmake_config+=(-DLLVM_ENABLE_ASSERTIONS:BOOL=ON) @@ -45,6 +45,16 @@ _cmake_config+=(-DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}) _cmake_config+=(-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly) _cmake_config+=(-DLLVM_INCLUDE_UTILS=ON) # for llvm-lit _cmake_config+=(-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF) # doesn't build without the rest of LLVM project +_cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) +_cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) +_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) # TODO :: It would be nice if we had a cross-ecosystem 'BUILD_TIME_LIMITED' env var we could use to # disable these unnecessary but useful things. if [[ ${CONDA_FORGE} == yes ]]; then @@ -93,46 +103,4 @@ fi make check-llvm-unit || exit $? # From: https://github.com/conda-forge/llvmdev-feedstock/pull/53 -make install || exit $? - -# run the tests, skip some on linux-32 -cd ../test -if [[ $ARCH == 'i686' ]]; then - ../build/bin/llvm-lit -vv Transforms Analysis CodeGen/X86 -else - ../build/bin/llvm-lit -vv Transforms ExecutionEngine Analysis CodeGen/X86 -fi - -# Next, build compiler-rt - -declare -a _compiler_rt_cmake_config -_compiler_rt_cmake_config+=(-DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}) -_compiler_rt_cmake_config+=(-DCMAKE_BUILD_TYPE:STRING=Release) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_PROFILE:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_GWP_ASAN:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_BUILD_ORC:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) -_compiler_rt_cmake_config+=(-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF) -_compiler_rt_cmake_config+=(-DLLVM_CONFIG_PATH=../../llvm/build/bin/llvm-config) - -cd ../../compiler-rt -mkdir build -cd build - -cmake -G'Unix Makefiles' \ - "${_compiler_rt_cmake_config[@]}" \ - .. - -if [ $ARCH == 'armv7l' ]; then # RPi need thread count throttling - make -j2 VERBOSE=1 -else - make -j${CPU_COUNT} VERBOSE=1 -fi - -make install \ No newline at end of file +make install || exit $? \ No newline at end of file diff --git a/conda-recipes/llvmdev_manylinux2014/meta.yaml b/conda-recipes/llvmdev_manylinux2014/meta.yaml index 298fa8500..e045edc42 100644 --- a/conda-recipes/llvmdev_manylinux2014/meta.yaml +++ b/conda-recipes/llvmdev_manylinux2014/meta.yaml @@ -29,13 +29,6 @@ source: sha256: {{ sha256_libunwind }} folder: unwind - - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/compiler-rt-{{ version }}.src.tar.xz - fn: compiler-rt-{{ version }}.src.tar.xz - sha256: {{ sha256_compiler_rt }} - folder: rt - patches: - - ../compiler-rt-14-fp-xstate-magic1.patch - build: number: {{ build_number }} string: "manylinux2014h{{ PKG_HASH }}" From 75e82e10145e114651211554d8336b0f344fcf18 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Mon, 14 Aug 2023 11:13:56 -0700 Subject: [PATCH 10/15] revert an unintended change --- conda-recipes/llvmdev/meta.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conda-recipes/llvmdev/meta.yaml b/conda-recipes/llvmdev/meta.yaml index 374d05ce1..3899b4c7c 100644 --- a/conda-recipes/llvmdev/meta.yaml +++ b/conda-recipes/llvmdev/meta.yaml @@ -27,6 +27,12 @@ source: sha256: {{ sha256_libunwind }} folder: unwind + - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/compiler-rt-{{ version }}.src.tar.xz + fn: compiler-rt-{{ version }}.src.tar.xz + sha256: {{ sha256_compiler_rt }} + folder: rt + patches: + - ../compiler-rt-windows-build.patch build: number: {{ build_number }} From 77be29de6ef0fa2330f763ef2f14a89bbdba3d60 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Mon, 14 Aug 2023 14:06:00 -0700 Subject: [PATCH 11/15] reset another unintended deletion --- conda-recipes/llvmdev_manylinux2014/meta.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/conda-recipes/llvmdev_manylinux2014/meta.yaml b/conda-recipes/llvmdev_manylinux2014/meta.yaml index e045edc42..bff7aec74 100644 --- a/conda-recipes/llvmdev_manylinux2014/meta.yaml +++ b/conda-recipes/llvmdev_manylinux2014/meta.yaml @@ -29,6 +29,11 @@ source: sha256: {{ sha256_libunwind }} folder: unwind + - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/compiler-rt-{{ version }}.src.tar.xz + fn: compiler-rt-{{ version }}.src.tar.xz + sha256: {{ sha256_compiler_rt }} + folder: rt + build: number: {{ build_number }} string: "manylinux2014h{{ PKG_HASH }}" From ce0d80146b719869b1a7862b66c25cb895d938d6 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Tue, 15 Aug 2023 11:44:14 -0700 Subject: [PATCH 12/15] cosmetic fixes --- conda-recipes/llvmdev/meta.yaml | 1 + conda-recipes/llvmdev_manylinux2014/meta.yaml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipes/llvmdev/meta.yaml b/conda-recipes/llvmdev/meta.yaml index 3899b4c7c..a2f6a7ad6 100644 --- a/conda-recipes/llvmdev/meta.yaml +++ b/conda-recipes/llvmdev/meta.yaml @@ -18,6 +18,7 @@ source: - ../llvm14-clear-gotoffsetmap.patch - ../llvm14-remove-use-of-clonefile.patch - ../llvm14-svml.patch + - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version }}/lld-{{ version }}.src.tar.xz fn: lld-{{ version }}.src.tar.xz sha256: {{ sha256_lld }} diff --git a/conda-recipes/llvmdev_manylinux2014/meta.yaml b/conda-recipes/llvmdev_manylinux2014/meta.yaml index bff7aec74..c153dec59 100644 --- a/conda-recipes/llvmdev_manylinux2014/meta.yaml +++ b/conda-recipes/llvmdev_manylinux2014/meta.yaml @@ -3,7 +3,6 @@ {% set sha256_llvm = "050922ecaaca5781fdf6631ea92bc715183f202f9d2f15147226f023414f619a" %} {% set sha256_lld = "0c28ce0496934d37d20fec96591032dd66af8d10178a45762e0e75e85cf95ad3" %} {% set sha256_libunwind = "3bbe9c23c73259fe39c045dc87d0b283236ba6e00750a226b2c2aeac4a51d86b" %} -{% set build_number = "1" %} {% set sha256_compiler_rt = "88df303840ca8fbff944e15e61c141226fe79f5d2b8e89fb024264d77841a02e" %} {% set build_number = "2" %} From 580aba56ef96147140d0d696ff87f9e21647b4dc Mon Sep 17 00:00:00 2001 From: oliverhu Date: Sat, 2 Sep 2023 09:13:48 -0700 Subject: [PATCH 13/15] fix macos build --- conda-recipes/compiler-rt-macos-build.patch | 15 +++++++++++++++ conda-recipes/llvmdev/build.sh | 1 + conda-recipes/llvmdev/meta.yaml | 1 + 3 files changed, 17 insertions(+) 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..38e411d51 --- /dev/null +++ b/conda-recipes/compiler-rt-macos-build.patch @@ -0,0 +1,15 @@ +diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake +index 3209715..6df7318 100644 +--- a/cmake/Modules/CompilerRTDarwinUtils.cmake ++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake +@@ -390,7 +390,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 -DVISIBILITY_HIDDEN CFLAGS) ++ + set(CMAKE_C_FLAGS "") + set(CMAKE_CXX_FLAGS "") + set(CMAKE_ASM_FLAGS "") diff --git a/conda-recipes/llvmdev/build.sh b/conda-recipes/llvmdev/build.sh index 47663419e..95b8978df 100644 --- a/conda-recipes/llvmdev/build.sh +++ b/conda-recipes/llvmdev/build.sh @@ -48,6 +48,7 @@ _cmake_config+=(-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly) _cmake_config+=(-DLLVM_INCLUDE_UTILS=ON) # for llvm-lit _cmake_config+=(-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF) # doesn't build without the rest of LLVM project _cmake_config+=(-DCOMPILER_RT_BUILD_BUILTINS:BOOL=ON) +_cmake_config+=(-DCOMPILER_RT_BUILTINS_HIDE_SYMBOLS=OFF) _cmake_config+=(-DCOMPILER_RT_BUILD_LIBFUZZER:BOOL=OFF) _cmake_config+=(-DCOMPILER_RT_BUILD_CRT:BOOL=OFF) _cmake_config+=(-DCOMPILER_RT_BUILD_MEMPROF:BOOL=OFF) diff --git a/conda-recipes/llvmdev/meta.yaml b/conda-recipes/llvmdev/meta.yaml index a2f6a7ad6..6520312bc 100644 --- a/conda-recipes/llvmdev/meta.yaml +++ b/conda-recipes/llvmdev/meta.yaml @@ -34,6 +34,7 @@ source: folder: rt patches: - ../compiler-rt-windows-build.patch + - ../compiler-rt-macos-build.patch build: number: {{ build_number }} From 6dbbe2c2ff15ae1f55d41a29971fce26d5572c93 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Sat, 2 Sep 2023 09:21:59 -0700 Subject: [PATCH 14/15] fix diff address --- conda-recipes/compiler-rt-macos-build.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conda-recipes/compiler-rt-macos-build.patch b/conda-recipes/compiler-rt-macos-build.patch index 38e411d51..acba23c36 100644 --- a/conda-recipes/compiler-rt-macos-build.patch +++ b/conda-recipes/compiler-rt-macos-build.patch @@ -1,7 +1,7 @@ diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake index 3209715..6df7318 100644 ---- a/cmake/Modules/CompilerRTDarwinUtils.cmake -+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake +--- a/compiler-rt-14.0.6.src/cmake/Modules/CompilerRTDarwinUtils.cmake ++++ b/compiler-rt-14.0.6.src/cmake/Modules/CompilerRTDarwinUtils.cmake @@ -390,7 +390,9 @@ endfunction() macro(darwin_add_builtin_libraries) set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes) From 2fea8a7835497a8295c179268b5fe3065a1c12a6 Mon Sep 17 00:00:00 2001 From: oliverhu Date: Sat, 2 Sep 2023 16:22:57 -0700 Subject: [PATCH 15/15] fix a typo --- conda-recipes/llvmdev/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipes/llvmdev/build.sh b/conda-recipes/llvmdev/build.sh index 95b8978df..2a14ba391 100644 --- a/conda-recipes/llvmdev/build.sh +++ b/conda-recipes/llvmdev/build.sh @@ -13,7 +13,7 @@ if [[ $build_platform == osx-arm64 ]]; then DARWIN_ARCH=arm64 else DARWIN_TARGET=x86_64-apple-darwin13.4.0 - DARWIN_ARCH=arm64 + DARWIN_ARCH=x86_64 fi mv llvm-*.src llvm