Merge pull request #272928 from wegank/llvm-git-backport
llvmPackages_git: sync with llvmPackages_17
This commit is contained in:
commit
bb1d5c7077
7 changed files with 37 additions and 55 deletions
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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" ];
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"
|
||||
];
|
||||
|
|
|
@ -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}")
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue