summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-12-08 22:03:38 +0100
committerGitHub <noreply@github.com>2023-12-08 22:03:38 +0100
commitbb1d5c70779bbc242aec7981a626319f1f032f0b (patch)
tree3e70214cde799bc2980714670d2e784dec2dc393
parentMerge pull request #271121 from r-ryantm/auto-update/flowblade (diff)
parentllvmPackages_git: sync with llvmPackages_17 (diff)
downloadnixpkgs-bb1d5c70779bbc242aec7981a626319f1f032f0b.tar.gz
Merge pull request #272928 from wegank/llvm-git-backport
llvmPackages_git: sync with llvmPackages_17
-rw-r--r--pkgs/development/compilers/llvm/git/clang/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/git/compiler-rt/default.nix6
-rw-r--r--pkgs/development/compilers/llvm/git/default.nix57
-rw-r--r--pkgs/development/compilers/llvm/git/libcxx/default.nix3
-rw-r--r--pkgs/development/compilers/llvm/git/libcxxabi/default.nix7
-rw-r--r--pkgs/development/compilers/llvm/git/lldb/resource-dir.patch14
-rw-r--r--pkgs/development/compilers/llvm/git/llvm/default.nix3
7 files changed, 37 insertions, 55 deletions
diff --git a/pkgs/development/compilers/llvm/git/clang/default.nix b/pkgs/development/compilers/llvm/git/clang/default.nix
index 61034dbc37b0..b193ebba3d6d 100644
--- a/pkgs/development/compilers/llvm/git/clang/default.nix
+++ b/pkgs/development/compilers/llvm/git/clang/default.nix
@@ -1,6 +1,6 @@
{ lib, stdenv, llvm_meta
, monorepoSrc, runCommand
-, substituteAll, cmake, ninja, libxml2, libllvm, version, python3
+, cmake, ninja, libxml2, libllvm, version, python3
, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
diff --git a/pkgs/development/compilers/llvm/git/compiler-rt/default.nix b/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
index fc0d7533c994..7add8fab0f91 100644
--- a/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
@@ -10,7 +10,7 @@ let
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
haveLibc = stdenv.cc.libc != null;
isDarwinStatic = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic;
- inherit (stdenv.hostPlatform) isMusl isGnu;
+ inherit (stdenv.hostPlatform) isMusl;
baseName = "compiler-rt";
@@ -119,9 +119,9 @@ stdenv.mkDerivation {
'';
# Hack around weird upsream RPATH bug
- postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
+ postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin) ''
ln -s "$out/lib"/*/* "$out/lib"
- '' + lib.optionalString (useLLVM) ''
+ '' + lib.optionalString (useLLVM && stdenv.hostPlatform.isLinux) ''
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
# Note the history of crt{begin,end}S in previous versions of llvm in nixpkg:
diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix
index bb660cf01347..337809e85e63 100644
--- a/pkgs/development/compilers/llvm/git/default.nix
+++ b/pkgs/development/compilers/llvm/git/default.nix
@@ -20,7 +20,7 @@
, gitRelease ? {
version = "18.0.0";
rev = "6f44f87011cd52367626cac111ddbb2d25784b90";
- rev-version = "unstable-2023-10-04";
+ rev-version = "18.0.0-unstable-2023-10-04";
sha256 = "sha256-CqsCDlzg8I2c9BybKP7B5nfHiQWktqgVavrfiYkjkx4=";
}
# i.e.:
@@ -59,9 +59,10 @@ in
let
monorepoSrc' = monorepoSrc;
in let
- # Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
+
inherit (releaseInfo) release_version version;
+
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
tools = lib.makeExtensible (tools: let
@@ -155,18 +156,8 @@ in let
cp -r ${monorepoSrc}/lldb "$out"
'') { };
patches =
- let
- resourceDirPatch = callPackage
- ({ substituteAll, libclang }: substituteAll
- {
- src = ./lldb/resource-dir.patch;
- clangLibDir = "${libclang.lib}/lib";
- })
- { };
- in
[
# FIXME: do we need this? ./procfs.patch
- resourceDirPatch
./lldb/gnu-install-dirs.patch
]
# This is a stopgap solution if/until the macOS SDK used for x86_64 is
@@ -219,14 +210,6 @@ in let
[ "-rtlib=compiler-rt"
"-Wno-unused-command-line-argument"
"-B${targetLlvmLibraries.compiler-rt}/lib"
-
- # Combat "__cxxabi_config.h not found". Maybe this could be fixed by
- # copying these headers into libcxx? Note that building libcxx
- # outside of monorepo isn't supported anymore, might be related to
- # https://github.com/llvm/llvm-project/issues/55632
- # ("16.0.3 libcxx, libcxxabi: circular build dependencies")
- # Looks like the machinery changed in https://reviews.llvm.org/D120727.
- "-I${lib.getDev targetLlvmLibraries.libcxx.cxxabi}/include/c++/v1"
]
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
++ lib.optional
@@ -243,11 +226,13 @@ in let
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
- nixSupport.cc-cflags = [
- "-rtlib=compiler-rt"
- "-B${targetLlvmLibraries.compiler-rt}/lib"
- "-nostdlib++"
- ];
+ nixSupport.cc-cflags =
+ [
+ "-rtlib=compiler-rt"
+ "-B${targetLlvmLibraries.compiler-rt}/lib"
+ "-nostdlib++"
+ ]
+ ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
};
clangNoLibc = wrapCCWith rec {
@@ -258,10 +243,12 @@ in let
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
- nixSupport.cc-cflags = [
- "-rtlib=compiler-rt"
- "-B${targetLlvmLibraries.compiler-rt}/lib"
- ];
+ nixSupport.cc-cflags =
+ [
+ "-rtlib=compiler-rt"
+ "-B${targetLlvmLibraries.compiler-rt}/lib"
+ ]
+ ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
};
clangNoCompilerRt = wrapCCWith rec {
@@ -270,16 +257,22 @@ in let
bintools = bintoolsNoLibc';
extraPackages = [ ];
extraBuildCommands = mkExtraBuildCommands0 cc;
- nixSupport.cc-cflags = [ "-nostartfiles" ];
+ nixSupport.cc-cflags =
+ [
+ "-nostartfiles"
+ ]
+ ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
};
- clangNoCompilerRtWithLibc = wrapCCWith rec {
+ clangNoCompilerRtWithLibc = wrapCCWith (rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = bintools';
extraPackages = [ ];
extraBuildCommands = mkExtraBuildCommands0 cc;
- };
+ } // lib.optionalAttrs stdenv.targetPlatform.isWasm {
+ nixSupport.cc-cflags = [ "-fno-exceptions" ];
+ });
});
diff --git a/pkgs/development/compilers/llvm/git/libcxx/default.nix b/pkgs/development/compilers/llvm/git/libcxx/default.nix
index ac41553f5ad7..7b9996641663 100644
--- a/pkgs/development/compilers/llvm/git/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/git/libcxx/default.nix
@@ -58,7 +58,7 @@ stdenv.mkDerivation rec {
buildInputs =
lib.optionals (!headersOnly) [ cxxabi ]
- ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ libunwind ];
+ ++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [ libunwind ];
cmakeFlags = let
# See: https://libcxx.llvm.org/BuildingLibcxx.html#cmdoption-arg-libcxx-cxx-abi-string
@@ -83,6 +83,7 @@ stdenv.mkDerivation rec {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
+ "-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
# If we're only building the headers we don't actually *need* a functioning
# C/C++ compiler:
diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
index dcd83e206ce0..0a795da44ae4 100644
--- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
@@ -28,8 +28,6 @@ stdenv.mkDerivation rec {
postUnpack = lib.optionalString stdenv.isDarwin ''
export TRIPLE=x86_64-apple-darwin
- '' + lib.optionalString stdenv.hostPlatform.isWasm ''
- patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch}
'';
prePatch = ''
@@ -65,7 +63,7 @@ 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 (stdenv.hostPlatform.useLLVM or false) [
+ ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
@@ -74,8 +72,11 @@ stdenv.mkDerivation rec {
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
] ++ lib.optionals stdenv.hostPlatform.isWasm [
+ "-DCMAKE_C_COMPILER_WORKS=ON"
+ "-DCMAKE_CXX_COMPILER_WORKS=ON"
"-DLIBCXXABI_ENABLE_THREADS=OFF"
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
+ "-DUNIX=ON"
] ++ lib.optionals (!enableShared) [
"-DLIBCXXABI_ENABLE_SHARED=OFF"
];
diff --git a/pkgs/development/compilers/llvm/git/lldb/resource-dir.patch b/pkgs/development/compilers/llvm/git/lldb/resource-dir.patch
deleted file mode 100644
index 3e1a8b7d7142..000000000000
--- a/pkgs/development/compilers/llvm/git/lldb/resource-dir.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
-index ec06ba285f27..286162f098fb 100644
---- a/cmake/modules/LLDBConfig.cmake
-+++ b/cmake/modules/LLDBConfig.cmake
-@@ -290,7 +290,8 @@ if (NOT TARGET clang-resource-headers)
- # could be and pick the first that exists.
- foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
- "${LLVM_BUILD_LIBRARY_DIR}"
-- "${LLVM_LIBRARY_DIR}")
-+ "${LLVM_LIBRARY_DIR}"
-+ "@clangLibDir@")
- # Build the resource directory path by appending 'clang/<version number>'.
- set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
- if (IS_DIRECTORY "${CANDIDATE_RESOURCE_DIR}")
diff --git a/pkgs/development/compilers/llvm/git/llvm/default.nix b/pkgs/development/compilers/llvm/git/llvm/default.nix
index ac93b5fd5bac..3d05837d45da 100644
--- a/pkgs/development/compilers/llvm/git/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/git/llvm/default.nix
@@ -2,7 +2,6 @@
, pkgsBuildBuild
, monorepoSrc
, runCommand
-, fetchpatch
, cmake
, darwin
, ninja
@@ -237,6 +236,8 @@ in
rm test/tools/gold/X86/split-dwarf.ll
rm test/tools/llvm-dwarfdump/X86/prettyprint_types.s
rm test/tools/llvm-dwarfdump/X86/simplified-template-names.s
+ rm test/CodeGen/RISCV/attributes.ll
+ rm test/CodeGen/RISCV/xtheadmempair.ll
'' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
# Seems to require certain floating point hardware (NEON?)
rm test/ExecutionEngine/frem.ll