diff --git a/pkgs/development/compilers/llvm/18/mlir/mlir-add-include-cstdint.patch b/pkgs/development/compilers/llvm/18/mlir/mlir-add-include-cstdint.patch new file mode 100644 index 000000000000..181d53c54184 --- /dev/null +++ b/pkgs/development/compilers/llvm/18/mlir/mlir-add-include-cstdint.patch @@ -0,0 +1,28 @@ +Rebase of 2 upstream commits: +https://github.com/llvm/llvm-project/commit/41eb186fbb024898bacc2577fa3b88db0510ba1f +https://github.com/llvm/llvm-project/commit/101109fc5460d5bb9bb597c6ec77f998093a6687 + +diff --git a/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h b/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h +index 451c466fa0c95..642e99d963ef6 100644 +--- a/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h ++++ b/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h +@@ -10,6 +10,7 @@ + #define MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H + + #include "mlir/Support/LogicalResult.h" ++#include + + namespace mlir { + class DialectRegistry; +diff --git a/include/mlir/Target/SPIRV/Deserialization.h b/include/mlir/Target/SPIRV/Deserialization.h +index e39258beeaac8..a346a7fd1e5f7 100644 +--- a/include/mlir/Target/SPIRV/Deserialization.h ++++ b/include/mlir/Target/SPIRV/Deserialization.h +@@ -15,6 +15,7 @@ + + #include "mlir/IR/OwningOpRef.h" + #include "mlir/Support/LLVM.h" ++#include + + namespace mlir { + class MLIRContext; diff --git a/pkgs/development/compilers/llvm/19/mlir/mlir-add-include-cstdint.patch b/pkgs/development/compilers/llvm/19/mlir/mlir-add-include-cstdint.patch new file mode 100644 index 000000000000..3e1ff09bc3ef --- /dev/null +++ b/pkgs/development/compilers/llvm/19/mlir/mlir-add-include-cstdint.patch @@ -0,0 +1,29 @@ +Rebase of 2 upstream commits: +https://github.com/llvm/llvm-project/commit/41eb186fbb024898bacc2577fa3b88db0510ba1f +https://github.com/llvm/llvm-project/commit/101109fc5460d5bb9bb597c6ec77f998093a6687 + +diff --git a/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h b/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h +index 451c466fa0c95..642e99d963ef6 100644 +--- a/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h ++++ b/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h +@@ -10,6 +10,7 @@ + #define MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H + + #include "mlir/Support/LLVM.h" ++#include + + namespace mlir { + class DialectRegistry; +diff --git a/include/mlir/Target/SPIRV/Deserialization.h b/include/mlir/Target/SPIRV/Deserialization.h +index e39258beeaac8..a346a7fd1e5f7 100644 +--- a/include/mlir/Target/SPIRV/Deserialization.h ++++ b/include/mlir/Target/SPIRV/Deserialization.h +@@ -15,6 +15,7 @@ + + #include "mlir/IR/OwningOpRef.h" + #include "mlir/Support/LLVM.h" ++#include + + namespace mlir { + class MLIRContext; + diff --git a/pkgs/development/compilers/llvm/common/mlir/default.nix b/pkgs/development/compilers/llvm/common/mlir/default.nix index ec4944c34aaf..c68f6a9b0b68 100644 --- a/pkgs/development/compilers/llvm/common/mlir/default.nix +++ b/pkgs/development/compilers/llvm/common/mlir/default.nix @@ -12,6 +12,7 @@ libllvm, version, devExtraCmakeFlags ? [ ], + getVersionFile, }: stdenv.mkDerivation (finalAttrs: { @@ -38,6 +39,12 @@ stdenv.mkDerivation (finalAttrs: { patches = [ ./gnu-install-dirs.patch + ] + ++ lib.optional (lib.versionOlder release_version "20") [ + # Fix build with gcc15 + # https://github.com/llvm/llvm-project/commit/41eb186fbb024898bacc2577fa3b88db0510ba1f + # https://github.com/llvm/llvm-project/commit/101109fc5460d5bb9bb597c6ec77f998093a6687 + (getVersionFile "mlir/mlir-add-include-cstdint.patch") ]; nativeBuildInputs = [ diff --git a/pkgs/development/compilers/llvm/common/patches.nix b/pkgs/development/compilers/llvm/common/patches.nix index b97f8af6eae2..d8cd207f70f1 100644 --- a/pkgs/development/compilers/llvm/common/patches.nix +++ b/pkgs/development/compilers/llvm/common/patches.nix @@ -116,4 +116,16 @@ path = ../21; } ]; + "mlir/mlir-add-include-cstdint.patch" = [ + { + after = "18"; + before = "19"; + path = ../18; + } + { + after = "19"; + before = "20"; + path = ../19; + } + ]; }