Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvmPackages_15: init at 15.0.7 #194634

Merged
merged 30 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
201ef33
llvmPackages_15: copy from `llvmPackages_git`
rrbutani Oct 4, 2022
81ef82a
llvmPackages_15: apply some patches from `llvmPackages_14`
rrbutani Jan 8, 2023
9bd9267
llvmPackages_15: apply some patches from `llvmPackages_14`, part 2
rrbutani Jan 27, 2023
bc4dbee
llvmPackages_15: updates for LLVM 15
rrbutani Oct 5, 2022
3b6d98d
llvmPackages_15.compiler_rt: apply #196909 to LLVM 15
rrbutani Nov 29, 2022
4fabcf4
llvmPackages_15: apply #211230 to llvmPackages_15
rrbutani Jan 27, 2023
ca59a20
llvmPackages_15.libcxx: use clang 15 instead of the stdenv's compiler
rrbutani Oct 7, 2022
501a9e1
llvmPackages_15.libcxxabi: fix cycles that arise when `stdenv` is the…
rrbutani Jan 15, 2023
00839fe
llvmPackages_15.compiler-rt: fixes for Darwin
rrbutani Oct 7, 2022
09b8886
llvmPackages_15.compiler-rt: apply #186575 to `llvmPackages_15`
rrbutani Jan 16, 2023
f91fad4
llvmPackages_15.compiler-rt: update the armv7l patch
rrbutani Jan 16, 2023
d729907
llvmPackages_15.compiler-rt: gate the `libxcrypt` dep on `plat.libc =…
rrbutani Jan 16, 2023
1d3ca42
llvmPackages_15.lldb: fix `lldb` on x86_64 macOS
rrbutani Oct 8, 2022
b4ee532
llvmPackages_15.lldb: fix the build on `i686`
rrbutani Jan 15, 2023
19d1571
llvmPackages_15.lldb: fix the manpages
rrbutani Oct 8, 2022
912056c
llvmPackages_15: switch to using `ninja`
rrbutani Oct 5, 2022
4d3857d
llvmPackages_15: expand the `NIX_BUILD_CORES` arg passed to lit at co…
rrbutani Oct 5, 2022
2a58596
llvmPackages_15.llvm: enable polly by default
rrbutani Jan 8, 2023
6d0c876
llvmPackages_15.llvm: add in a missing check dep
rrbutani Oct 5, 2022
c7231c0
llvmPackages_15.llvm: run the tests on macOS
rrbutani Jan 8, 2023
0ee5251
llvmPackages_15.llvm: adjust a path, skip an xfail test on darwin
rrbutani Jan 8, 2023
eafb8fb
llvmPackages_15.llvm: fix the tests on `x86_64-darwin`
rrbutani Jan 27, 2023
5e5ed7d
llvmPackages_15.llvm: disable some RISC-V ZBP tests on arm32
rrbutani Jan 8, 2023
3436075
llvmPackages_15.llvm: specify some deps explicitly to fix cross-compi…
rrbutani Jan 15, 2023
404ef6b
llvmPackages_15.clang: drop the C++ std version `-DCMAKE_CXX_FLAG`
rrbutani Jan 27, 2023
8f16b4b
llvmPackages_15.openmp: add a missing darwin check dependency
rrbutani Jan 15, 2023
f8cbbdd
llvmPackages_15: misc fixes, notes
rrbutani Oct 8, 2022
386aba3
llvmPackages_15: update licenses
rrbutani Jan 27, 2023
8afa321
llvmPackages_15.llvm: add checks for the LLVM version
rrbutani Jan 27, 2023
d231d18
llvmPackages_15: expose the release information and monorepo source a…
rrbutani Jan 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions pkgs/development/compilers/llvm/15/bintools/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ runCommand, stdenv, llvm, lld, version }:

let
prefix =
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true;
passthru = {
isLLVM = true;
};
} ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)
done
for prog in ${llvm}/bin/*; do
ln -sf $prog $out/bin/${prefix}$(basename $prog)
done

ln -s ${llvm}/bin/llvm-ar $out/bin/${prefix}ar
ln -s ${llvm}/bin/llvm-ar $out/bin/${prefix}dlltool
ln -s ${llvm}/bin/llvm-ar $out/bin/${prefix}ranlib
ln -s ${llvm}/bin/llvm-cxxfilt $out/bin/${prefix}c++filt
ln -s ${llvm}/bin/llvm-debuginfod $out/bin/${prefix}debuginfod
ln -s ${llvm}/bin/llvm-debuginfod-find $out/bin/${prefix}debuginfod-find
ln -s ${llvm}/bin/llvm-dwp $out/bin/${prefix}dwp
ln -s ${llvm}/bin/llvm-nm $out/bin/${prefix}nm
ln -s ${llvm}/bin/llvm-objcopy $out/bin/${prefix}objcopy
ln -s ${llvm}/bin/llvm-objcopy $out/bin/${prefix}strip
ln -s ${llvm}/bin/llvm-objdump $out/bin/${prefix}objdump
ln -s ${llvm}/bin/llvm-rc $out/bin/${prefix}windres
ln -s ${llvm}/bin/llvm-readobj $out/bin/${prefix}readelf
ln -s ${llvm}/bin/llvm-size $out/bin/${prefix}size
ln -s ${llvm}/bin/llvm-strings $out/bin/${prefix}strings
ln -s ${llvm}/bin/llvm-symbolizer $out/bin/${prefix}addr2line

ln -s ${lld}/bin/lld $out/bin/${prefix}ld
''
129 changes: 129 additions & 0 deletions pkgs/development/compilers/llvm/15/clang/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{ lib, stdenv, llvm_meta
, monorepoSrc, runCommand
, substituteAll, cmake, ninja, libxml2, libllvm, version, python3
, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
}:

let
self = stdenv.mkDerivation (rec {
pname = "clang";
inherit version;

src = runCommand "${pname}-src-${version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/${pname} "$out"
cp -r ${monorepoSrc}/clang-tools-extra "$out"
'';

sourceRoot = "${src.name}/${pname}";

nativeBuildInputs = [ cmake ninja python3 ]
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;

buildInputs = [ libxml2 libllvm ];

cmakeFlags = [
"-DCLANG_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/clang"
"-DCLANGD_BUILD_XPC=OFF"
"-DLLVM_ENABLE_RTTI=ON"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
"-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
];

patches = [
./purity.patch
# https://reviews.llvm.org/D51899
./gnu-install-dirs.patch
(substituteAll {
src = ../../clang-11-12-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
})
];

postPatch = ''
(cd tools && ln -s ../../clang-tools-extra extra)

sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
-e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
lib/Driver/ToolChains/*.cpp
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
'';

outputs = [ "out" "lib" "dev" "python" ];

postInstall = ''
ln -sv $out/bin/clang $out/bin/cpp

# Move libclang to 'lib' output
moveToOutput "lib/libclang.*" "$lib"
moveToOutput "lib/libclang-cpp.*" "$lib"
substituteInPlace $dev/lib/cmake/clang/ClangTargets-release.cmake \
--replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." \
--replace "\''${_IMPORT_PREFIX}/lib/libclang-cpp." "$lib/lib/libclang-cpp."

mkdir -p $python/bin $python/share/clang/
mv $out/bin/{git-clang-format,scan-view} $python/bin
if [ -e $out/bin/set-xcode-analyzer ]; then
mv $out/bin/set-xcode-analyzer $python/bin
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
patchShebangs $python/bin

mkdir -p $dev/bin
cp bin/clang-tblgen $dev/bin
'';

passthru = {
isClang = true;
inherit libllvm;
};

meta = llvm_meta // {
homepage = "https://clang.llvm.org/";
description = "A C language family frontend for LLVM";
longDescription = ''
The Clang project provides a language front-end and tooling
infrastructure for languages in the C language family (C, C++, Objective
C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project.
It aims to deliver amazingly fast compiles, extremely useful error and
warning messages and to provide a platform for building great source
level tools. The Clang Static Analyzer and clang-tidy are tools that
automatically find bugs in your code, and are great examples of the sort
of tools that can be built using the Clang frontend as a library to
parse C/C++ code.
'';
mainProgram = "clang";
};
} // lib.optionalAttrs enableManpages {
pname = "clang-manpages";

ninjaFlags = [ "docs-clang-man" ];

installPhase = ''
mkdir -p $out/share/man/man1
# Manually install clang manpage
cp docs/man/*.1 $out/share/man/man1/
'';

outputs = [ "out" ];

doCheck = false;

meta = llvm_meta // {
description = "man page for Clang ${version}";
};
});
in self
105 changes: 105 additions & 0 deletions pkgs/development/compilers/llvm/15/clang/gnu-install-dirs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c27beec313d7..480f13e73c9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,15 +78,17 @@ if(CLANG_BUILT_STANDALONE)
if (NOT LLVM_CONFIG_FOUND)
# Pull values from LLVMConfig.cmake. We can drop this once the llvm-config
# path is removed.
- set(MAIN_INCLUDE_DIR "${LLVM_INCLUDE_DIR}")
+ set(INCLUDE_DIRS ${LLVM_INCLUDE_DIRS})
set(LLVM_OBJ_DIR "${LLVM_BINARY_DIR}")
# N.B. this is just a default value, the CACHE PATHs below can be overriden.
set(MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm")
set(TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}")
set(LIBRARY_DIR "${LLVM_LIBRARY_DIR}")
+ else()
+ set(INCLUDE_DIRS "${LLVM_BINARY_DIR}/include" "${MAIN_INCLUDE_DIR}")
endif()

- set(LLVM_MAIN_INCLUDE_DIR "${MAIN_INCLUDE_DIR}" CACHE PATH "Path to llvm/include")
+ set(LLVM_INCLUDE_DIRS ${INCLUDE_DIRS} CACHE PATH "Path to llvm/include and any other header dirs needed")
set(LLVM_BINARY_DIR "${LLVM_OBJ_ROOT}" CACHE PATH "Path to LLVM build tree")
set(LLVM_MAIN_SRC_DIR "${MAIN_SRC_DIR}" CACHE PATH "Path to LLVM source tree")
set(LLVM_TOOLS_BINARY_DIR "${TOOLS_BINARY_DIR}" CACHE PATH "Path to llvm/bin")
@@ -128,7 +130,7 @@ if(CLANG_BUILT_STANDALONE)
set(LLVM_INCLUDE_TESTS ON)
endif()

- include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
+ include_directories(${LLVM_INCLUDE_DIRS})
link_directories("${LLVM_LIBRARY_DIR}")

set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
index 21ac332e4f5f..b16c314bd1e2 100644
--- a/cmake/modules/AddClang.cmake
+++ b/cmake/modules/AddClang.cmake
@@ -119,8 +119,8 @@ macro(add_clang_library name)
install(TARGETS ${lib}
COMPONENT ${lib}
${export_to_clangtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

if (NOT LLVM_ENABLE_IDE)
diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
index 6e2060991b92..b9bc930d26b8 100644
--- a/lib/Headers/CMakeLists.txt
+++ b/lib/Headers/CMakeLists.txt
@@ -420,7 +420,7 @@ add_header_target("openmp-resource-headers" ${openmp_wrapper_files})
add_header_target("windows-resource-headers" ${windows_only_files})
add_header_target("utility-resource-headers" ${utility_files})

-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)

#############################################################
# Install rules for the catch-all clang-resource-headers target
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index 8d95d0900e8c..ebc70ff7526d 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -180,7 +180,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
COMPONENT
libclang-python-bindings
DESTINATION
- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
endforeach()
if(NOT LLVM_ENABLE_IDE)
add_custom_target(libclang-python-bindings)
diff --git a/tools/scan-build-py/CMakeLists.txt b/tools/scan-build-py/CMakeLists.txt
index 061dc7ef4dd9..adc54b2edc32 100644
--- a/tools/scan-build-py/CMakeLists.txt
+++ b/tools/scan-build-py/CMakeLists.txt
@@ -88,7 +88,7 @@ foreach(lib ${LibScanbuild})
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/${lib})
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/${lib})
install(PROGRAMS lib/libscanbuild/${lib}
- DESTINATION lib/libscanbuild
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libscanbuild"
COMPONENT scan-build-py)
endforeach()

@@ -106,7 +106,7 @@ foreach(resource ${LibScanbuildResources})
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/resources/${resource})
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources/${resource})
install(PROGRAMS lib/libscanbuild/resources/${resource}
- DESTINATION lib/libscanbuild/resources
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libscanbuild/resources"
COMPONENT scan-build-py)
endforeach()

@@ -122,7 +122,7 @@ foreach(lib ${LibEar})
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libear/${lib})
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libear/${lib})
install(PROGRAMS lib/libear/${lib}
- DESTINATION lib/libear
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libear"
COMPONENT scan-build-py)
endforeach()

29 changes: 29 additions & 0 deletions pkgs/development/compilers/llvm/15/clang/purity.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
From: Will Dietz <[email protected]>
Date: Thu, 18 May 2017 11:56:12 -0500
Subject: [PATCH] "purity" patch for 5.0

---
lib/Driver/ToolChains/Gnu.cpp | 7 -------
1 file changed, 7 deletions(-)

diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index fe3c0191bb..c6a482bece 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -487,13 +487,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
} else {
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");

- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE &&
- !Args.hasArg(options::OPT_r)) {
- CmdArgs.push_back("-dynamic-linker");
- CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
- ToolChain.getDynamicLinker(Args)));
- }
}

CmdArgs.push_back("-o");
--
2.11.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
index 3a66dd9c3fb..7efc85d9f9f 100644
--- a/lib/builtins/CMakeLists.txt
+++ b/lib/builtins/CMakeLists.txt
@@ -348,4 +348,8 @@ if (NOT MSVC)

+ set(i486_SOURCES ${i386_SOURCES})
+ set(i586_SOURCES ${i386_SOURCES})
+ set(i686_SOURCES ${i386_SOURCES})
+
if (WIN32)
set(i386_SOURCES
${i386_SOURCES}
@@ -723,6 +723,7 @@ else ()
endif()

foreach (arch ${BUILTIN_SUPPORTED_ARCH})
+ message("arch: ${arch}")
if (CAN_TARGET_${arch})
# For ARM archs, exclude any VFP builtins if VFP is not supported
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
32 changes: 32 additions & 0 deletions pkgs/development/compilers/llvm/15/compiler-rt/armv7l.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff -ur a/cmake/builtin-config-ix.cmake b/cmake/builtin-config-ix.cmake
--- a/cmake/builtin-config-ix.cmake @llvm 15.0.6
+++ b/cmake/builtin-config-ix.cmake
@@ -46,7 +46,7 @@

set(ARM64 aarch64)
-set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv8m.main armv8.1m.main)
+set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l armv8m.main armv8.1m.main)
set(AVR avr)
set(HEXAGON hexagon)
set(X86 i386)
set(X86_64 x86_64)
diff -ur a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
--- a/lib/builtins/CMakeLists.txt @llvm 15.0.6
+++ b/lib/builtins/CMakeLists.txt
@@ -565,6 +565,7 @@
set(armv7_SOURCES ${arm_SOURCES})
set(armv7s_SOURCES ${arm_SOURCES})
set(armv7k_SOURCES ${arm_SOURCES})
+set(armv7l_SOURCES ${arm_SOURCES})
set(arm64_SOURCES ${aarch64_SOURCES})

# macho_embedded archs
@@ -734,7 +735,7 @@
foreach (arch ${BUILTIN_SUPPORTED_ARCH})
if (CAN_TARGET_${arch})
# For ARM archs, exclude any VFP builtins if VFP is not supported
- if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
+ if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
if(NOT COMPILER_RT_HAS_${arch}_VFP)
Loading