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..6d25e856b37a1 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) -