Change:
This project should be part of the , but it's missing. BOLT is a post-link optimizer developed to speed up large applications. It achieves the improvements by optimizing application's code layout based on execution profile gathered by sampling profiler, such as Linux perf tool. An overview of the ideas implemented in BOLT along with a discussion of its potential and current results is available in . Metadata homepage URL: source URL: license: Apache License v2.0 with LLVM Exceptions platforms: unix, linux, darwin.
OK I managed to build this on NixOS, but with tons of patches. I think the upstream bolt is not ready for separate compilation yet, so I need to copy a bunch of stuff from elsewhere, but here is the build: the patch: <details</detailsThe patch is really ugly and there are some things that are specific to NixOS (I integrated the in other llvm packages). Not sure if we want to try to get the changes upstreamed before opening a PR. The build is successful, but I haven't yet tested it. Patching this is quite painful and consumed me 4 hours already...
it seems that it works directly without the need for wrapping.
The upstream patch which makes packaging bolt possible in Nix has been merged. We'll have things here merged in not too long from now.

Discussion:
<ins> { lib, stdenv, llvm_meta, monorepoSrc, runCommand, cmake, libxml2, libllvm, libclang, version, python3, buildLlvmTools, patches ? [ ], }: stdenv.mkDerivation (finalAttrs: { pname = "bolt"; inherit version patches; # Blank llvm dir just so relative path works src = runCommand "bolt-src-${finalAttrs.version}" { } '' mkdir $out cp -r ${monorepoSrc}/cmake "$out" cp -r ${monorepoSrc}/${finalAttrs.pname} "$out" cp -r ${monorepoSrc}/third-party "$out" # tablegen stuff, probably not the best way but it works... cp -r ${monorepoSrc}/llvm/ "$out" chmod -R +w $out/llvm ''; sourceRoot = "${finalAttrs.src.name}/bolt"; nativeBuildInputs = [ cmake python3 ]; buildInputs = [ libllvm libclang libxml2 ]; cmakeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ (lib.cmakeFeature "LLVM_TABLEGEN_EXE" "${buildLlvmTools.llvm}/bin/llvm-tblgen") ]; postUnpack = '' chmod -R u+w -- $sourceRoot/.. ''; prePatch = '' cd .. ''; postPatch = '' cd bolt ''; postInstall = '' mkdir -p $dev/lib mv $out/lib/libLLVMBOLT*.a $dev/lib ''; outputs = [ "out" "dev" ]; meta = llvm_meta // { homepage = "https://github.com/llvm/llvm-project/tree/main/bolt"; description = "LLVM post-link optimizer."; }; }) </ins>

mlir = callPackage ./mlir { }; libclc = callPackage ./libclc.nix { }; } <ins> // lib.optionalAttrs (lib.versionAtLeast metadata.release_version "19") { bolt = callPackage ./bolt { patches = lib.optionals (lib.versions.major metadata.release_version == "19") [ (fetchpatch { url = "https://github.com/llvm/llvm-project/commit/abc2eae68290c453e1899a94eccc4ed5ea3b69c1.patch"; hash = "sha256-oxCxOjhi5BhNBEraWalEwa1rS3Mx9CuQgRVZ2hrbd7M="; }) ]; }; } </ins> ); libraries = lib.makeExtensible (

lld_19 = llvmPackages_19.lld; lldb_19 = llvmPackages_19.lldb; llvm_19 = llvmPackages_19.llvm; <ins> bolt_19 = llvmPackages_19.bolt; </ins> llvmPackages_git = llvmPackagesSet.git; }) llvmPackages_13

lld_19 lldb_19 llvm_19 <ins> bolt_19 </ins> llvmPackages_git; lorri = callPackage ../tools/misc/lorri {