Merge master into haskell-updates

This commit is contained in:
github-actions[bot]
2024-02-23 00:12:05 +00:00
committed by GitHub
239 changed files with 10652 additions and 3211 deletions

View File

@@ -144,6 +144,10 @@ in let
inherit llvm_meta;
};
mlir = callPackage ./mlir {
inherit llvm_meta;
};
lldb = callPackage ../common/lldb.nix {
src = callPackage ({ runCommand }: runCommand "lldb-src-${version}" {} ''
mkdir -p "$out"

View File

@@ -0,0 +1,71 @@
{ lib, stdenv, llvm_meta
, buildLlvmTools
, monorepoSrc, runCommand
, cmake
, ninja
, libxml2
, libllvm
, version
, doCheck ? (!stdenv.isx86_32 /* TODO: why */) && (!stdenv.hostPlatform.isMusl)
}:
stdenv.mkDerivation rec {
pname = "mlir";
inherit version doCheck;
# Blank llvm dir just so relative path works
src = runCommand "${pname}-src-${version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/${pname} "$out"
cp -r ${monorepoSrc}/third-party "$out/third-party"
mkdir -p "$out/llvm"
'';
sourceRoot = "${src.name}/${pname}";
patches = [
./gnu-install-dirs.patch
];
nativeBuildInputs = [ cmake ninja ];
buildInputs = [ libllvm libxml2 ];
ninjaFlags = [ "-v " ];
cmakeFlags = [
"-DLLVM_BUILD_TOOLS=ON"
# Install headers as well
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=OFF"
"-DMLIR_TOOLS_INSTALL_DIR=${placeholder "out"}/bin/"
"-DLLVM_ENABLE_IDE=OFF"
"-DLLD_INSTALL_PACKAGE_DIR=${placeholder "out"}/lib/cmake/mlir"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ lib.optionals stdenv.hostPlatform.isStatic [
# Disables building of shared libs, -fPIC is still injected by cc-wrapper
"-DLLVM_ENABLE_PIC=OFF"
"-DLLVM_BUILD_STATIC=ON"
"-DLLVM_LINK_LLVM_DYLIB=off"
] ++ lib.optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
"-DMLIR_TABLEGEN_EXE=${buildLlvmTools.mlir}/bin/mlir-tblgen"
];
outputs = [ "out" "dev" ];
meta = llvm_meta // {
homepage = "https://mlir.llvm.org/";
description = "Multi-Level IR Compiler Framework";
longDescription = ''
The MLIR project is a novel approach to building reusable and extensible
compiler infrastructure. MLIR aims to address software fragmentation,
improve compilation for heterogeneous hardware, significantly reduce
the cost of building domain specific compilers, and aid in connecting
existing compilers together.
'';
};
}

View File

@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c91e9cd93dc8..23b6032a46b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,8 +32,8 @@ if(MLIR_STANDALONE_BUILD)
endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
- "${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
+ "${CMAKE_INSTALL_LIBDIR}/${LLVM_LIBDIR_SUFFIX}")
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_INSTALL_BINDIR}")
set(LLVM_LIT_ARGS "-sv" CACHE STRING "Default options for lit")
endif()

View File

@@ -116,7 +116,7 @@ stdenv.mkDerivation {
--replace "#include <stdlib.h>" ""
substituteInPlace lib/builtins/clear_cache.c \
--replace "#include <assert.h>" ""
substituteInPlace lib/builtins/cpu_model.c \
substituteInPlace lib/builtins/cpu_model${lib.optionalString (lib.versionAtLeast version "18") "/x86"}.c \
--replace "#include <assert.h>" ""
'';

View File

@@ -17,12 +17,7 @@
else pkgs.bintools
, darwin
# LLVM release information; specify one of these but not both:
, gitRelease ? {
version = "18.0.0";
rev = "2fd7657b6609454af7adb75765d164ec7d1bb80b";
rev-version = "18.0.0-unstable-2023-12-13";
sha256 = "sha256-/sMQzzFid0tAnreOIV9SUm2H6QbEGhpNcizl3LDPM5s=";
}
, gitRelease ? null
# i.e.:
# {
# version = /* i.e. "15.0.0" */;
@@ -30,7 +25,7 @@
# rev-version = /* human readable version; i.e. "unstable-2022-26-07" */;
# sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */;
# }
, officialRelease ? null
, officialRelease ? { version = "18.1.0-rc3"; sha256 = "sha256-qRzY2kTLeRxXQCSuVP592Awafm5wjVeFY60d6082mSc="; }
# i.e.:
# {
# version = /* i.e. "15.0.0" */;

View File

@@ -45,17 +45,6 @@ stdenv.mkDerivation rec {
chmod -R u+w .
'';
patches = [
# fix for https://github.com/NixOS/nixpkgs/issues/269548
# https://github.com/llvm/llvm-project/pull/77218
(fetchpatch {
name = "darwin-system-libcxxabi-link-flags.patch";
url = "https://github.com/llvm/llvm-project/commit/c5b89b29ee6e3c444a355fd1cf733ce7ab2e316a.patch";
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
];
postPatch = ''
cd ../runtimes
'';
@@ -82,7 +71,9 @@ stdenv.mkDerivation rec {
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_opt}"
] ++ lib.optional (!headersOnly && cxxabi.libName == "c++abi") "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi.dev}/include/c++/v1"
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
++ lib.optionals (lib.versionAtLeast version "18" && !(stdenv.hostPlatform.useLLVM or false) && stdenv.hostPlatform.libc == "glibc" && !stdenv.hostPlatform.isStatic) [
"-DLIBCXX_ADDITIONAL_LIBRARIES=gcc_s"
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLIBCXX_USE_COMPILER_RT=ON"
# There's precedent for this in llvm-project/libcxx/cmake/caches.
# In a monorepo build you might do the following in the libcxxabi build:

View File

@@ -44,6 +44,20 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
] ++ lib.optionals (lib.versionAtLeast version "18") [
# Allow building libcxxabi alone when using LLVM unwinder
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/77610dd10454e87bb387040d2b51100a17ac5755.patch";
stripLen = 1;
revert = true;
hash = "sha256-Jogx/cvTJ6fdyprTD1QzMIeRWcBlZZMWE/y9joOtVH0=";
})
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/48e5b5ea92674ded69b998cf35724d9012c0f57d.patch";
stripLen = 1;
revert = true;
hash = "sha256-7VeBFjG7CnEMWn0hpBvyNOyhRfz50PnD3zyQNDhNChk=";
})
];
postPatch = ''
@@ -63,6 +77,8 @@ stdenv.mkDerivation rec {
# CMake however checks for this anyways; this flag tells it not to. See:
# https://github.com/llvm/llvm-project/blob/4bd3f3759259548e159aeba5c76efb9a0864e6fa/llvm/runtimes/CMakeLists.txt#L243
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (lib.versionAtLeast version "18" && !(stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm)) [
"-DLIBCXXABI_USE_LLVM_UNWINDER=OFF"
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"

View File

@@ -6,14 +6,14 @@ diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macr
index 518a09b45a42..bd9d6f5542ad 100644
--- a/tools/polly/cmake/polly_macros.cmake
+++ b/tools/polly/cmake/polly_macros.cmake
@@ -44,8 +44,8 @@ macro(add_polly_library name)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
@@ -45,8 +45,8 @@ macro(add_polly_library name)
install(TARGETS ${name}
COMPONENT ${name}
EXPORT LLVMExports
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
add_llvm_install_targets(install-${name}
COMPONENT ${name})
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endmacro(add_polly_library)

View File

@@ -6,17 +6,17 @@ index b6ddbe90516d..311ab1d50e7f 100644
set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING
"Suffix of lib installation directory, e.g. 64 => lib64")
# Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
- set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}")
+ set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}${OPENMP_LIBDIR_SUFFIX}")
- set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}" CACHE STRING
+ set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}${OPENMP_LIBDIR_SUFFIX}" CACHE STRING
"Path where built OpenMP libraries should be installed.")
# Group test settings.
set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
@@ -40,7 +40,7 @@ if (OPENMP_STANDALONE_BUILD)
@@ -47,7 +47,7 @@ if (OPENMP_STANDALONE_BUILD)
else()
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
# If building in tree, we honor the same install suffix LLVM uses.
- set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
+ set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
- set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING
+ set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Path where built OpenMP libraries should be installed.")
if (NOT MSVC)
set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)