From 0daa24192cb4a4f4499d92f3585aa7845e30c3fc Mon Sep 17 00:00:00 2001 From: SomeoneSerge Date: Wed, 16 Oct 2024 14:05:08 +0000 Subject: [PATCH] triton-llvm: patch for glibc 2.40 support --- pkgs/by-name/tr/triton-llvm/package.nix | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/tr/triton-llvm/package.nix b/pkgs/by-name/tr/triton-llvm/package.nix index f7e12ba32c11..829f0c912afd 100644 --- a/pkgs/by-name/tr/triton-llvm/package.nix +++ b/pkgs/by-name/tr/triton-llvm/package.nix @@ -1,6 +1,7 @@ { lib , stdenv , fetchFromGitHub +, fetchpatch , pkgsBuildBuild , pkg-config , cmake @@ -64,6 +65,15 @@ in stdenv.mkDerivation (finalAttrs: { rev = "10dc3a8e916d73291269e5e2b82dd22681489aa1"; hash = "sha256-9DPvcFmhzw6MipQeCQnr35LktW0uxtEL8axMMPXIfWw="; }; + patches = [ + # glibc-2.40 support + # [llvm-exegesis] Use correct rseq struct size #100804 + # https://github.com/llvm/llvm-project/issues/100791 + (fetchpatch { + url = "https://github.com/llvm/llvm-project//commit/84837e3cc1cf17ed71580e3ea38299ed2bfaa5f6.patch"; + hash = "sha256-QKa+kyXjjGXwTQTEpmKZx5yYjOyBX8A8NQoIYUaGcIw="; + }) + ]; nativeBuildInputs = [ pkg-config @@ -92,7 +102,9 @@ in stdenv.mkDerivation (finalAttrs: { ncurses ]; - sourceRoot = "${finalAttrs.src.name}/llvm"; + preConfigure = '' + cd llvm + ''; cmakeFlags = [ (lib.cmakeFeature "LLVM_TARGETS_TO_BUILD" (lib.concatStringsSep ";" llvmTargetsToBuild')) @@ -142,18 +154,18 @@ in stdenv.mkDerivation (finalAttrs: { postPatch = '' # `CMake Error: cannot write to file "/build/source/llvm/build/lib/cmake/mlir/MLIRTargets.cmake": Permission denied` - chmod +w -R ../mlir - patchShebangs ../mlir/test/mlir-reduce + chmod +w -R ./mlir + patchShebangs ./mlir/test/mlir-reduce # FileSystem permissions tests fail with various special bits - rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test - rm unittests/Support/Path.cpp + rm llvm/test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test + rm llvm/unittests/Support/Path.cpp - substituteInPlace unittests/Support/CMakeLists.txt \ + substituteInPlace llvm/unittests/Support/CMakeLists.txt \ --replace "Path.cpp" "" '' + lib.optionalString stdenv.hostPlatform.isAarch64 '' # Not sure why this fails - rm test/tools/llvm-exegesis/AArch64/latency-by-opcode-name.s + rm llvm/test/tools/llvm-exegesis/AArch64/latency-by-opcode-name.s ''; postInstall = ''