From 8886325b16f12b5a5acf7da52b955a8aa84e5dd3 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 15:25:43 +1100 Subject: [PATCH 01/28] add bolt --- recipes/bolt/bld.bat | 18 ++++++++++++++++++ recipes/bolt/build.sh | 15 +++++++++++++++ recipes/bolt/meta.yaml | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 recipes/bolt/bld.bat create mode 100644 recipes/bolt/build.sh create mode 100644 recipes/bolt/meta.yaml diff --git a/recipes/bolt/bld.bat b/recipes/bolt/bld.bat new file mode 100644 index 0000000000000..6df6fa35bc213 --- /dev/null +++ b/recipes/bolt/bld.bat @@ -0,0 +1,18 @@ +@echo on + +mkdir build +cd build + +set CC=cl.exe +set CXX=cl.exe + +cmake -G "Ninja" ^ + -DCMAKE_BUILD_TYPE="Release" ^ + -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ + -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ + -DCMAKE_INSTALL_LIBDIR=%LIBRARY_PREFIX%\lib ^ + %SRC_DIR%/bolt +if %ERRORLEVEL% neq 0 exit 1 + +cmake --build . --target install +if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipes/bolt/build.sh b/recipes/bolt/build.sh new file mode 100644 index 0000000000000..937f15ab52cd8 --- /dev/null +++ b/recipes/bolt/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -ex + +mkdir build +cd build + +cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_PREFIX_PATH=$PREFIX \ + ${CMAKE_ARGS} \ + ../bolt + +cmake --build . +cmake --install . diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml new file mode 100644 index 0000000000000..d2ae945aa1ec2 --- /dev/null +++ b/recipes/bolt/meta.yaml @@ -0,0 +1,39 @@ +{% set version = "15.0.7" %} + +package: + name: bolt + version: {{ version }} + +source: + url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz + sha256: 8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6 + +build: + number: 0 + +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - cmake + - ninja + - clangdev == {{ version }} # [build_platform != target_platform] + - llvmdev =={{ version }} # [build_platform != target_platform] + host: + - clangdev == {{ version }} + - llvmdev =={{ version }} + +test: + commands: + - llvm-bolt --version + +about: + home: https://github.com/llvm/llvm-project/tree/main/bolt + license: Apache-2.0 WITH LLVM-exception + license_file: bolt/LICENSE.TXT + summary: BOLT is a post-link optimizer developed to speed up large applications. + dev_url: https://github.com/llvm/llvm-project/ + +extra: + recipe-maintainers: + - h-vetinari From e9097a6132555841008b371eb1437726d861ab36 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 15:26:25 +1100 Subject: [PATCH 02/28] lint --- recipes/bolt/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index d2ae945aa1ec2..f724c88bd182f 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -17,10 +17,10 @@ requirements: - {{ compiler('cxx') }} - cmake - ninja - - clangdev == {{ version }} # [build_platform != target_platform] + - clangdev =={{ version }} # [build_platform != target_platform] - llvmdev =={{ version }} # [build_platform != target_platform] host: - - clangdev == {{ version }} + - clangdev =={{ version }} - llvmdev =={{ version }} test: From b8883815dab0eb86522651a1333738fabddd2553 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 15:26:59 +1100 Subject: [PATCH 03/28] rename to llvm-bolt --- recipes/bolt/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index f724c88bd182f..58a03e3616412 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -1,7 +1,7 @@ {% set version = "15.0.7" %} package: - name: bolt + name: llvm-bolt version: {{ version }} source: From 4d9a06b62bf940c6369eb688e7a31aad211dee74 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 15:42:13 +1100 Subject: [PATCH 04/28] patch in minimal standalone changes for bolt CMakeLists --- recipes/bolt/meta.yaml | 2 ++ ...hanges-to-make-bolt-build-standalone.patch | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index 58a03e3616412..d791b2a6631ee 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -7,6 +7,8 @@ package: source: url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz sha256: 8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6 + patches: + - patches/0001-minimal-changes-to-make-bolt-build-standalone.patch build: number: 0 diff --git a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch new file mode 100644 index 0000000000000..ae279a1ecf20f --- /dev/null +++ b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch @@ -0,0 +1,31 @@ +From 04a54f895d5aeec8015334a888cd73f910580239 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Sat, 4 Mar 2023 15:41:08 +1100 +Subject: [PATCH] minimal changes to make bolt build standalone + +--- + bolt/CMakeLists.txt | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt +index a97878cd3c..b1e0bd0aab 100644 +--- a/bolt/CMakeLists.txt ++++ b/bolt/CMakeLists.txt +@@ -1,5 +1,14 @@ + include(ExternalProject) + ++cmake_minimum_required(VERSION 3.13.4) ++ ++# Check for a standalone build and configure as appropriate from ++# there. ++if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) ++ message("Building Flang as a standalone project.") ++ project(Bolt) ++endif() ++ + set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + set(CMAKE_CXX_STANDARD 14) +-- +2.38.1.windows.1 + From c7c344f4e2a7efebdc73961cf477c6b583b65949 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 16:04:47 +1100 Subject: [PATCH 05/28] simplify patch --- ...changes-to-make-bolt-build-standalone.patch | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch index ae279a1ecf20f..e58fc3bd462b7 100644 --- a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch +++ b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch @@ -1,27 +1,21 @@ -From 04a54f895d5aeec8015334a888cd73f910580239 Mon Sep 17 00:00:00 2001 +From aad066540c383da4525bd02cfd084cc72d753b4d Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 15:41:08 +1100 Subject: [PATCH] minimal changes to make bolt build standalone --- - bolt/CMakeLists.txt | 9 +++++++++ - 1 file changed, 9 insertions(+) + bolt/CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt -index a97878cd3c..b1e0bd0aab 100644 +index a97878cd3c..acff1d924e 100644 --- a/bolt/CMakeLists.txt +++ b/bolt/CMakeLists.txt -@@ -1,5 +1,14 @@ +@@ -1,5 +1,8 @@ include(ExternalProject) +cmake_minimum_required(VERSION 3.13.4) -+ -+# Check for a standalone build and configure as appropriate from -+# there. -+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) -+ message("Building Flang as a standalone project.") -+ project(Bolt) -+endif() ++project(Bolt) + set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) From dd2dbeb7fb88f373e6ab3c4afc53e438c4652b03 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 16:07:31 +1100 Subject: [PATCH 06/28] include necessary CMake module --- ...-changes-to-make-bolt-build-standalone.patch | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch index e58fc3bd462b7..c30f53ce49da2 100644 --- a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch +++ b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch @@ -1,25 +1,24 @@ -From aad066540c383da4525bd02cfd084cc72d753b4d Mon Sep 17 00:00:00 2001 +From bb604561746671d89d6eddc63328b6485509e169 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 15:41:08 +1100 Subject: [PATCH] minimal changes to make bolt build standalone --- - bolt/CMakeLists.txt | 3 +++ - 1 file changed, 3 insertions(+) + bolt/CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt -index a97878cd3c..acff1d924e 100644 +index a97878cd3c..b4d6862931 100644 --- a/bolt/CMakeLists.txt +++ b/bolt/CMakeLists.txt -@@ -1,5 +1,8 @@ - include(ExternalProject) - +@@ -1,3 +1,7 @@ +cmake_minimum_required(VERSION 3.13.4) +project(Bolt) + ++include(AddLLVM) + include(ExternalProject) + set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) - set(CMAKE_CXX_STANDARD 14) -- 2.38.1.windows.1 From 12d9023f9e59de805ce38131b2c27d77b27464e1 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 16:28:16 +1100 Subject: [PATCH 07/28] point CMAKE_MODULE_PATH to llvm's cmake/Modules --- recipes/bolt/bld.bat | 4 ++-- recipes/bolt/build.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/bolt/bld.bat b/recipes/bolt/bld.bat index 6df6fa35bc213..d2317b51ad6f7 100644 --- a/recipes/bolt/bld.bat +++ b/recipes/bolt/bld.bat @@ -8,9 +8,9 @@ set CXX=cl.exe cmake -G "Ninja" ^ -DCMAKE_BUILD_TYPE="Release" ^ - -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ - -DCMAKE_INSTALL_LIBDIR=%LIBRARY_PREFIX%\lib ^ + -DCMAKE_MODULE_PATH=..\cmake\Modules ^ + -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ %SRC_DIR%/bolt if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipes/bolt/build.sh b/recipes/bolt/build.sh index 937f15ab52cd8..29753bdf63035 100644 --- a/recipes/bolt/build.sh +++ b/recipes/bolt/build.sh @@ -7,6 +7,7 @@ cd build cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_MODULE_PATH=../cmake/Modules \ -DCMAKE_PREFIX_PATH=$PREFIX \ ${CMAKE_ARGS} \ ../bolt From 46b34e2dc6359f4aff7b7b1d2ea4f6f4b67d3902 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 17:05:39 +1100 Subject: [PATCH 08/28] patch in module search path like libcxx --- recipes/bolt/bld.bat | 1 - recipes/bolt/build.sh | 1 - recipes/bolt/meta.yaml | 1 + ...hanges-to-make-bolt-build-standalone.patch | 2 +- .../0002-module-path-code-from-libcxx.patch | 31 +++++++++++++++++++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 recipes/bolt/patches/0002-module-path-code-from-libcxx.patch diff --git a/recipes/bolt/bld.bat b/recipes/bolt/bld.bat index d2317b51ad6f7..044aae27c50fc 100644 --- a/recipes/bolt/bld.bat +++ b/recipes/bolt/bld.bat @@ -9,7 +9,6 @@ set CXX=cl.exe cmake -G "Ninja" ^ -DCMAKE_BUILD_TYPE="Release" ^ -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ - -DCMAKE_MODULE_PATH=..\cmake\Modules ^ -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ %SRC_DIR%/bolt if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipes/bolt/build.sh b/recipes/bolt/build.sh index 29753bdf63035..937f15ab52cd8 100644 --- a/recipes/bolt/build.sh +++ b/recipes/bolt/build.sh @@ -7,7 +7,6 @@ cd build cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ - -DCMAKE_MODULE_PATH=../cmake/Modules \ -DCMAKE_PREFIX_PATH=$PREFIX \ ${CMAKE_ARGS} \ ../bolt diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index d791b2a6631ee..02a4cd0e3d6da 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -9,6 +9,7 @@ source: sha256: 8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6 patches: - patches/0001-minimal-changes-to-make-bolt-build-standalone.patch + - patches/0002-module-path-code-from-libcxx.patch build: number: 0 diff --git a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch index c30f53ce49da2..ae67f919fb75b 100644 --- a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch +++ b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch @@ -1,7 +1,7 @@ From bb604561746671d89d6eddc63328b6485509e169 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 15:41:08 +1100 -Subject: [PATCH] minimal changes to make bolt build standalone +Subject: [PATCH 1/2] minimal changes to make bolt build standalone --- bolt/CMakeLists.txt | 4 ++++ diff --git a/recipes/bolt/patches/0002-module-path-code-from-libcxx.patch b/recipes/bolt/patches/0002-module-path-code-from-libcxx.patch new file mode 100644 index 0000000000000..f2f510d19a815 --- /dev/null +++ b/recipes/bolt/patches/0002-module-path-code-from-libcxx.patch @@ -0,0 +1,31 @@ +From decd9c824e7f7b86b70034f953515cd9fc2549d0 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Sat, 4 Mar 2023 17:04:37 +1100 +Subject: [PATCH 2/2] module path code from libcxx + +--- + bolt/CMakeLists.txt | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt +index b4d6862931..235fa0f9c0 100644 +--- a/bolt/CMakeLists.txt ++++ b/bolt/CMakeLists.txt +@@ -1,6 +1,14 @@ + cmake_minimum_required(VERSION 3.13.4) + project(Bolt) + ++set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") ++ ++# Add path for custom modules ++list(INSERT CMAKE_MODULE_PATH 0 ++ "${LLVM_COMMON_CMAKE_UTILS}" ++ "${LLVM_COMMON_CMAKE_UTILS}/Modules" ++) ++ + include(AddLLVM) + include(ExternalProject) + +-- +2.38.1.windows.1 + From 350e74c464ce60de34fe3c01bd6df45c2d5552ed Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 17:28:55 +1100 Subject: [PATCH 09/28] try lld approach --- recipes/bolt/meta.yaml | 2 +- .../0002-module-path-code-from-libcxx.patch | 31 ------------------- .../0002-module-path-code-from-lld.patch | 26 ++++++++++++++++ 3 files changed, 27 insertions(+), 32 deletions(-) delete mode 100644 recipes/bolt/patches/0002-module-path-code-from-libcxx.patch create mode 100644 recipes/bolt/patches/0002-module-path-code-from-lld.patch diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index 02a4cd0e3d6da..7b6af63210fee 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -9,7 +9,7 @@ source: sha256: 8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6 patches: - patches/0001-minimal-changes-to-make-bolt-build-standalone.patch - - patches/0002-module-path-code-from-libcxx.patch + - patches/0002-module-path-code-from-lld.patch build: number: 0 diff --git a/recipes/bolt/patches/0002-module-path-code-from-libcxx.patch b/recipes/bolt/patches/0002-module-path-code-from-libcxx.patch deleted file mode 100644 index f2f510d19a815..0000000000000 --- a/recipes/bolt/patches/0002-module-path-code-from-libcxx.patch +++ /dev/null @@ -1,31 +0,0 @@ -From decd9c824e7f7b86b70034f953515cd9fc2549d0 Mon Sep 17 00:00:00 2001 -From: "H. Vetinari" -Date: Sat, 4 Mar 2023 17:04:37 +1100 -Subject: [PATCH 2/2] module path code from libcxx - ---- - bolt/CMakeLists.txt | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt -index b4d6862931..235fa0f9c0 100644 ---- a/bolt/CMakeLists.txt -+++ b/bolt/CMakeLists.txt -@@ -1,6 +1,14 @@ - cmake_minimum_required(VERSION 3.13.4) - project(Bolt) - -+set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") -+ -+# Add path for custom modules -+list(INSERT CMAKE_MODULE_PATH 0 -+ "${LLVM_COMMON_CMAKE_UTILS}" -+ "${LLVM_COMMON_CMAKE_UTILS}/Modules" -+) -+ - include(AddLLVM) - include(ExternalProject) - --- -2.38.1.windows.1 - diff --git a/recipes/bolt/patches/0002-module-path-code-from-lld.patch b/recipes/bolt/patches/0002-module-path-code-from-lld.patch new file mode 100644 index 0000000000000..a1af8ee1071e6 --- /dev/null +++ b/recipes/bolt/patches/0002-module-path-code-from-lld.patch @@ -0,0 +1,26 @@ +From af702144bbccd081281e8d24e3adee49577ad4c0 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Sat, 4 Mar 2023 17:28:21 +1100 +Subject: [PATCH 2/2] module path code from lld + +--- + bolt/CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt +index b4d6862931..d5ecd104a0 100644 +--- a/bolt/CMakeLists.txt ++++ b/bolt/CMakeLists.txt +@@ -1,6 +1,9 @@ + cmake_minimum_required(VERSION 3.13.4) + project(Bolt) + ++find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}") ++list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}") ++ + include(AddLLVM) + include(ExternalProject) + +-- +2.38.1.windows.1 + From aedb4eed3cbdc49ee1ee5eaa0a2e7872fbb43ace Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 15 Apr 2023 16:32:41 +1100 Subject: [PATCH 10/28] bump to 16.0.1 --- recipes/bolt/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index 7b6af63210fee..b5b05d35b1ef8 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "15.0.7" %} +{% set version = "16.0.1" %} package: name: llvm-bolt @@ -6,7 +6,7 @@ package: source: url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz - sha256: 8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6 + sha256: ab7e3b95adb88fd5b669ca8c1d3c1e8d2a601c4478290d3ae31d8d70e96f2064 patches: - patches/0001-minimal-changes-to-make-bolt-build-standalone.patch - patches/0002-module-path-code-from-lld.patch From 61cc902a78b7cc2d5c808b51700042e68174f003 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 15 Apr 2023 16:33:57 +1100 Subject: [PATCH 11/28] use matching compiler on osx --- recipes/bolt/conda_build_config.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 recipes/bolt/conda_build_config.yaml diff --git a/recipes/bolt/conda_build_config.yaml b/recipes/bolt/conda_build_config.yaml new file mode 100644 index 0000000000000..9753cda4770bb --- /dev/null +++ b/recipes/bolt/conda_build_config.yaml @@ -0,0 +1,4 @@ +c_compiler_version: # [osx] + - 16 # [osx] +cxx_compiler_version: # [osx] + - 16 # [osx] From f79e231696d9f722fb33c6457c9d8818c4964242 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 15 Apr 2023 16:50:02 +1100 Subject: [PATCH 12/28] support libs --- recipes/bolt/meta.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index b5b05d35b1ef8..b4fc33adb36d0 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -25,6 +25,9 @@ requirements: host: - clangdev =={{ version }} - llvmdev =={{ version }} + - libxml2 + - zlib + - zstd test: commands: From dca8d45b0dcb06137b2c67844b53425d3a09236a Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 18 May 2023 15:07:20 +1100 Subject: [PATCH 13/28] bump to 16.0.3 --- recipes/bolt/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index b4fc33adb36d0..5f63a289db3f7 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "16.0.1" %} +{% set version = "16.0.3" %} package: name: llvm-bolt @@ -6,7 +6,7 @@ package: source: url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz - sha256: ab7e3b95adb88fd5b669ca8c1d3c1e8d2a601c4478290d3ae31d8d70e96f2064 + sha256: 3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2 patches: - patches/0001-minimal-changes-to-make-bolt-build-standalone.patch - patches/0002-module-path-code-from-lld.patch From 19aebfcadcda604b65a5d9095c22a3c5414e53cc Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Wed, 10 Jul 2024 14:56:51 +1100 Subject: [PATCH 14/28] bump to 17.0.6 --- recipes/bolt/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index 5f63a289db3f7..6f9ddac0d738e 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "16.0.3" %} +{% set version = "17.0.6" %} package: name: llvm-bolt @@ -6,7 +6,7 @@ package: source: url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz - sha256: 3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2 + sha256: 58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813 patches: - patches/0001-minimal-changes-to-make-bolt-build-standalone.patch - patches/0002-module-path-code-from-lld.patch From 828a41bde8930af376769e08527f2daa6722a881 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Wed, 10 Jul 2024 14:57:21 +1100 Subject: [PATCH 15/28] rebase patches --- ...001-minimal-changes-to-make-bolt-build-standalone.patch | 7 ++----- recipes/bolt/patches/0002-module-path-code-from-lld.patch | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch index ae67f919fb75b..f29b0b5ca3db8 100644 --- a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch +++ b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch @@ -1,4 +1,4 @@ -From bb604561746671d89d6eddc63328b6485509e169 Mon Sep 17 00:00:00 2001 +From 9a9498549c50b08746b4a1fc737a2ccf77f5a25e Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 15:41:08 +1100 Subject: [PATCH 1/2] minimal changes to make bolt build standalone @@ -8,7 +8,7 @@ Subject: [PATCH 1/2] minimal changes to make bolt build standalone 1 file changed, 4 insertions(+) diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt -index a97878cd3c..b4d6862931 100644 +index 4ff90c1f7b3a..ece7589df21a 100644 --- a/bolt/CMakeLists.txt +++ b/bolt/CMakeLists.txt @@ -1,3 +1,7 @@ @@ -19,6 +19,3 @@ index a97878cd3c..b4d6862931 100644 include(ExternalProject) set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) --- -2.38.1.windows.1 - diff --git a/recipes/bolt/patches/0002-module-path-code-from-lld.patch b/recipes/bolt/patches/0002-module-path-code-from-lld.patch index a1af8ee1071e6..83d66f7908d9b 100644 --- a/recipes/bolt/patches/0002-module-path-code-from-lld.patch +++ b/recipes/bolt/patches/0002-module-path-code-from-lld.patch @@ -1,4 +1,4 @@ -From af702144bbccd081281e8d24e3adee49577ad4c0 Mon Sep 17 00:00:00 2001 +From 03e49260a6bb072fd880f8d34fb97d456b19ee64 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 4 Mar 2023 17:28:21 +1100 Subject: [PATCH 2/2] module path code from lld @@ -8,7 +8,7 @@ Subject: [PATCH 2/2] module path code from lld 1 file changed, 3 insertions(+) diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt -index b4d6862931..d5ecd104a0 100644 +index ece7589df21a..cae0b6760b8b 100644 --- a/bolt/CMakeLists.txt +++ b/bolt/CMakeLists.txt @@ -1,6 +1,9 @@ @@ -21,6 +21,3 @@ index b4d6862931..d5ecd104a0 100644 include(AddLLVM) include(ExternalProject) --- -2.38.1.windows.1 - From c6057946668418b47d323dcab727d8097ca667a2 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Wed, 10 Jul 2024 14:57:36 +1100 Subject: [PATCH 16/28] add stdlib --- recipes/bolt/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index 6f9ddac0d738e..e9acf897f4e99 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -16,6 +16,7 @@ build: requirements: build: + - {{ stdlib('c') }} - {{ compiler('c') }} - {{ compiler('cxx') }} - cmake From 53b59f68dcb783eb3fb3324dc49ca67f629633b4 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Wed, 24 Jul 2024 16:52:30 +1100 Subject: [PATCH 17/28] build bolt together with llvmdev --- recipes/bolt/bld.bat | 36 ++- recipes/bolt/build.sh | 64 +++++- recipes/bolt/conda_build_config.yaml | 4 - recipes/bolt/install_bolt.bat | 18 ++ recipes/bolt/install_bolt.sh | 19 ++ recipes/bolt/meta.yaml | 94 +++++++- ...hanges-to-make-bolt-build-standalone.patch | 21 -- ...-pass-through-QEMU_LD_PREFIX-SDKROOT.patch | 22 ++ ...strap-symbols-to-communicate-eh-fram.patch | 213 ++++++++++++++++++ .../0002-module-path-code-from-lld.patch | 23 -- 10 files changed, 445 insertions(+), 69 deletions(-) delete mode 100644 recipes/bolt/conda_build_config.yaml create mode 100644 recipes/bolt/install_bolt.bat create mode 100644 recipes/bolt/install_bolt.sh delete mode 100644 recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch create mode 100644 recipes/bolt/patches/0001-pass-through-QEMU_LD_PREFIX-SDKROOT.patch create mode 100644 recipes/bolt/patches/0002-ORC-Use-EPC-bootstrap-symbols-to-communicate-eh-fram.patch delete mode 100644 recipes/bolt/patches/0002-module-path-code-from-lld.patch diff --git a/recipes/bolt/bld.bat b/recipes/bolt/bld.bat index 044aae27c50fc..8da4b7dc50266 100644 --- a/recipes/bolt/bld.bat +++ b/recipes/bolt/bld.bat @@ -1,17 +1,43 @@ @echo on +:: until https://github.com/llvm/llvm-project/pull/97130 lands, +:: follow https://github.com/conda-forge/llvmdev-feedstock/blob/main/recipe/build.sh, +:: minus the tests and plus LLVM_ENABLE_PROJECTS="bolt" / LLVM_TARGETS_TO_BUILD=... + mkdir build cd build -set CC=cl.exe -set CXX=cl.exe +REM remove GL flag for now +set "CXXFLAGS=-MD" +set "CC=cl.exe" +set "CXX=cl.exe" cmake -G "Ninja" ^ -DCMAKE_BUILD_TYPE="Release" ^ - -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ - %SRC_DIR%/bolt + -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^ + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL ^ + -DLLVM_USE_INTEL_JITEVENTS=ON ^ + -DLLVM_ENABLE_DUMP=ON ^ + -DLLVM_ENABLE_LIBXML2=FORCE_ON ^ + -DLLVM_ENABLE_PROJECTS="bolt" ^ + -DLLVM_ENABLE_RTTI=ON ^ + -DLLVM_ENABLE_ZLIB=FORCE_ON ^ + -DLLVM_ENABLE_ZSTD=FORCE_ON ^ + -DLLVM_INCLUDE_BENCHMARKS=OFF ^ + -DLLVM_INCLUDE_DOCS=OFF ^ + -DLLVM_INCLUDE_EXAMPLES=OFF ^ + -DLLVM_INCLUDE_TESTS=ON ^ + -DLLVM_INCLUDE_UTILS=ON ^ + -DLLVM_INSTALL_UTILS=ON ^ + -DLLVM_TARGETS_TO_BUILD="X86;AArch64" ^ + -DLLVM_USE_SYMLINKS=OFF ^ + -DLLVM_UTILS_INSTALL_DIR=libexec\llvm ^ + -DLLVM_BUILD_LLVM_C_DYLIB=ON ^ + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly ^ + -DCMAKE_POLICY_DEFAULT_CMP0111=NEW ^ + %SRC_DIR%/llvm if %ERRORLEVEL% neq 0 exit 1 -cmake --build . --target install +cmake --build . if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipes/bolt/build.sh b/recipes/bolt/build.sh index 937f15ab52cd8..ca296b1293077 100644 --- a/recipes/bolt/build.sh +++ b/recipes/bolt/build.sh @@ -1,15 +1,69 @@ #!/bin/bash set -ex +# until https://github.com/llvm/llvm-project/pull/97130 lands, +# follow https://github.com/conda-forge/llvmdev-feedstock/blob/main/recipe/build.sh, +# minus the tests and plus LLVM_ENABLE_PROJECTS="bolt" / LLVM_TARGETS_TO_BUILD=... + +# Make osx work like linux. +sed -i.bak "s/NOT APPLE AND ARG_SONAME/ARG_SONAME/g" llvm/cmake/modules/AddLLVM.cmake +sed -i.bak "s/NOT APPLE AND NOT ARG_SONAME/NOT ARG_SONAME/g" llvm/cmake/modules/AddLLVM.cmake + mkdir build cd build +if [[ "$target_platform" == "linux-64" ]]; then + CMAKE_ARGS="${CMAKE_ARGS} -DLLVM_USE_INTEL_JITEVENTS=ON" +elif [[ "$target_platform" == osx-* ]]; then + # only supported on osx, see + # https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/llvm/tools/llvm-shlib/CMakeLists.txt#L82-L85 + # currently off though, because it doesn't build yet + # CMAKE_ARGS="${CMAKE_ARGS} -DLLVM_BUILD_LLVM_C_DYLIB=ON" + true +fi + +if [[ "$CC_FOR_BUILD" != "" && "$CC_FOR_BUILD" != "$CC" ]]; then + NATIVE_FLAGS="-DCMAKE_C_COMPILER=$CC_FOR_BUILD;-DCMAKE_CXX_COMPILER=$CXX_FOR_BUILD;-DCMAKE_C_FLAGS=-O2;-DCMAKE_CXX_FLAGS=-O2" + NATIVE_FLAGS="${NATIVE_FLAGS};-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,${BUILD_PREFIX}/lib;-DCMAKE_MODULE_LINKER_FLAGS=;-DCMAKE_SHARED_LINKER_FLAGS=" + NATIVE_FLAGS="${NATIVE_FLAGS};-DCMAKE_STATIC_LINKER_FLAGS=;-DLLVM_INCLUDE_BENCHMARKS=OFF" + NATIVE_FLAGS="${NATIVE_FLAGS};-DLLVM_ENABLE_ZSTD=OFF;-DLLVM_ENABLE_LIBXML2=OFF;-DLLVM_ENABLE_ZLIB=OFF;" + CMAKE_ARGS="${CMAKE_ARGS} -DCROSS_TOOLCHAIN_FLAGS_NATIVE=${NATIVE_FLAGS}" +fi + +# disable -fno-plt due to https://bugs.llvm.org/show_bug.cgi?id=51863 due to some GCC bug +if [[ "$target_platform" == "linux-ppc64le" ]]; then + CFLAGS="$(echo $CFLAGS | sed 's/-fno-plt //g')" + CXXFLAGS="$(echo $CXXFLAGS | sed 's/-fno-plt //g')" +fi + cmake -G Ninja \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=$PREFIX \ - -DCMAKE_PREFIX_PATH=$PREFIX \ + -DCMAKE_LIBRARY_PATH="${PREFIX}" \ + -DLLVM_ENABLE_BACKTRACES=ON \ + -DLLVM_ENABLE_DUMP=ON \ + -DLLVM_ENABLE_LIBEDIT=OFF \ + -DLLVM_ENABLE_LIBXML2=FORCE_ON \ + -DLLVM_ENABLE_PROJECTS="bolt" \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_ENABLE_ZLIB=FORCE_ON \ + -DLLVM_ENABLE_ZSTD=FORCE_ON \ + -DLLVM_DEFAULT_TARGET_TRIPLE=${CONDA_TOOLCHAIN_HOST} \ + -DLLVM_HOST_TRIPLE=${CONDA_TOOLCHAIN_HOST} \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLLVM_INCLUDE_DOCS=OFF \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_INCLUDE_GO_TESTS=OFF \ + -DLLVM_INCLUDE_TESTS=ON \ + -DLLVM_INCLUDE_UTILS=ON \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_TARGETS_TO_BUILD="X86;AArch64" \ + -DLLVM_UTILS_INSTALL_DIR=libexec/llvm \ + -DLLVM_BUILD_LLVM_DYLIB=yes \ + -DLLVM_LINK_LLVM_DYLIB=yes \ + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \ ${CMAKE_ARGS} \ - ../bolt + ../llvm -cmake --build . -cmake --install . +ninja -j${CPU_COUNT} diff --git a/recipes/bolt/conda_build_config.yaml b/recipes/bolt/conda_build_config.yaml deleted file mode 100644 index 9753cda4770bb..0000000000000 --- a/recipes/bolt/conda_build_config.yaml +++ /dev/null @@ -1,4 +0,0 @@ -c_compiler_version: # [osx] - - 16 # [osx] -cxx_compiler_version: # [osx] - - 16 # [osx] diff --git a/recipes/bolt/install_bolt.bat b/recipes/bolt/install_bolt.bat new file mode 100644 index 0000000000000..c2b58676fbe8a --- /dev/null +++ b/recipes/bolt/install_bolt.bat @@ -0,0 +1,18 @@ +@echo on + +:: temporary prefix to be able to install files more granularly +mkdir temp_prefix + +if "%PKG_NAME%" == "libbolt" ( + cmake --install ./build --prefix=./temp_prefix + if %ERRORLEVEL% neq 0 exit 1 + REM only bolt libraries + mkdir %LIBRARY_LIB% + move .\temp_prefix\lib\LLVMBOLT*.lib %LIBRARY_LIB% +) else ( + REM bolt: everything else + cmake --install .\build --prefix=%LIBRARY_PREFIX% + if %ERRORLEVEL% neq 0 exit 1 +) + +rmdir /s /q temp_prefix diff --git a/recipes/bolt/install_bolt.sh b/recipes/bolt/install_bolt.sh new file mode 100644 index 0000000000000..983e5824b3d34 --- /dev/null +++ b/recipes/bolt/install_bolt.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -ex + +# temporary prefix to be able to install files more granularly +mkdir temp_prefix + +if [[ "${PKG_NAME}" == "libbolt" ]]; then + cmake --install ./build --prefix=./temp_prefix + # only bolt libraries + mkdir -p $PREFIX/lib + mv ./temp_prefix/lib/libLLVMBOLT* $PREFIX/lib + # only on linux-64 + mv ./temp_prefix/lib/libbolt* $PREFIX/lib || true +else + # bolt: install everything else + cmake --install ./build --prefix=$PREFIX +fi + +rm -rf temp_prefix diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index e9acf897f4e99..a269a7e25e1d1 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -1,46 +1,118 @@ {% set version = "17.0.6" %} +{% set major_ver = version.split(".")[0] %} + +# as of LLVM 17, we expect an "rc" suffix for the release candidates +{% set extra = "rc" if version.split(".")[-1] not in "0123456789" else "" %} +{% set extra = "git" if version.split(".")[-1] == "dev0" else extra %} package: - name: llvm-bolt + name: bolt-split version: {{ version }} source: url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz sha256: 58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813 + # matching https://github.com/conda-forge/llvmdev-feedstock/tree/main/recipe/patches, + # since we rebuild llvmdev here (until https://github.com/llvm/llvm-project/pull/97130) patches: - - patches/0001-minimal-changes-to-make-bolt-build-standalone.patch - - patches/0002-module-path-code-from-lld.patch + - patches/0001-pass-through-QEMU_LD_PREFIX-SDKROOT.patch + # backports patch for issues with LLJIT, see + # https://github.com/llvm/llvm-project/commit/122ebe3b500190b1f408e2e6db753853e297ba28 + - patches/0002-ORC-Use-EPC-bootstrap-symbols-to-communicate-eh-fram.patch build: number: 0 + merge_build_host: false requirements: build: - {{ stdlib('c') }} - - {{ compiler('c') }} - {{ compiler('cxx') }} - cmake - ninja - - clangdev =={{ version }} # [build_platform != target_platform] - - llvmdev =={{ version }} # [build_platform != target_platform] + - libcxx {{ cxx_compiler_version }} # [osx] host: - - clangdev =={{ version }} - - llvmdev =={{ version }} + - libcxx {{ cxx_compiler_version }} # [osx] + # needs aarch/ppc/arm (re)build of conda-forge/backtrace-feedstock + - backtrace # [unix and x86] - libxml2 - zlib - zstd -test: - commands: - - llvm-bolt --version +outputs: + # Contains bolt support libraries + - name: libbolt + script: install_bolt.sh # [unix] + script: install_bolt.bat # [win] + build: + activate_in_script: true + requirements: + build: + - {{ stdlib('c') }} + - {{ compiler('cxx') }} + - cmake + - ninja + - libcxx {{ cxx_compiler_version }} # [osx] + run_constrained: + - llvm {{ version }} + - llvmdev {{ version }} + - clang {{ version }} + - clang-tools {{ version }} + test: + commands: + {% for each_lib in [ + "Core", "Passes", "Profile", "Rewrite", "RuntimeLibs", + "TargetAArch64", "TargetX86", "Utils" + ] %} + - test -f $PREFIX/lib/libLLVMBOLT{{ each_lib }}.a # [unix] + - if not exist %LIBRARY_LIB%\LLVMBOLT{{ each_lib }}.lib exit 1 # [win] + {% endfor %} + # only on linux-64 + - test -f $PREFIX/lib/libbolt_rt_hugify.a # [linux64] + - test -f $PREFIX/lib/libbolt_rt_instr.a # [linux64] + + # Contains bolt + - name: bolt + script: install_bolt.sh # [unix] + script: install_bolt.bat # [win] + build: + activate_in_script: true + requirements: + build: + - {{ stdlib('c') }} + - {{ compiler('cxx') }} + - cmake + - ninja + - libcxx {{ cxx_compiler_version }} # [osx] + host: + - libcxx {{ cxx_compiler_version }} # [osx] + # ensure we don't pick up stuff already packaged in llvmdev + - llvmdev {{ version }} + - zlib + - zstd + run: + - {{ pin_subpackage("libbolt", exact=True) }} + run_constrained: + - llvm {{ version }} + - llvmdev {{ version }} + - clang {{ version }} + - clang-tools {{ version }} + test: + commands: + - llvm-bolt -version + - llvm-boltdiff -version + - llvm-bolt-heatmap -version + - perf2bolt -version about: home: https://github.com/llvm/llvm-project/tree/main/bolt license: Apache-2.0 WITH LLVM-exception license_file: bolt/LICENSE.TXT + license_family: Apache summary: BOLT is a post-link optimizer developed to speed up large applications. dev_url: https://github.com/llvm/llvm-project/ extra: recipe-maintainers: - h-vetinari + feedstock-name: bolt diff --git a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch b/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch deleted file mode 100644 index f29b0b5ca3db8..0000000000000 --- a/recipes/bolt/patches/0001-minimal-changes-to-make-bolt-build-standalone.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 9a9498549c50b08746b4a1fc737a2ccf77f5a25e Mon Sep 17 00:00:00 2001 -From: "H. Vetinari" -Date: Sat, 4 Mar 2023 15:41:08 +1100 -Subject: [PATCH 1/2] minimal changes to make bolt build standalone - ---- - bolt/CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt -index 4ff90c1f7b3a..ece7589df21a 100644 ---- a/bolt/CMakeLists.txt -+++ b/bolt/CMakeLists.txt -@@ -1,3 +1,7 @@ -+cmake_minimum_required(VERSION 3.13.4) -+project(Bolt) -+ -+include(AddLLVM) - include(ExternalProject) - - set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/recipes/bolt/patches/0001-pass-through-QEMU_LD_PREFIX-SDKROOT.patch b/recipes/bolt/patches/0001-pass-through-QEMU_LD_PREFIX-SDKROOT.patch new file mode 100644 index 0000000000000..bb252a43f62e9 --- /dev/null +++ b/recipes/bolt/patches/0001-pass-through-QEMU_LD_PREFIX-SDKROOT.patch @@ -0,0 +1,22 @@ +From f2ee4893b93c254d97fd51fe6f6ee605934cf6a9 Mon Sep 17 00:00:00 2001 +From: Isuru Fernando +Date: Tue, 4 Aug 2020 21:06:30 -0500 +Subject: [PATCH 1/2] pass through QEMU_LD_PREFIX & SDKROOT + +--- + llvm/utils/lit/lit/TestingConfig.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py +index 76fd66502009..3009e921b621 100644 +--- a/llvm/utils/lit/lit/TestingConfig.py ++++ b/llvm/utils/lit/lit/TestingConfig.py +@@ -25,6 +25,8 @@ class TestingConfig(object): + "LD_LIBRARY_PATH", + "SYSTEMROOT", + "TERM", ++ "QEMU_LD_PREFIX", ++ "SDKROOT", + "CLANG", + "LLDB", + "LD_PRELOAD", diff --git a/recipes/bolt/patches/0002-ORC-Use-EPC-bootstrap-symbols-to-communicate-eh-fram.patch b/recipes/bolt/patches/0002-ORC-Use-EPC-bootstrap-symbols-to-communicate-eh-fram.patch new file mode 100644 index 0000000000000..01fdba895ee25 --- /dev/null +++ b/recipes/bolt/patches/0002-ORC-Use-EPC-bootstrap-symbols-to-communicate-eh-fram.patch @@ -0,0 +1,213 @@ +From 904fed311fae4922c1bcdc2d025fbabae5988fd2 Mon Sep 17 00:00:00 2001 +From: Lang Hames +Date: Wed, 23 Aug 2023 13:39:19 -0700 +Subject: [PATCH 2/2] [ORC] Use EPC bootstrap symbols to communicate eh-frame + registration fn addrs. + +By using bootstrap symbols to communicate these addresseses, rather than dlsym +lookups, we no longer need them to be exported from the main executable. On ELF, +where symbols aren't exported from the main executable by default, this +eliminates a common source of missing symbol errors and allows for smaller +executables (if exports from the main executable aren't otherwise needed and +can be removed). +--- + .../ExecutionEngine/Orc/EPCEHFrameRegistrar.h | 15 ++--- + .../Orc/EPCEHFrameRegistrar.cpp | 65 ++++++------------- + .../Orc/ExecutorProcessControl.cpp | 7 ++ + .../Orc/Shared/OrcRTBridge.cpp | 4 +- + .../TargetProcess/SimpleRemoteEPCServer.cpp | 6 ++ + 5 files changed, 41 insertions(+), 56 deletions(-) + +diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h +index 9772c84b682a..182e9ed1041a 100644 +--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h ++++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h +@@ -33,24 +33,23 @@ public: + /// find the registration functions. If it is None then the process dylib + /// will be loaded to find the registration functions. + static Expected> +- Create(ExecutionSession &ES, +- std::optional RegistrationFunctionsDylib = std::nullopt); ++ Create(ExecutionSession &ES); + + /// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl + /// object and registration/deregistration function addresses. + EPCEHFrameRegistrar(ExecutionSession &ES, +- ExecutorAddr RegisterEHFrameWrapperFnAddr, +- ExecutorAddr DeregisterEHFRameWrapperFnAddr) +- : ES(ES), RegisterEHFrameWrapperFnAddr(RegisterEHFrameWrapperFnAddr), +- DeregisterEHFrameWrapperFnAddr(DeregisterEHFRameWrapperFnAddr) {} ++ ExecutorAddr RegisterEHFrameSectionWrapper, ++ ExecutorAddr DeregisterEHFRameSectionWrapper) ++ : ES(ES), RegisterEHFrameSectionWrapper(RegisterEHFrameSectionWrapper), ++ DeregisterEHFrameSectionWrapper(DeregisterEHFRameSectionWrapper) {} + + Error registerEHFrames(ExecutorAddrRange EHFrameSection) override; + Error deregisterEHFrames(ExecutorAddrRange EHFrameSection) override; + + private: + ExecutionSession &ES; +- ExecutorAddr RegisterEHFrameWrapperFnAddr; +- ExecutorAddr DeregisterEHFrameWrapperFnAddr; ++ ExecutorAddr RegisterEHFrameSectionWrapper; ++ ExecutorAddr DeregisterEHFrameSectionWrapper; + }; + + } // end namespace orc +diff --git a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp +index 56cd982cd5e1..49af3f3d0124 100644 +--- a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp ++++ b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp +@@ -9,67 +9,40 @@ + #include "llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h" + + #include "llvm/ExecutionEngine/Orc/Core.h" +-#include "llvm/Support/BinaryStreamWriter.h" ++#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h" + + using namespace llvm::orc::shared; + + namespace llvm { + namespace orc { + +-Expected> EPCEHFrameRegistrar::Create( +- ExecutionSession &ES, +- std::optional RegistrationFunctionsDylib) { +- // FIXME: Proper mangling here -- we really need to decouple linker mangling +- // from DataLayout. +- +- // Find the addresses of the registration/deregistration functions in the +- // executor process. +- auto &EPC = ES.getExecutorProcessControl(); +- +- if (!RegistrationFunctionsDylib) { +- if (auto D = EPC.loadDylib(nullptr)) +- RegistrationFunctionsDylib = *D; +- else +- return D.takeError(); +- } +- +- std::string RegisterWrapperName, DeregisterWrapperName; +- if (EPC.getTargetTriple().isOSBinFormatMachO()) { +- RegisterWrapperName += '_'; +- DeregisterWrapperName += '_'; +- } +- RegisterWrapperName += "llvm_orc_registerEHFrameSectionWrapper"; +- DeregisterWrapperName += "llvm_orc_deregisterEHFrameSectionWrapper"; +- +- SymbolLookupSet RegistrationSymbols; +- RegistrationSymbols.add(EPC.intern(RegisterWrapperName)); +- RegistrationSymbols.add(EPC.intern(DeregisterWrapperName)); +- +- auto Result = +- EPC.lookupSymbols({{*RegistrationFunctionsDylib, RegistrationSymbols}}); +- if (!Result) +- return Result.takeError(); +- +- assert(Result->size() == 1 && "Unexpected number of dylibs in result"); +- assert((*Result)[0].size() == 2 && +- "Unexpected number of addresses in result"); +- +- auto RegisterEHFrameWrapperFnAddr = (*Result)[0][0]; +- auto DeregisterEHFrameWrapperFnAddr = (*Result)[0][1]; +- +- return std::make_unique(ES, RegisterEHFrameWrapperFnAddr, +- DeregisterEHFrameWrapperFnAddr); ++Expected> ++EPCEHFrameRegistrar::Create(ExecutionSession &ES) { ++ ++ // Lookup addresseses of the registration/deregistration functions in the ++ // bootstrap map. ++ ExecutorAddr RegisterEHFrameSectionWrapper; ++ ExecutorAddr DeregisterEHFrameSectionWrapper; ++ if (auto Err = ES.getExecutorProcessControl().getBootstrapSymbols( ++ {{RegisterEHFrameSectionWrapper, ++ rt::RegisterEHFrameSectionWrapperName}, ++ {DeregisterEHFrameSectionWrapper, ++ rt::DeregisterEHFrameSectionWrapperName}})) ++ return Err; ++ ++ return std::make_unique( ++ ES, RegisterEHFrameSectionWrapper, DeregisterEHFrameSectionWrapper); + } + + Error EPCEHFrameRegistrar::registerEHFrames(ExecutorAddrRange EHFrameSection) { + return ES.callSPSWrapper( +- RegisterEHFrameWrapperFnAddr, EHFrameSection); ++ RegisterEHFrameSectionWrapper, EHFrameSection); + } + + Error EPCEHFrameRegistrar::deregisterEHFrames( + ExecutorAddrRange EHFrameSection) { + return ES.callSPSWrapper( +- DeregisterEHFrameWrapperFnAddr, EHFrameSection); ++ DeregisterEHFrameSectionWrapper, EHFrameSection); + } + + } // end namespace orc +diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp +index b8b013f8a7a9..fc928f2e6146 100644 +--- a/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp ++++ b/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp +@@ -9,6 +9,8 @@ + #include "llvm/ExecutionEngine/Orc/ExecutorProcessControl.h" + + #include "llvm/ExecutionEngine/Orc/Core.h" ++#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h" ++#include "llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h" + #include "llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h" + #include "llvm/Support/FormatVariadic.h" + #include "llvm/Support/Process.h" +@@ -42,6 +44,11 @@ SelfExecutorProcessControl::SelfExecutorProcessControl( + ExecutorAddr::fromPtr(this)}; + if (this->TargetTriple.isOSBinFormatMachO()) + GlobalManglingPrefix = '_'; ++ ++ this->BootstrapSymbols[rt::RegisterEHFrameSectionWrapperName] = ++ ExecutorAddr::fromPtr(&llvm_orc_registerEHFrameSectionWrapper); ++ this->BootstrapSymbols[rt::DeregisterEHFrameSectionWrapperName] = ++ ExecutorAddr::fromPtr(&llvm_orc_deregisterEHFrameSectionWrapper); + } + + Expected> +diff --git a/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp b/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp +index 86e31c52100e..ae39b1d1bfaa 100644 +--- a/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp ++++ b/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp +@@ -51,9 +51,9 @@ const char *MemoryWriteBuffersWrapperName = + "__llvm_orc_bootstrap_mem_write_buffers_wrapper"; + + const char *RegisterEHFrameSectionWrapperName = +- "__llvm_orc_bootstrap_register_ehframe_section_wrapper"; ++ "llvm_orc_registerEHFrameSectionWrapper"; + const char *DeregisterEHFrameSectionWrapperName = +- "__llvm_orc_bootstrap_deregister_ehframe_section_wrapper"; ++ "llvm_orc_deregisterEHFrameSectionWrapper"; + + const char *RunAsMainWrapperName = "__llvm_orc_bootstrap_run_as_main_wrapper"; + const char *RunAsVoidFunctionWrapperName = +diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp +index 67bc379f9821..a585767bf474 100644 +--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp ++++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp +@@ -8,7 +8,9 @@ + + #include "llvm/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.h" + ++#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h" + #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h" ++#include "llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h" + #include "llvm/Support/FormatVariadic.h" + #include "llvm/Support/Process.h" + #include "llvm/TargetParser/Host.h" +@@ -206,6 +208,10 @@ Error SimpleRemoteEPCServer::sendSetupMessage( + "Dispatch function name should not be set"); + EI.BootstrapSymbols[ExecutorSessionObjectName] = ExecutorAddr::fromPtr(this); + EI.BootstrapSymbols[DispatchFnName] = ExecutorAddr::fromPtr(jitDispatchEntry); ++ EI.BootstrapSymbols[rt::RegisterEHFrameSectionWrapperName] = ++ ExecutorAddr::fromPtr(&llvm_orc_registerEHFrameSectionWrapper); ++ EI.BootstrapSymbols[rt::DeregisterEHFrameSectionWrapperName] = ++ ExecutorAddr::fromPtr(&llvm_orc_deregisterEHFrameSectionWrapper); + + using SPSSerialize = + shared::SPSArgList; diff --git a/recipes/bolt/patches/0002-module-path-code-from-lld.patch b/recipes/bolt/patches/0002-module-path-code-from-lld.patch deleted file mode 100644 index 83d66f7908d9b..0000000000000 --- a/recipes/bolt/patches/0002-module-path-code-from-lld.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 03e49260a6bb072fd880f8d34fb97d456b19ee64 Mon Sep 17 00:00:00 2001 -From: "H. Vetinari" -Date: Sat, 4 Mar 2023 17:28:21 +1100 -Subject: [PATCH 2/2] module path code from lld - ---- - bolt/CMakeLists.txt | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt -index ece7589df21a..cae0b6760b8b 100644 ---- a/bolt/CMakeLists.txt -+++ b/bolt/CMakeLists.txt -@@ -1,6 +1,9 @@ - cmake_minimum_required(VERSION 3.13.4) - project(Bolt) - -+find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}") -+list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}") -+ - include(AddLLVM) - include(ExternalProject) - From cb2f1c4f32f32690e675c5a65c8ff9b75e4ab452 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Wed, 24 Jul 2024 19:41:59 +1100 Subject: [PATCH 18/28] fix clobber --- recipes/bolt/meta.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index a269a7e25e1d1..c4c6268817e08 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -86,8 +86,9 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - # ensure we don't pick up stuff already packaged in llvmdev + # ensure we don't pick up stuff already packaged in llvmdev/libbolt - llvmdev {{ version }} + - {{ pin_subpackage("libbolt", exact=True) }} - zlib - zstd run: From f8d02349bbb35bb6de44a648bf7d34128e6817d0 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 25 Jul 2024 08:05:36 +1100 Subject: [PATCH 19/28] -devel --- recipes/bolt/meta.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index c4c6268817e08..4f3e1f277ed3f 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -41,7 +41,7 @@ requirements: outputs: # Contains bolt support libraries - - name: libbolt + - name: libbolt-devel script: install_bolt.sh # [unix] script: install_bolt.bat # [win] build: @@ -86,13 +86,13 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - # ensure we don't pick up stuff already packaged in llvmdev/libbolt + # ensure we don't pick up stuff already packaged in llvmdev/libbolt-devel - llvmdev {{ version }} - - {{ pin_subpackage("libbolt", exact=True) }} + - {{ pin_subpackage("libbolt-devel", exact=True) }} - zlib - zstd run: - - {{ pin_subpackage("libbolt", exact=True) }} + - {{ pin_subpackage("libbolt-devel", exact=True) }} run_constrained: - llvm {{ version }} - llvmdev {{ version }} From 0e969618dca76f8d5655347cf552e1642133a05f Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 25 Jul 2024 08:15:39 +1100 Subject: [PATCH 20/28] package CMake metadata for libbolt-devel --- recipes/bolt/meta.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index 4f3e1f277ed3f..c884de3939e92 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -46,6 +46,15 @@ outputs: script: install_bolt.bat # [win] build: activate_in_script: true + always_include_files: + # Must overwrite CMake targets from llvmdev + {% set prefix = "Library/" if win else "" %} + - {{ prefix }}lib/cmake/llvm/LLVM-Config.cmake + - {{ prefix }}lib/cmake/llvm/LLVMConfig.cmake + - {{ prefix }}lib/cmake/llvm/LLVMConfigVersion.cmake + - {{ prefix }}lib/cmake/llvm/LLVMExports-release.cmake + - {{ prefix }}lib/cmake/llvm/LLVMExports.cmake + requirements: build: - {{ stdlib('c') }} @@ -71,6 +80,15 @@ outputs: - test -f $PREFIX/lib/libbolt_rt_hugify.a # [linux64] - test -f $PREFIX/lib/libbolt_rt_instr.a # [linux64] + {% for each_file in [ + "-Config", "Config", "ConfigVersion", + "LLVMExports-release", "LLVMExports" + ] %} + # CMake metadata + - test -f $PREFIX/lib/cmake/llvm/LLVM{{ each_file }}.cmake # [unix] + - if not exist %LIBRARY_LIB%/cmake/llvm/LLVM{{ each_file }}.cmake exit 1 # [win] + {% endfor %} + # Contains bolt - name: bolt script: install_bolt.sh # [unix] From 11472ee1d268792a27d7f1498a4b831ef43acd3e Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 25 Jul 2024 08:16:12 +1100 Subject: [PATCH 21/28] add test for overlooked binary --- recipes/bolt/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index c884de3939e92..8e7d0d2ad21c2 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -121,6 +121,7 @@ outputs: - llvm-bolt -version - llvm-boltdiff -version - llvm-bolt-heatmap -version + - merge-fdata -version - perf2bolt -version about: From eebba24892cf5d301a20f55c9eb4bb9a74305aa4 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 25 Jul 2024 10:44:53 +1100 Subject: [PATCH 22/28] more -devel --- recipes/bolt/install_bolt.bat | 2 +- recipes/bolt/install_bolt.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/bolt/install_bolt.bat b/recipes/bolt/install_bolt.bat index c2b58676fbe8a..ee1bbf012bfcb 100644 --- a/recipes/bolt/install_bolt.bat +++ b/recipes/bolt/install_bolt.bat @@ -3,7 +3,7 @@ :: temporary prefix to be able to install files more granularly mkdir temp_prefix -if "%PKG_NAME%" == "libbolt" ( +if "%PKG_NAME%" == "libbolt-devel" ( cmake --install ./build --prefix=./temp_prefix if %ERRORLEVEL% neq 0 exit 1 REM only bolt libraries diff --git a/recipes/bolt/install_bolt.sh b/recipes/bolt/install_bolt.sh index 983e5824b3d34..c0d7dba10fad2 100644 --- a/recipes/bolt/install_bolt.sh +++ b/recipes/bolt/install_bolt.sh @@ -4,7 +4,7 @@ set -ex # temporary prefix to be able to install files more granularly mkdir temp_prefix -if [[ "${PKG_NAME}" == "libbolt" ]]; then +if [[ "${PKG_NAME}" == "libbolt-devel" ]]; then cmake --install ./build --prefix=./temp_prefix # only bolt libraries mkdir -p $PREFIX/lib From 99ba39ab75af67859831907f9370faf8a3ccd1c5 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 25 Jul 2024 13:16:25 +1100 Subject: [PATCH 23/28] copy CMake metadata --- recipes/bolt/install_bolt.bat | 4 +++- recipes/bolt/install_bolt.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes/bolt/install_bolt.bat b/recipes/bolt/install_bolt.bat index ee1bbf012bfcb..df59c2e36c0e5 100644 --- a/recipes/bolt/install_bolt.bat +++ b/recipes/bolt/install_bolt.bat @@ -7,8 +7,10 @@ if "%PKG_NAME%" == "libbolt-devel" ( cmake --install ./build --prefix=./temp_prefix if %ERRORLEVEL% neq 0 exit 1 REM only bolt libraries - mkdir %LIBRARY_LIB% + mkdir %LIBRARY_LIB%\cmake\llvm move .\temp_prefix\lib\LLVMBOLT*.lib %LIBRARY_LIB% + REM copy CMake metadata + move .\temp_prefix\lib\cmake\llvm %LIBRARY_LIB%\cmake\llvm ) else ( REM bolt: everything else cmake --install .\build --prefix=%LIBRARY_PREFIX% diff --git a/recipes/bolt/install_bolt.sh b/recipes/bolt/install_bolt.sh index c0d7dba10fad2..3cf1730a841f8 100644 --- a/recipes/bolt/install_bolt.sh +++ b/recipes/bolt/install_bolt.sh @@ -7,10 +7,12 @@ mkdir temp_prefix if [[ "${PKG_NAME}" == "libbolt-devel" ]]; then cmake --install ./build --prefix=./temp_prefix # only bolt libraries - mkdir -p $PREFIX/lib + mkdir -p $PREFIX/lib/cmake/llvm mv ./temp_prefix/lib/libLLVMBOLT* $PREFIX/lib # only on linux-64 mv ./temp_prefix/lib/libbolt* $PREFIX/lib || true + # copy CMake metadata + mv ./temp_prefix/lib/cmake/llvm $PREFIX/lib/cmake/llvm else # bolt: install everything else cmake --install ./build --prefix=$PREFIX From 6bb8bdc8d88d76138b07fdbd4bc42a09d718318b Mon Sep 17 00:00:00 2001 From: h-vetinari Date: Thu, 25 Jul 2024 08:54:43 +0200 Subject: [PATCH 24/28] Properly copy into existing folder Co-authored-by: Marcel Bargull --- recipes/bolt/install_bolt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/bolt/install_bolt.sh b/recipes/bolt/install_bolt.sh index 3cf1730a841f8..00a2231749014 100644 --- a/recipes/bolt/install_bolt.sh +++ b/recipes/bolt/install_bolt.sh @@ -11,8 +11,8 @@ if [[ "${PKG_NAME}" == "libbolt-devel" ]]; then mv ./temp_prefix/lib/libLLVMBOLT* $PREFIX/lib # only on linux-64 mv ./temp_prefix/lib/libbolt* $PREFIX/lib || true - # copy CMake metadata - mv ./temp_prefix/lib/cmake/llvm $PREFIX/lib/cmake/llvm + # move CMake metadata + mv ./temp_prefix/lib/cmake/llvm/* $PREFIX/lib/cmake/llvm/ else # bolt: install everything else cmake --install ./build --prefix=$PREFIX From a54de913261276afffc77fca7f1c6e6c217a6212 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 25 Jul 2024 20:11:15 +1100 Subject: [PATCH 25/28] remove superfluous prefix --- recipes/bolt/meta.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index 8e7d0d2ad21c2..c679b288b9bdf 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -81,8 +81,7 @@ outputs: - test -f $PREFIX/lib/libbolt_rt_instr.a # [linux64] {% for each_file in [ - "-Config", "Config", "ConfigVersion", - "LLVMExports-release", "LLVMExports" + "-Config", "Config", "ConfigVersion", "Exports", "Exports-release" ] %} # CMake metadata - test -f $PREFIX/lib/cmake/llvm/LLVM{{ each_file }}.cmake # [unix] From bd1a6f19577f369eff109750e11fd48d863c5c59 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 27 Jul 2024 09:36:18 +1100 Subject: [PATCH 26/28] make libbolt-devel depend on llvmdev --- recipes/bolt/meta.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recipes/bolt/meta.yaml b/recipes/bolt/meta.yaml index c679b288b9bdf..bb7b32eea7e22 100644 --- a/recipes/bolt/meta.yaml +++ b/recipes/bolt/meta.yaml @@ -62,6 +62,12 @@ outputs: - cmake - ninja - libcxx {{ cxx_compiler_version }} # [osx] + host: + # ensure we don't pick up stuff already packaged in llvmdev + - llvmdev {{ version }} + run: + # necessary due to shared CMake metadata + - llvmdev {{ version }} run_constrained: - llvm {{ version }} - llvmdev {{ version }} From 004cdc9409acdfe614a1c78582208c1ab564b1a4 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 27 Jul 2024 10:04:48 +1100 Subject: [PATCH 27/28] remove extra target; build with MSVC on windows --- recipes/bolt/bld.bat | 8 +------- recipes/bolt/build.sh | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/recipes/bolt/bld.bat b/recipes/bolt/bld.bat index 8da4b7dc50266..7890fc8e91a64 100644 --- a/recipes/bolt/bld.bat +++ b/recipes/bolt/bld.bat @@ -2,16 +2,11 @@ :: until https://github.com/llvm/llvm-project/pull/97130 lands, :: follow https://github.com/conda-forge/llvmdev-feedstock/blob/main/recipe/build.sh, -:: minus the tests and plus LLVM_ENABLE_PROJECTS="bolt" / LLVM_TARGETS_TO_BUILD=... +:: with a reduced set of targets, no tests, plus LLVM_ENABLE_PROJECTS="bolt" mkdir build cd build -REM remove GL flag for now -set "CXXFLAGS=-MD" -set "CC=cl.exe" -set "CXX=cl.exe" - cmake -G "Ninja" ^ -DCMAKE_BUILD_TYPE="Release" ^ -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ @@ -34,7 +29,6 @@ cmake -G "Ninja" ^ -DLLVM_USE_SYMLINKS=OFF ^ -DLLVM_UTILS_INSTALL_DIR=libexec\llvm ^ -DLLVM_BUILD_LLVM_C_DYLIB=ON ^ - -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly ^ -DCMAKE_POLICY_DEFAULT_CMP0111=NEW ^ %SRC_DIR%/llvm if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipes/bolt/build.sh b/recipes/bolt/build.sh index ca296b1293077..fe044ee92da83 100644 --- a/recipes/bolt/build.sh +++ b/recipes/bolt/build.sh @@ -3,7 +3,7 @@ set -ex # until https://github.com/llvm/llvm-project/pull/97130 lands, # follow https://github.com/conda-forge/llvmdev-feedstock/blob/main/recipe/build.sh, -# minus the tests and plus LLVM_ENABLE_PROJECTS="bolt" / LLVM_TARGETS_TO_BUILD=... +# with a reduced set of targets, no tests, plus LLVM_ENABLE_PROJECTS="bolt" # Make osx work like linux. sed -i.bak "s/NOT APPLE AND ARG_SONAME/ARG_SONAME/g" llvm/cmake/modules/AddLLVM.cmake @@ -62,7 +62,6 @@ cmake -G Ninja \ -DLLVM_UTILS_INSTALL_DIR=libexec/llvm \ -DLLVM_BUILD_LLVM_DYLIB=yes \ -DLLVM_LINK_LLVM_DYLIB=yes \ - -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \ ${CMAKE_ARGS} \ ../llvm From 4f17e53d55ef07dbeefdeb356a53aa10cc86639e Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 27 Jul 2024 10:07:16 +1100 Subject: [PATCH 28/28] install bolt includes, if any exist --- recipes/bolt/install_bolt.bat | 3 ++- recipes/bolt/install_bolt.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/bolt/install_bolt.bat b/recipes/bolt/install_bolt.bat index df59c2e36c0e5..59660f5f6783e 100644 --- a/recipes/bolt/install_bolt.bat +++ b/recipes/bolt/install_bolt.bat @@ -7,10 +7,11 @@ if "%PKG_NAME%" == "libbolt-devel" ( cmake --install ./build --prefix=./temp_prefix if %ERRORLEVEL% neq 0 exit 1 REM only bolt libraries - mkdir %LIBRARY_LIB%\cmake\llvm move .\temp_prefix\lib\LLVMBOLT*.lib %LIBRARY_LIB% REM copy CMake metadata move .\temp_prefix\lib\cmake\llvm %LIBRARY_LIB%\cmake\llvm + REM unclear which headers belong to bolt, but if some are there, install + move .\temp_prefix\include %LIBRARY_INC% ) else ( REM bolt: everything else cmake --install .\build --prefix=%LIBRARY_PREFIX% diff --git a/recipes/bolt/install_bolt.sh b/recipes/bolt/install_bolt.sh index 00a2231749014..d8fbabea110c5 100644 --- a/recipes/bolt/install_bolt.sh +++ b/recipes/bolt/install_bolt.sh @@ -6,13 +6,13 @@ mkdir temp_prefix if [[ "${PKG_NAME}" == "libbolt-devel" ]]; then cmake --install ./build --prefix=./temp_prefix - # only bolt libraries - mkdir -p $PREFIX/lib/cmake/llvm mv ./temp_prefix/lib/libLLVMBOLT* $PREFIX/lib # only on linux-64 mv ./temp_prefix/lib/libbolt* $PREFIX/lib || true # move CMake metadata mv ./temp_prefix/lib/cmake/llvm/* $PREFIX/lib/cmake/llvm/ + # unclear which headers belong to bolt, but if some are there, install + mv ./temp_prefix/include/* $PREFIX/include/ else # bolt: install everything else cmake --install ./build --prefix=$PREFIX