llvmPackages_git: Copy from llvmPackages_12

The purpose of this package is to continuously improve the LLVM
packaging in Nixpkgs without causing a lot of rebuilds and provide more
recent LLVM builds for users. For more details see:
https://github.com/NixOS/nixpkgs/issues/114828

+2984
+29
pkgs/development/compilers/llvm/git/bintools/default.nix
··· 1 + { runCommand, stdenv, llvm, lld, version }: 2 + 3 + let 4 + prefix = 5 + if stdenv.hostPlatform != stdenv.targetPlatform 6 + then "${stdenv.targetPlatform.config}-" 7 + else ""; 8 + in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' 9 + mkdir -p $out/bin 10 + for prog in ${lld}/bin/*; do 11 + ln -s $prog $out/bin/${prefix}$(basename $prog) 12 + done 13 + for prog in ${llvm}/bin/*; do 14 + ln -sf $prog $out/bin/${prefix}$(basename $prog) 15 + done 16 + 17 + ln -s ${llvm}/bin/llvm-ar $out/bin/${prefix}ar 18 + ln -s ${llvm}/bin/llvm-as $out/bin/${prefix}as 19 + ln -s ${llvm}/bin/llvm-dwp $out/bin/${prefix}dwp 20 + ln -s ${llvm}/bin/llvm-nm $out/bin/${prefix}nm 21 + ln -s ${llvm}/bin/llvm-objcopy $out/bin/${prefix}objcopy 22 + ln -s ${llvm}/bin/llvm-objdump $out/bin/${prefix}objdump 23 + ln -s ${llvm}/bin/llvm-ranlib $out/bin/${prefix}ranlib 24 + ln -s ${llvm}/bin/llvm-readelf $out/bin/${prefix}readelf 25 + ln -s ${llvm}/bin/llvm-size $out/bin/${prefix}size 26 + ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip 27 + 28 + ln -s ${lld}/bin/lld $out/bin/${prefix}ld 29 + ''
+130
pkgs/development/compilers/llvm/git/clang/default.nix
··· 1 + { lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3 2 + , buildLlvmTools 3 + , fixDarwinDylibNames 4 + , enableManpages ? false 5 + }: 6 + 7 + let 8 + self = stdenv.mkDerivation ({ 9 + pname = "clang"; 10 + inherit version; 11 + 12 + src = fetch "clang" "1vd9rhhrd8ghdg111lac7w8by71y9l14yh5zxfijsm6lj4p4avp2"; 13 + inherit clang-tools-extra_src; 14 + 15 + unpackPhase = '' 16 + unpackFile $src 17 + mv clang-* clang 18 + sourceRoot=$PWD/clang 19 + unpackFile ${clang-tools-extra_src} 20 + ''; 21 + 22 + nativeBuildInputs = [ cmake python3 ] 23 + ++ lib.optional enableManpages python3.pkgs.sphinx 24 + ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; 25 + 26 + buildInputs = [ libxml2 libllvm ]; 27 + 28 + cmakeFlags = [ 29 + "-DCMAKE_CXX_FLAGS=-std=c++14" 30 + "-DCLANGD_BUILD_XPC=OFF" 31 + "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}" 32 + ] ++ lib.optionals enableManpages [ 33 + "-DCLANG_INCLUDE_DOCS=ON" 34 + "-DLLVM_ENABLE_SPHINX=ON" 35 + "-DSPHINX_OUTPUT_MAN=ON" 36 + "-DSPHINX_OUTPUT_HTML=OFF" 37 + "-DSPHINX_WARNINGS_AS_ERRORS=OFF" 38 + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 39 + "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" 40 + "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen" 41 + ]; 42 + 43 + patches = [ 44 + ./purity.patch 45 + # https://reviews.llvm.org/D51899 46 + ./gnu-install-dirs.patch 47 + ]; 48 + 49 + postPatch = '' 50 + sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \ 51 + -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \ 52 + lib/Driver/ToolChains/*.cpp 53 + 54 + # Patch for standalone doc building 55 + sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt 56 + '' + lib.optionalString stdenv.hostPlatform.isMusl '' 57 + sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp 58 + ''; 59 + 60 + outputs = [ "out" "lib" "dev" "python" ]; 61 + 62 + # Clang expects to find LLVMgold in its own prefix 63 + postInstall = '' 64 + if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then 65 + ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib 66 + fi 67 + 68 + ln -sv $out/bin/clang $out/bin/cpp 69 + 70 + # Move libclang to 'lib' output 71 + moveToOutput "lib/libclang.*" "$lib" 72 + moveToOutput "lib/libclang-cpp.*" "$lib" 73 + substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \ 74 + --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." \ 75 + --replace "\''${_IMPORT_PREFIX}/lib/libclang-cpp." "$lib/lib/libclang-cpp." 76 + 77 + mkdir -p $python/bin $python/share/clang/ 78 + mv $out/bin/{git-clang-format,scan-view} $python/bin 79 + if [ -e $out/bin/set-xcode-analyzer ]; then 80 + mv $out/bin/set-xcode-analyzer $python/bin 81 + fi 82 + mv $out/share/clang/*.py $python/share/clang 83 + rm $out/bin/c-index-test 84 + 85 + mkdir -p $dev/bin 86 + cp bin/clang-tblgen $dev/bin 87 + ''; 88 + 89 + passthru = { 90 + isClang = true; 91 + inherit libllvm; 92 + }; 93 + 94 + meta = llvm_meta // { 95 + homepage = "https://clang.llvm.org/"; 96 + description = "A C language family frontend for LLVM"; 97 + longDescription = '' 98 + The Clang project provides a language front-end and tooling 99 + infrastructure for languages in the C language family (C, C++, Objective 100 + C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project. 101 + It aims to deliver amazingly fast compiles, extremely useful error and 102 + warning messages and to provide a platform for building great source 103 + level tools. The Clang Static Analyzer and clang-tidy are tools that 104 + automatically find bugs in your code, and are great examples of the sort 105 + of tools that can be built using the Clang frontend as a library to 106 + parse C/C++ code. 107 + ''; 108 + }; 109 + } // lib.optionalAttrs enableManpages { 110 + pname = "clang-manpages"; 111 + 112 + buildPhase = '' 113 + make docs-clang-man 114 + ''; 115 + 116 + installPhase = '' 117 + mkdir -p $out/share/man/man1 118 + # Manually install clang manpage 119 + cp docs/man/*.1 $out/share/man/man1/ 120 + ''; 121 + 122 + outputs = [ "out" ]; 123 + 124 + doCheck = false; 125 + 126 + meta = llvm_meta // { 127 + description = "man page for Clang ${version}"; 128 + }; 129 + }); 130 + in self
+235
pkgs/development/compilers/llvm/git/clang/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index 9e74014134a0..976e6a1757fd 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.13.4) 6 + if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) 7 + project(Clang) 8 + 9 + + include(GNUInstallDirs) 10 + + 11 + set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to") 12 + set(CMAKE_CXX_STANDARD_REQUIRED YES) 13 + set(CMAKE_CXX_EXTENSIONS NO) 14 + @@ -416,7 +418,7 @@ include_directories(BEFORE 15 + 16 + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 17 + install(DIRECTORY include/clang include/clang-c 18 + - DESTINATION include 19 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 20 + COMPONENT clang-headers 21 + FILES_MATCHING 22 + PATTERN "*.def" 23 + @@ -425,7 +427,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 24 + ) 25 + 26 + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang 27 + - DESTINATION include 28 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 29 + COMPONENT clang-headers 30 + FILES_MATCHING 31 + PATTERN "CMakeFiles" EXCLUDE 32 + @@ -445,7 +447,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 33 + 34 + add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh) 35 + install(PROGRAMS utils/bash-autocomplete.sh 36 + - DESTINATION share/clang 37 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/clang 38 + COMPONENT bash-autocomplete) 39 + if(NOT LLVM_ENABLE_IDE) 40 + add_llvm_install_targets(install-bash-autocomplete 41 + diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake 42 + index 704278a0e93b..d25c8d325c71 100644 43 + --- a/cmake/modules/AddClang.cmake 44 + +++ b/cmake/modules/AddClang.cmake 45 + @@ -123,9 +123,9 @@ macro(add_clang_library name) 46 + install(TARGETS ${lib} 47 + COMPONENT ${lib} 48 + ${export_to_clangtargets} 49 + - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} 50 + - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} 51 + - RUNTIME DESTINATION bin) 52 + + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} 53 + + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} 54 + + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 55 + 56 + if (NOT LLVM_ENABLE_IDE) 57 + add_llvm_install_targets(install-${lib} 58 + @@ -170,7 +170,7 @@ macro(add_clang_tool name) 59 + 60 + install(TARGETS ${name} 61 + ${export_to_clangtargets} 62 + - RUNTIME DESTINATION bin 63 + + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 64 + COMPONENT ${name}) 65 + 66 + if(NOT LLVM_ENABLE_IDE) 67 + @@ -185,7 +185,7 @@ endmacro() 68 + macro(add_clang_symlink name dest) 69 + add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE) 70 + # Always generate install targets 71 + - llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE) 72 + + llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE) 73 + endmacro() 74 + 75 + function(clang_target_link_libraries target type) 76 + diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt 77 + index b2c0ce8dd4a0..19e5443d8c25 100644 78 + --- a/lib/Headers/CMakeLists.txt 79 + +++ b/lib/Headers/CMakeLists.txt 80 + @@ -215,7 +215,7 @@ set_target_properties(clang-resource-headers PROPERTIES 81 + FOLDER "Misc" 82 + RUNTIME_OUTPUT_DIRECTORY "${output_dir}") 83 + 84 + -set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include) 85 + +set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include) 86 + 87 + install( 88 + FILES ${files} ${generated_files} 89 + diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt 90 + index ceef4b08637c..8efad5520ca4 100644 91 + --- a/tools/c-index-test/CMakeLists.txt 92 + +++ b/tools/c-index-test/CMakeLists.txt 93 + @@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 94 + set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH 95 + "@executable_path/../../lib") 96 + else() 97 + - set(INSTALL_DESTINATION bin) 98 + + set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR}) 99 + endif() 100 + 101 + install(TARGETS c-index-test 102 + diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt 103 + index 35ecdb11253c..d77d75de0094 100644 104 + --- a/tools/clang-format/CMakeLists.txt 105 + +++ b/tools/clang-format/CMakeLists.txt 106 + @@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE ) 107 + endif() 108 + 109 + install(PROGRAMS clang-format-bbedit.applescript 110 + - DESTINATION share/clang 111 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/clang 112 + COMPONENT clang-format) 113 + install(PROGRAMS clang-format-diff.py 114 + - DESTINATION share/clang 115 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/clang 116 + COMPONENT clang-format) 117 + install(PROGRAMS clang-format-sublime.py 118 + - DESTINATION share/clang 119 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/clang 120 + COMPONENT clang-format) 121 + install(PROGRAMS clang-format.el 122 + - DESTINATION share/clang 123 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/clang 124 + COMPONENT clang-format) 125 + install(PROGRAMS clang-format.py 126 + - DESTINATION share/clang 127 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/clang 128 + COMPONENT clang-format) 129 + install(PROGRAMS git-clang-format 130 + - DESTINATION bin 131 + + DESTINATION ${CMAKE_INSTALL_BINDIR} 132 + COMPONENT clang-format) 133 + diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt 134 + index cda8e29ec5b1..0134d8ccd70b 100644 135 + --- a/tools/clang-rename/CMakeLists.txt 136 + +++ b/tools/clang-rename/CMakeLists.txt 137 + @@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename 138 + ) 139 + 140 + install(PROGRAMS clang-rename.py 141 + - DESTINATION share/clang 142 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/clang 143 + COMPONENT clang-rename) 144 + install(PROGRAMS clang-rename.el 145 + - DESTINATION share/clang 146 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/clang 147 + COMPONENT clang-rename) 148 + diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt 149 + index 51ff2e7e1565..1ed5f8a079a1 100644 150 + --- a/tools/libclang/CMakeLists.txt 151 + +++ b/tools/libclang/CMakeLists.txt 152 + @@ -166,7 +166,7 @@ endif() 153 + if(INTERNAL_INSTALL_PREFIX) 154 + set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include") 155 + else() 156 + - set(LIBCLANG_HEADERS_INSTALL_DESTINATION include) 157 + + set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 158 + endif() 159 + 160 + install(DIRECTORY ../../include/clang-c 161 + @@ -196,7 +196,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS}) 162 + COMPONENT 163 + libclang-python-bindings 164 + DESTINATION 165 + - "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages") 166 + + "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages") 167 + endforeach() 168 + if(NOT LLVM_ENABLE_IDE) 169 + add_custom_target(libclang-python-bindings) 170 + diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt 171 + index ec0702d76f18..d25d982f51da 100644 172 + --- a/tools/scan-build/CMakeLists.txt 173 + +++ b/tools/scan-build/CMakeLists.txt 174 + @@ -47,7 +47,7 @@ if(CLANG_INSTALL_SCANBUILD) 175 + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}) 176 + list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) 177 + install(PROGRAMS bin/${BinFile} 178 + - DESTINATION bin 179 + + DESTINATION ${CMAKE_INSTALL_BINDIR} 180 + COMPONENT scan-build) 181 + endforeach() 182 + 183 + @@ -61,7 +61,7 @@ if(CLANG_INSTALL_SCANBUILD) 184 + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile}) 185 + list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile}) 186 + install(PROGRAMS libexec/${LibexecFile} 187 + - DESTINATION libexec 188 + + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR} 189 + COMPONENT scan-build) 190 + endforeach() 191 + 192 + @@ -89,7 +89,7 @@ if(CLANG_INSTALL_SCANBUILD) 193 + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile}) 194 + list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile}) 195 + install(FILES share/scan-build/${ShareFile} 196 + - DESTINATION share/scan-build 197 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build 198 + COMPONENT scan-build) 199 + endforeach() 200 + 201 + diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt 202 + index dd3d33439299..fea19c12ce70 100644 203 + --- a/tools/scan-view/CMakeLists.txt 204 + +++ b/tools/scan-view/CMakeLists.txt 205 + @@ -19,7 +19,7 @@ if(CLANG_INSTALL_SCANVIEW) 206 + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}) 207 + list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) 208 + install(PROGRAMS bin/${BinFile} 209 + - DESTINATION bin 210 + + DESTINATION ${CMAKE_INSTALL_BINDIR} 211 + COMPONENT scan-view) 212 + endforeach() 213 + 214 + @@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW) 215 + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}) 216 + list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile}) 217 + install(FILES share/${ShareFile} 218 + - DESTINATION share/scan-view 219 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view 220 + COMPONENT scan-view) 221 + endforeach() 222 + 223 + diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt 224 + index 62f2de0cb15c..6aa66825b6ec 100644 225 + --- a/utils/hmaptool/CMakeLists.txt 226 + +++ b/utils/hmaptool/CMakeLists.txt 227 + @@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM 228 + 229 + list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL}) 230 + install(PROGRAMS ${CLANG_HMAPTOOL} 231 + - DESTINATION bin 232 + + DESTINATION ${CMAKE_INSTALL_BINDIR} 233 + COMPONENT hmaptool) 234 + 235 + add_custom_target(hmaptool ALL DEPENDS ${Depends})
+28
pkgs/development/compilers/llvm/git/clang/purity.patch
··· 1 + From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001 2 + From: Will Dietz <w@wdtz.org> 3 + Date: Thu, 18 May 2017 11:56:12 -0500 4 + Subject: [PATCH] "purity" patch for 5.0 5 + 6 + --- 7 + lib/Driver/ToolChains/Gnu.cpp | 7 ------- 8 + 1 file changed, 7 deletions(-) 9 + 10 + diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp 11 + index fe3c0191bb..c6a482bece 100644 12 + --- a/lib/Driver/ToolChains/Gnu.cpp 13 + +++ b/lib/Driver/ToolChains/Gnu.cpp 14 + @@ -487,12 +487,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, 15 + if (!IsStatic) { 16 + if (Args.hasArg(options::OPT_rdynamic)) 17 + CmdArgs.push_back("-export-dynamic"); 18 + - 19 + - if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) { 20 + - CmdArgs.push_back("-dynamic-linker"); 21 + - CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) + 22 + - ToolChain.getDynamicLinker(Args))); 23 + - } 24 + } 25 + 26 + CmdArgs.push_back("-o"); 27 + -- 28 + 2.11.0
+23
pkgs/development/compilers/llvm/git/compiler-rt/X86-support-extension.patch
··· 1 + diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt 2 + index 3a66dd9c3fb..7efc85d9f9f 100644 3 + --- a/lib/builtins/CMakeLists.txt 4 + +++ b/lib/builtins/CMakeLists.txt 5 + @@ -301,6 +301,10 @@ if (NOT MSVC) 6 + i386/umoddi3.S 7 + ) 8 + 9 + + set(i486_SOURCES ${i386_SOURCES}) 10 + + set(i586_SOURCES ${i386_SOURCES}) 11 + + set(i686_SOURCES ${i386_SOURCES}) 12 + + 13 + if (WIN32) 14 + set(i386_SOURCES 15 + ${i386_SOURCES} 16 + @@ -608,6 +612,7 @@ else () 17 + endif() 18 + 19 + foreach (arch ${BUILTIN_SUPPORTED_ARCH}) 20 + + message("arch: ${arch}") 21 + if (CAN_TARGET_${arch}) 22 + # For ARM archs, exclude any VFP builtins if VFP is not supported 23 + if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
+32
pkgs/development/compilers/llvm/git/compiler-rt/armv7l.patch
··· 1 + diff -ur compiler-rt-10.0.0.src/cmake/builtin-config-ix.cmake compiler-rt-10.0.0.src-patched/cmake/builtin-config-ix.cmake 2 + --- compiler-rt-10.0.0.src/cmake/builtin-config-ix.cmake 2020-03-24 00:01:02.000000000 +0900 3 + +++ compiler-rt-10.0.0.src-patched/cmake/builtin-config-ix.cmake 2020-05-10 03:42:00.883450706 +0900 4 + @@ -24,7 +24,7 @@ 5 + 6 + 7 + set(ARM64 aarch64) 8 + -set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k) 9 + +set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l) 10 + set(HEXAGON hexagon) 11 + set(X86 i386) 12 + set(X86_64 x86_64) 13 + diff -ur compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt compiler-rt-10.0.0.src-patched/lib/builtins/CMakeLists.txt 14 + --- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt 2020-03-24 00:01:02.000000000 +0900 15 + +++ compiler-rt-10.0.0.src-patched/lib/builtins/CMakeLists.txt 2020-05-10 03:44:49.468579650 +0900 16 + @@ -474,6 +474,7 @@ 17 + set(armv7_SOURCES ${arm_SOURCES}) 18 + set(armv7s_SOURCES ${arm_SOURCES}) 19 + set(armv7k_SOURCES ${arm_SOURCES}) 20 + +set(armv7l_SOURCES ${arm_SOURCES}) 21 + set(arm64_SOURCES ${aarch64_SOURCES}) 22 + 23 + # macho_embedded archs 24 + @@ -595,7 +596,7 @@ 25 + foreach (arch ${BUILTIN_SUPPORTED_ARCH}) 26 + if (CAN_TARGET_${arch}) 27 + # For ARM archs, exclude any VFP builtins if VFP is not supported 28 + - if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$") 29 + + if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em)$") 30 + string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}") 31 + check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP) 32 + if(NOT COMPILER_RT_HAS_${arch}_VFP)
+33
pkgs/development/compilers/llvm/git/compiler-rt/codesign.patch
··· 1 + From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001 2 + From: Will Dietz <w@wdtz.org> 3 + Date: Tue, 19 Sep 2017 13:13:06 -0500 4 + Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that 5 + needs it 6 + 7 + --- 8 + cmake/Modules/AddCompilerRT.cmake | 8 ------ 9 + test/asan/CMakeLists.txt | 52 --------------------------------------- 10 + test/tsan/CMakeLists.txt | 47 ----------------------------------- 11 + 3 files changed, 107 deletions(-) 12 + 13 + diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake 14 + index bc5fb9ff7..b64eb4246 100644 15 + --- a/cmake/Modules/AddCompilerRT.cmake 16 + +++ b/cmake/Modules/AddCompilerRT.cmake 17 + @@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type) 18 + set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "") 19 + set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib") 20 + endif() 21 + - if(APPLE) 22 + - # Ad-hoc sign the dylibs 23 + - add_custom_command(TARGET ${libname} 24 + - POST_BUILD 25 + - COMMAND codesign --sign - $<TARGET_FILE:${libname}> 26 + - WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} 27 + - ) 28 + - endif() 29 + endif() 30 + install(TARGETS ${libname} 31 + ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} 32 + 2.14.1 33 +
+111
pkgs/development/compilers/llvm/git/compiler-rt/default.nix
··· 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, llvm, libcxxabi }: 2 + 3 + let 4 + 5 + useLLVM = stdenv.hostPlatform.useLLVM or false; 6 + bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; 7 + haveLibc = stdenv.cc.libc != null; 8 + inherit (stdenv.hostPlatform) isMusl; 9 + 10 + in 11 + 12 + stdenv.mkDerivation { 13 + pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc"; 14 + inherit version; 15 + src = fetch "compiler-rt" "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45"; 16 + 17 + nativeBuildInputs = [ cmake python3 llvm.dev ]; 18 + buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi; 19 + 20 + NIX_CFLAGS_COMPILE = [ 21 + "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" 22 + ]; 23 + 24 + cmakeFlags = [ 25 + "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" 26 + "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" 27 + "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" 28 + ] ++ lib.optionals (useLLVM || bareMetal || isMusl) [ 29 + "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" 30 + "-DCOMPILER_RT_BUILD_XRAY=OFF" 31 + "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" 32 + "-DCOMPILER_RT_BUILD_PROFILE=OFF" 33 + ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [ 34 + "-DCMAKE_C_COMPILER_WORKS=ON" 35 + "-DCMAKE_CXX_COMPILER_WORKS=ON" 36 + "-DCOMPILER_RT_BAREMETAL_BUILD=ON" 37 + "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" 38 + ] ++ lib.optionals (useLLVM && !haveLibc) [ 39 + "-DCMAKE_C_FLAGS=-nodefaultlibs" 40 + ] ++ lib.optionals (useLLVM) [ 41 + "-DCOMPILER_RT_BUILD_BUILTINS=ON" 42 + #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program 43 + "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" 44 + ] ++ lib.optionals (bareMetal) [ 45 + "-DCOMPILER_RT_OS_DIR=baremetal" 46 + ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ 47 + "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON" 48 + "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}" 49 + "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}" 50 + ]; 51 + 52 + outputs = [ "out" "dev" ]; 53 + 54 + patches = [ 55 + ./codesign.patch # Revert compiler-rt commit that makes codesign mandatory 56 + ./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config 57 + ./gnu-install-dirs.patch 58 + # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the 59 + # extra `/`. 60 + ./normalize-var.patch 61 + ]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch 62 + ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch; 63 + 64 + # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks 65 + # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra 66 + # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd 67 + # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by 68 + # a flag and turn the flag off during the stdenv build. 69 + postPatch = lib.optionalString (!stdenv.isDarwin) '' 70 + substituteInPlace cmake/builtin-config-ix.cmake \ 71 + --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' 72 + '' + lib.optionalString stdenv.isDarwin '' 73 + substituteInPlace cmake/builtin-config-ix.cmake \ 74 + --replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)' 75 + substituteInPlace cmake/config-ix.cmake \ 76 + --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)' 77 + '' + lib.optionalString (useLLVM) '' 78 + substituteInPlace lib/builtins/int_util.c \ 79 + --replace "#include <stdlib.h>" "" 80 + substituteInPlace lib/builtins/clear_cache.c \ 81 + --replace "#include <assert.h>" "" 82 + substituteInPlace lib/builtins/cpu_model.c \ 83 + --replace "#include <assert.h>" "" 84 + ''; 85 + 86 + # Hack around weird upsream RPATH bug 87 + postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) '' 88 + ln -s "$out/lib"/*/* "$out/lib" 89 + '' + lib.optionalString (useLLVM) '' 90 + ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o 91 + ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o 92 + ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o 93 + ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o 94 + ''; 95 + 96 + meta = llvm_meta // { 97 + homepage = "https://compiler-rt.llvm.org/"; 98 + description = "Compiler runtime libraries"; 99 + longDescription = '' 100 + The compiler-rt project provides highly tuned implementations of the 101 + low-level code generator support routines like "__fixunsdfdi" and other 102 + calls generated when a target doesn't have a short sequence of native 103 + instructions to implement a core IR operation. It also provides 104 + implementations of run-time libraries for dynamic testing tools such as 105 + AddressSanitizer, ThreadSanitizer, MemorySanitizer, and DataFlowSanitizer. 106 + ''; 107 + # "All of the code in the compiler-rt project is dual licensed under the MIT 108 + # license and the UIUC License (a BSD-like license)": 109 + license = with lib.licenses; [ mit ncsa ]; 110 + }; 111 + }
+129
pkgs/development/compilers/llvm/git/compiler-rt/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index b44ad2c2118e..d42f5664d448 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.13.4) 6 + # Check if compiler-rt is built as a standalone project. 7 + if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD) 8 + project(CompilerRT C CXX ASM) 9 + + include(GNUInstallDirs) 10 + set(COMPILER_RT_STANDALONE_BUILD TRUE) 11 + set_property(GLOBAL PROPERTY USE_FOLDERS ON) 12 + endif() 13 + diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake 14 + index 361538a58e47..f0d8d9ab80f1 100644 15 + --- a/cmake/Modules/AddCompilerRT.cmake 16 + +++ b/cmake/Modules/AddCompilerRT.cmake 17 + @@ -495,7 +495,7 @@ macro(add_compiler_rt_resource_file target_name file_name component) 18 + add_custom_target(${target_name} DEPENDS ${dst_file}) 19 + # Install in Clang resource directory. 20 + install(FILES ${file_name} 21 + - DESTINATION ${COMPILER_RT_INSTALL_PATH}/share 22 + + DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR} 23 + COMPONENT ${component}) 24 + add_dependencies(${component} ${target_name}) 25 + 26 + @@ -512,7 +512,7 @@ macro(add_compiler_rt_script name) 27 + add_custom_target(${name} DEPENDS ${dst}) 28 + install(FILES ${dst} 29 + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE 30 + - DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin) 31 + + DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR}) 32 + endmacro(add_compiler_rt_script src name) 33 + 34 + # Builds custom version of libc++ and installs it in <prefix>. 35 + diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake 36 + index 456a8dcda59f..7a09e74c7c79 100644 37 + --- a/cmake/Modules/CompilerRTDarwinUtils.cmake 38 + +++ b/cmake/Modules/CompilerRTDarwinUtils.cmake 39 + @@ -508,7 +508,7 @@ macro(darwin_add_embedded_builtin_libraries) 40 + set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR 41 + ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded) 42 + set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR 43 + - ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded) 44 + + ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded) 45 + 46 + set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi") 47 + set(CFLAGS_i386 "-march=pentium") 48 + diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake 49 + index f61d487e93a0..f1f46fb9599c 100644 50 + --- a/cmake/Modules/CompilerRTUtils.cmake 51 + +++ b/cmake/Modules/CompilerRTUtils.cmake 52 + @@ -378,7 +378,7 @@ endfunction() 53 + function(get_compiler_rt_install_dir arch install_dir) 54 + if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) 55 + get_compiler_rt_target(${arch} target) 56 + - set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE) 57 + + set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE) 58 + else() 59 + set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE) 60 + endif() 61 + diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake 62 + index 1edab43e7c0d..1aac6b73ff82 100644 63 + --- a/cmake/base-config-ix.cmake 64 + +++ b/cmake/base-config-ix.cmake 65 + @@ -65,11 +65,11 @@ if (LLVM_TREE_AVAILABLE) 66 + else() 67 + # Take output dir and install path from the user. 68 + set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH 69 + - "Path where built compiler-rt libraries should be stored.") 70 + + "Path where built compiler-rt build artifacts should be stored.") 71 + set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH 72 + "Path where built compiler-rt executables should be stored.") 73 + - set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH 74 + - "Path where built compiler-rt libraries should be installed.") 75 + + set(COMPILER_RT_INSTALL_PATH "" CACHE PATH 76 + + "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.") 77 + option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF) 78 + option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF) 79 + # Use a host compiler to compile/link tests. 80 + @@ -97,7 +97,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR) 81 + set(COMPILER_RT_LIBRARY_OUTPUT_DIR 82 + ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) 83 + set(COMPILER_RT_LIBRARY_INSTALL_DIR 84 + - ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) 85 + + ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR}) 86 + endif() 87 + 88 + if(APPLE) 89 + diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt 90 + index b00e8caa1ddd..0fe64e4862c9 100644 91 + --- a/include/CMakeLists.txt 92 + +++ b/include/CMakeLists.txt 93 + @@ -69,22 +69,22 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc") 94 + install(FILES ${SANITIZER_HEADERS} 95 + COMPONENT compiler-rt-headers 96 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ 97 + - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer) 98 + + DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer) 99 + # Install fuzzer headers. 100 + install(FILES ${FUZZER_HEADERS} 101 + COMPONENT compiler-rt-headers 102 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ 103 + - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer) 104 + + DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer) 105 + # Install xray headers. 106 + install(FILES ${XRAY_HEADERS} 107 + COMPONENT compiler-rt-headers 108 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ 109 + - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray) 110 + + DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray) 111 + # Install profile headers. 112 + install(FILES ${PROFILE_HEADERS} 113 + COMPONENT compiler-rt-headers 114 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ 115 + - DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile) 116 + + DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile) 117 + 118 + if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs. 119 + add_custom_target(install-compiler-rt-headers 120 + diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt 121 + index a29de8deff1b..d39ff01613d2 100644 122 + --- a/lib/dfsan/CMakeLists.txt 123 + +++ b/lib/dfsan/CMakeLists.txt 124 + @@ -57,4 +57,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename} 125 + DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt) 126 + add_dependencies(dfsan dfsan_abilist) 127 + install(FILES ${dfsan_abilist_filename} 128 + - DESTINATION ${COMPILER_RT_INSTALL_PATH}/share) 129 + + DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
+16
pkgs/development/compilers/llvm/git/compiler-rt/normalize-var.patch
··· 1 + diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake 2 + index f1f46fb9599c..6f19e69507ba 100644 3 + --- a/cmake/Modules/CompilerRTUtils.cmake 4 + +++ b/cmake/Modules/CompilerRTUtils.cmake 5 + @@ -302,8 +302,9 @@ macro(load_llvm_config) 6 + # Get some LLVM variables from LLVMConfig. 7 + include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake") 8 + 9 + - set(LLVM_LIBRARY_OUTPUT_INTDIR 10 + - ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) 11 + + get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR 12 + + ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX} 13 + + REALPATH) 14 + endif() 15 + endmacro() 16 +
+412
pkgs/development/compilers/llvm/git/compiler-rt/sanitizers-nongnu.patch
··· 1 + From f7a253f8f85d0f49df6b73996737a3e84ac64236 Mon Sep 17 00:00:00 2001 2 + From: Will Dietz <w@wdtz.org> 3 + Date: Mon, 24 Sep 2018 11:17:25 -0500 4 + Subject: [PATCH] Ported to 7.0, taken from gentoo-musl project. 5 + 6 + ------ 7 + Ported to compiler-rt-sanitizers-5.0.0. Taken from 8 + 9 + https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch 10 + Signed-off-by: Jory A. Pratt <anarchy@gentoo.org> 11 + 12 + Taken from gentoo-musl project, with a few additional minor fixes. 13 + --- 14 + lib/asan/asan_linux.cc | 4 +- 15 + lib/interception/interception_linux.cc | 2 +- 16 + lib/interception/interception_linux.h | 2 +- 17 + lib/msan/msan_linux.cc | 2 +- 18 + lib/sanitizer_common/sanitizer_allocator.cc | 2 +- 19 + .../sanitizer_common_interceptors_ioctl.inc | 4 +- 20 + .../sanitizer_common_syscalls.inc | 2 +- 21 + lib/sanitizer_common/sanitizer_linux.cc | 8 +++- 22 + .../sanitizer_linux_libcdep.cc | 10 ++--- 23 + lib/sanitizer_common/sanitizer_platform.h | 6 +++ 24 + .../sanitizer_platform_interceptors.h | 4 +- 25 + .../sanitizer_platform_limits_posix.cc | 37 +++++++++++-------- 26 + lib/tsan/rtl/tsan_platform_linux.cc | 2 +- 27 + 13 files changed, 51 insertions(+), 34 deletions(-) 28 + 29 + diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc 30 + index 625f32d40..73cf77aca 100644 31 + --- a/lib/asan/asan_linux.cc 32 + +++ b/lib/asan/asan_linux.cc 33 + @@ -46,7 +46,7 @@ 34 + #include <link.h> 35 + #endif 36 + 37 + -#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS 38 + +#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS || SANITIZER_NONGNU 39 + #include <ucontext.h> 40 + extern "C" void* _DYNAMIC; 41 + #elif SANITIZER_NETBSD 42 + @@ -139,7 +139,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { 43 + UNIMPLEMENTED(); 44 + } 45 + 46 + -#if SANITIZER_ANDROID 47 + +#if SANITIZER_ANDROID || SANITIZER_NONGNU 48 + // FIXME: should we do anything for Android? 49 + void AsanCheckDynamicRTPrereqs() {} 50 + void AsanCheckIncompatibleRT() {} 51 + diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc 52 + index 26bfcd8f6..529b234f7 100644 53 + --- a/lib/interception/interception_linux.cc 54 + +++ b/lib/interception/interception_linux.cc 55 + @@ -43,7 +43,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, 56 + } 57 + 58 + // Android and Solaris do not have dlvsym 59 + -#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD 60 + +#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD && !SANITIZER_NONGNU 61 + void *GetFuncAddrVer(const char *func_name, const char *ver) { 62 + return dlvsym(RTLD_NEXT, func_name, ver); 63 + } 64 + diff --git a/lib/interception/interception_linux.h b/lib/interception/interception_linux.h 65 + index 942c25609..24a4d5080 100644 66 + --- a/lib/interception/interception_linux.h 67 + +++ b/lib/interception/interception_linux.h 68 + @@ -36,7 +36,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver); 69 + (::__interception::uptr) & WRAP(func)) 70 + 71 + // Android, Solaris and OpenBSD do not have dlvsym 72 + -#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD 73 + +#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD && !SANITIZER_NONGNU 74 + #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ 75 + (::__interception::real_##func = (func##_f)( \ 76 + unsigned long)::__interception::GetFuncAddrVer(#func, symver)) 77 + diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc 78 + index 385a650c4..6e30a8ce9 100644 79 + --- a/lib/msan/msan_linux.cc 80 + +++ b/lib/msan/msan_linux.cc 81 + @@ -13,7 +13,7 @@ 82 + //===----------------------------------------------------------------------===// 83 + 84 + #include "sanitizer_common/sanitizer_platform.h" 85 + -#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD 86 + +#if SANITIZER_FREEBSD || (SANITIZER_LINUX && !SANITIZER_NONGNU) || SANITIZER_NETBSD 87 + 88 + #include "msan.h" 89 + #include "msan_report.h" 90 + diff --git a/lib/sanitizer_common/sanitizer_allocator.cc b/lib/sanitizer_common/sanitizer_allocator.cc 91 + index 6bfd5e5ee..048f6154f 100644 92 + --- a/lib/sanitizer_common/sanitizer_allocator.cc 93 + +++ b/lib/sanitizer_common/sanitizer_allocator.cc 94 + @@ -27,7 +27,7 @@ const char *SecondaryAllocatorName = "LargeMmapAllocator"; 95 + 96 + // ThreadSanitizer for Go uses libc malloc/free. 97 + #if SANITIZER_GO || defined(SANITIZER_USE_MALLOC) 98 + -# if SANITIZER_LINUX && !SANITIZER_ANDROID 99 + +# if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 100 + extern "C" void *__libc_malloc(uptr size); 101 + # if !SANITIZER_GO 102 + extern "C" void *__libc_memalign(uptr alignment, uptr size); 103 + diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 104 + index 2d633c173..b6eb23116 100644 105 + --- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 106 + +++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 107 + @@ -104,7 +104,7 @@ static void ioctl_table_fill() { 108 + _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz); 109 + #endif 110 + 111 + -#if SANITIZER_LINUX 112 + +#if SANITIZER_LINUX && !SANITIZER_NONGNU 113 + // Conflicting request ids. 114 + // _(CDROMAUDIOBUFSIZ, NONE, 0); 115 + // _(SNDCTL_TMR_CONTINUE, NONE, 0); 116 + @@ -365,7 +365,7 @@ static void ioctl_table_fill() { 117 + _(VT_WAITACTIVE, NONE, 0); 118 + #endif 119 + 120 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 121 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 122 + // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE 123 + _(CYGETDEFTHRESH, WRITE, sizeof(int)); 124 + _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); 125 + diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc 126 + index 469c8eb7e..24f87867d 100644 127 + --- a/lib/sanitizer_common/sanitizer_common_syscalls.inc 128 + +++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc 129 + @@ -2038,7 +2038,7 @@ POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) { 130 + } 131 + } 132 + 133 + -#if !SANITIZER_ANDROID 134 + +#if !SANITIZER_ANDROID && !SANITIZER_NONGNU 135 + PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim, 136 + void *old_rlim) { 137 + if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz); 138 + diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc 139 + index 96d6c1eff..9e2b7fb9d 100644 140 + --- a/lib/sanitizer_common/sanitizer_linux.cc 141 + +++ b/lib/sanitizer_common/sanitizer_linux.cc 142 + @@ -541,13 +541,13 @@ const char *GetEnv(const char *name) { 143 + #endif 144 + } 145 + 146 + -#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD && !SANITIZER_OPENBSD 147 + +#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD && !SANITIZER_OPENBSD && !SANITIZER_NONGNU 148 + extern "C" { 149 + SANITIZER_WEAK_ATTRIBUTE extern void *__libc_stack_end; 150 + } 151 + #endif 152 + 153 + -#if !SANITIZER_GO && !SANITIZER_FREEBSD && !SANITIZER_NETBSD && \ 154 + +#if (!SANITIZER_GO || SANITIZER_NONGNU) && !SANITIZER_FREEBSD && !SANITIZER_NETBSD && \ 155 + !SANITIZER_OPENBSD 156 + static void ReadNullSepFileToArray(const char *path, char ***arr, 157 + int arr_size) { 158 + @@ -590,6 +590,10 @@ static void GetArgsAndEnv(char ***argv, char ***envp) { 159 + #elif SANITIZER_NETBSD 160 + *argv = __ps_strings->ps_argvstr; 161 + *envp = __ps_strings->ps_envstr; 162 + +#elif SANITIZER_NONGNU 163 + + static const int kMaxArgv = 2000, kMaxEnvp = 2000; 164 + + ReadNullSepFileToArray("/proc/self/cmdline", argv, kMaxArgv); 165 + + ReadNullSepFileToArray("/proc/self/environ", envp, kMaxEnvp); 166 + #else // SANITIZER_FREEBSD 167 + #if !SANITIZER_GO 168 + if (&__libc_stack_end) { 169 + diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc 170 + index 4962ff832..438f94dbe 100644 171 + --- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc 172 + +++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc 173 + @@ -179,7 +179,7 @@ __attribute__((unused)) static bool GetLibcVersion(int *major, int *minor, 174 + } 175 + 176 + #if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && \ 177 + - !SANITIZER_NETBSD && !SANITIZER_OPENBSD && !SANITIZER_SOLARIS 178 + + !SANITIZER_NETBSD && !SANITIZER_OPENBSD && !SANITIZER_SOLARIS && !SANITIZER_NONGNU 179 + static uptr g_tls_size; 180 + 181 + #ifdef __i386__ 182 + @@ -261,7 +261,7 @@ void InitTlsSize() { } 183 + #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) || \ 184 + defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__) || \ 185 + defined(__arm__)) && \ 186 + - SANITIZER_LINUX && !SANITIZER_ANDROID 187 + + SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 188 + // sizeof(struct pthread) from glibc. 189 + static atomic_uintptr_t thread_descriptor_size; 190 + 191 + @@ -426,7 +426,7 @@ int GetSizeFromHdr(struct dl_phdr_info *info, size_t size, void *data) { 192 + 193 + #if !SANITIZER_GO 194 + static void GetTls(uptr *addr, uptr *size) { 195 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 196 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 197 + # if defined(__x86_64__) || defined(__i386__) || defined(__s390__) 198 + *addr = ThreadSelf(); 199 + *size = GetTlsSize(); 200 + @@ -470,7 +470,7 @@ static void GetTls(uptr *addr, uptr *size) { 201 + #elif SANITIZER_OPENBSD 202 + *addr = 0; 203 + *size = 0; 204 + -#elif SANITIZER_ANDROID 205 + +#elif SANITIZER_ANDROID || SANITIZER_NONGNU 206 + *addr = 0; 207 + *size = 0; 208 + #elif SANITIZER_SOLARIS 209 + @@ -486,7 +486,7 @@ static void GetTls(uptr *addr, uptr *size) { 210 + #if !SANITIZER_GO 211 + uptr GetTlsSize() { 212 + #if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NETBSD || \ 213 + - SANITIZER_OPENBSD || SANITIZER_SOLARIS 214 + + SANITIZER_OPENBSD || SANITIZER_SOLARIS || SANITIZER_NONGNU 215 + uptr addr, size; 216 + GetTls(&addr, &size); 217 + return size; 218 + diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h 219 + index d81e25580..e10680ac8 100644 220 + --- a/lib/sanitizer_common/sanitizer_platform.h 221 + +++ b/lib/sanitizer_common/sanitizer_platform.h 222 + @@ -208,6 +208,12 @@ 223 + # define SANITIZER_SOLARIS32 0 224 + #endif 225 + 226 + +#if defined(__linux__) && !defined(__GLIBC__) 227 + +# define SANITIZER_NONGNU 1 228 + +#else 229 + +# define SANITIZER_NONGNU 0 230 + +#endif 231 + + 232 + #if defined(__myriad2__) 233 + # define SANITIZER_MYRIAD2 1 234 + #else 235 + diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h 236 + index f95539a73..6c53b3415 100644 237 + --- a/lib/sanitizer_common/sanitizer_platform_interceptors.h 238 + +++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h 239 + @@ -39,7 +39,7 @@ 240 + # include "sanitizer_platform_limits_solaris.h" 241 + #endif 242 + 243 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 244 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 245 + # define SI_LINUX_NOT_ANDROID 1 246 + #else 247 + # define SI_LINUX_NOT_ANDROID 0 248 + @@ -322,7 +322,7 @@ 249 + #define SANITIZER_INTERCEPT_ETHER_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID) 250 + #define SANITIZER_INTERCEPT_SHMCTL \ 251 + (SI_NETBSD || SI_OPENBSD || SI_SOLARIS || \ 252 + - ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && \ 253 + + ((SI_FREEBSD || SI_LINUX_NOT_ANDROID || SANITIZER_NONGNU) && \ 254 + SANITIZER_WORDSIZE == 64)) // NOLINT 255 + #define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID 256 + #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX 257 + diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 258 + index 54da635d7..2f6ff69c3 100644 259 + --- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 260 + +++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 261 + @@ -14,6 +14,9 @@ 262 + 263 + #include "sanitizer_platform.h" 264 + 265 + +// Workaround musl <--> linux conflicting definition of 'struct sysinfo' 266 + +#define _LINUX_SYSINFO_H 267 + + 268 + #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC 269 + // Tests in this file assume that off_t-dependent data structures match the 270 + // libc ABI. For example, struct dirent here is what readdir() function (as 271 + @@ -138,12 +141,14 @@ typedef struct user_fpregs elf_fpregset_t; 272 + 273 + #if SANITIZER_LINUX && !SANITIZER_ANDROID 274 + #include <glob.h> 275 + -#include <obstack.h> 276 + +# if !SANITIZER_NONGNU 277 + +# include <obstack.h> 278 + +# endif 279 + #include <mqueue.h> 280 + -#include <net/if_ppp.h> 281 + -#include <netax25/ax25.h> 282 + -#include <netipx/ipx.h> 283 + -#include <netrom/netrom.h> 284 + +#include <linux/if_ppp.h> 285 + +#include <linux/ax25.h> 286 + +#include <linux/ipx.h> 287 + +#include <linux/netrom.h> 288 + #if HAVE_RPC_XDR_H 289 + # include <rpc/xdr.h> 290 + #elif HAVE_TIRPC_RPC_XDR_H 291 + @@ -251,7 +256,7 @@ namespace __sanitizer { 292 + unsigned struct_itimerspec_sz = sizeof(struct itimerspec); 293 + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD 294 + 295 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 296 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 297 + // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which 298 + // has been removed from glibc 2.28. 299 + #if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ 300 + @@ -322,7 +327,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr)); 301 + unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); 302 + #endif 303 + 304 + -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 305 + +#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU 306 + int glob_nomatch = GLOB_NOMATCH; 307 + int glob_altdirfunc = GLOB_ALTDIRFUNC; 308 + #endif 309 + @@ -416,7 +421,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); 310 + unsigned struct_termios_sz = sizeof(struct termios); 311 + unsigned struct_winsize_sz = sizeof(struct winsize); 312 + 313 + -#if SANITIZER_LINUX 314 + +#if SANITIZER_LINUX && !SANITIZER_NONGNU 315 + unsigned struct_arpreq_sz = sizeof(struct arpreq); 316 + unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf); 317 + unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession); 318 + @@ -466,7 +471,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); 319 + unsigned struct_vt_mode_sz = sizeof(struct vt_mode); 320 + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD 321 + 322 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 323 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 324 + unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); 325 + unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); 326 + #if EV_VERSION > (0x010000) 327 + @@ -834,7 +839,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); 328 + unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE; 329 + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD 330 + 331 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 332 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 333 + unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; 334 + unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; 335 + unsigned IOCTL_CYGETMON = CYGETMON; 336 + @@ -989,7 +994,7 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr); 337 + CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum); 338 + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD 339 + 340 + -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 341 + +#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU 342 + CHECK_TYPE_SIZE(glob_t); 343 + CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc); 344 + CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv); 345 + @@ -1023,6 +1028,7 @@ CHECK_TYPE_SIZE(iovec); 346 + CHECK_SIZE_AND_OFFSET(iovec, iov_base); 347 + CHECK_SIZE_AND_OFFSET(iovec, iov_len); 348 + 349 + +#if !SANITIZER_NONGNU 350 + CHECK_TYPE_SIZE(msghdr); 351 + CHECK_SIZE_AND_OFFSET(msghdr, msg_name); 352 + CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen); 353 + @@ -1036,6 +1042,7 @@ CHECK_TYPE_SIZE(cmsghdr); 354 + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len); 355 + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level); 356 + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); 357 + +#endif 358 + 359 + #ifndef __GLIBC_PREREQ 360 + #define __GLIBC_PREREQ(x, y) 0 361 + @@ -1145,7 +1152,7 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno); 362 + 363 + CHECK_TYPE_SIZE(ether_addr); 364 + 365 + -#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 366 + +#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU 367 + CHECK_TYPE_SIZE(ipc_perm); 368 + # if SANITIZER_FREEBSD 369 + CHECK_SIZE_AND_OFFSET(ipc_perm, key); 370 + @@ -1206,7 +1213,7 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr); 371 + CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data); 372 + #endif 373 + 374 + -#if SANITIZER_LINUX 375 + +#if SANITIZER_LINUX && !SANITIZER_NONGNU 376 + COMPILER_CHECK(sizeof(__sanitizer_mallinfo) == sizeof(struct mallinfo)); 377 + #endif 378 + 379 + @@ -1256,7 +1263,7 @@ COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE); 380 + COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE); 381 + #endif 382 + 383 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 384 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 385 + COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE)); 386 + CHECK_SIZE_AND_OFFSET(FILE, _flags); 387 + CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr); 388 + @@ -1275,7 +1282,7 @@ CHECK_SIZE_AND_OFFSET(FILE, _chain); 389 + CHECK_SIZE_AND_OFFSET(FILE, _fileno); 390 + #endif 391 + 392 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 393 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 394 + COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk)); 395 + CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit); 396 + CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev); 397 + diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc 398 + index de989b780..51a97b554 100644 399 + --- a/lib/tsan/rtl/tsan_platform_linux.cc 400 + +++ b/lib/tsan/rtl/tsan_platform_linux.cc 401 + @@ -294,7 +294,7 @@ void InitializePlatform() { 402 + // This is required to properly "close" the fds, because we do not see internal 403 + // closes within glibc. The code is a pure hack. 404 + int ExtractResolvFDs(void *state, int *fds, int nfd) { 405 + -#if SANITIZER_LINUX && !SANITIZER_ANDROID 406 + +#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU 407 + int cnt = 0; 408 + struct __res_state *statp = (struct __res_state*)state; 409 + for (int i = 0; i < MAXNS && cnt < nfd; i++) { 410 + -- 411 + 2.19.0 412 +
+270
pkgs/development/compilers/llvm/git/default.nix
··· 1 + { lowPrio, newScope, pkgs, lib, stdenv, cmake 2 + , gccForLibs, preLibcCrossHeaders 3 + , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith 4 + , buildLlvmTools # tools, but from the previous stage, for cross 5 + , targetLlvmLibraries # libraries, but from the next stage, for cross 6 + # This is the default binutils, but with *this* version of LLD rather 7 + # than the default LLVM verion's, if LLD is the choice. We use these for 8 + # the `useLLVM` bootstrapping below. 9 + , bootBintoolsNoLibc ? 10 + if stdenv.targetPlatform.linker == "lld" 11 + then null 12 + else pkgs.bintoolsNoLibc 13 + , bootBintools ? 14 + if stdenv.targetPlatform.linker == "lld" 15 + then null 16 + else pkgs.bintools 17 + , darwin 18 + }: 19 + 20 + let 21 + release_version = "12.0.0"; 22 + candidate = ""; # empty or "rcN" 23 + dash-candidate = lib.optionalString (candidate != "") "-${candidate}"; 24 + version = "${release_version}${dash-candidate}"; # differentiating these (variables) is important for RCs 25 + targetConfig = stdenv.targetPlatform.config; 26 + 27 + fetch = name: sha256: fetchurl { 28 + url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/${name}-${release_version}${candidate}.src.tar.xz"; 29 + inherit sha256; 30 + }; 31 + 32 + clang-tools-extra_src = fetch "clang-tools-extra" "0p3dzr0qa7mar83y66xa5m5apynf6ia0lsdsq6axwnm64ysy0hdd"; 33 + 34 + llvm_meta = { 35 + license = lib.licenses.ncsa; 36 + maintainers = with lib.maintainers; [ lovek323 raskin dtzWill primeos ]; 37 + platforms = lib.platforms.all; 38 + }; 39 + 40 + tools = lib.makeExtensible (tools: let 41 + callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; }); 42 + mkExtraBuildCommands0 = cc: '' 43 + rsrc="$out/resource-root" 44 + mkdir "$rsrc" 45 + ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc" 46 + echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags 47 + ''; 48 + mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + '' 49 + ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" 50 + ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share" 51 + ''; 52 + 53 + bintoolsNoLibc' = 54 + if bootBintoolsNoLibc == null 55 + then tools.bintoolsNoLibc 56 + else bootBintoolsNoLibc; 57 + bintools' = 58 + if bootBintools == null 59 + then tools.bintools 60 + else bootBintools; 61 + 62 + in { 63 + 64 + libllvm = callPackage ./llvm { 65 + inherit llvm_meta; 66 + }; 67 + 68 + # `llvm` historically had the binaries. When choosing an output explicitly, 69 + # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get* 70 + llvm = tools.libllvm.out // { outputUnspecified = true; }; 71 + 72 + libclang = callPackage ./clang { 73 + inherit clang-tools-extra_src llvm_meta; 74 + }; 75 + 76 + clang-unwrapped = tools.libclang.out // { outputUnspecified = true; }; 77 + 78 + # disabled until recommonmark supports sphinx 3 79 + #Llvm-manpages = lowPrio (tools.libllvm.override { 80 + # enableManpages = true; 81 + # python3 = pkgs.python3; # don't use python-boot 82 + #}); 83 + 84 + clang-manpages = lowPrio (tools.libclang.override { 85 + enableManpages = true; 86 + python3 = pkgs.python3; # don't use python-boot 87 + }); 88 + 89 + # disabled until recommonmark supports sphinx 3 90 + # lldb-manpages = lowPrio (tools.lldb.override { 91 + # enableManpages = true; 92 + # python3 = pkgs.python3; # don't use python-boot 93 + # }); 94 + 95 + clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang; 96 + 97 + libstdcxxClang = wrapCCWith rec { 98 + cc = tools.clang-unwrapped; 99 + # libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper. 100 + libcxx = null; 101 + extraPackages = [ 102 + targetLlvmLibraries.compiler-rt 103 + ]; 104 + extraBuildCommands = mkExtraBuildCommands cc; 105 + }; 106 + 107 + libcxxClang = wrapCCWith rec { 108 + cc = tools.clang-unwrapped; 109 + libcxx = targetLlvmLibraries.libcxx; 110 + extraPackages = [ 111 + targetLlvmLibraries.libcxxabi 112 + targetLlvmLibraries.compiler-rt 113 + ]; 114 + extraBuildCommands = mkExtraBuildCommands cc; 115 + }; 116 + 117 + lld = callPackage ./lld { 118 + inherit llvm_meta; 119 + inherit (libraries) libunwind; 120 + }; 121 + 122 + lldb = callPackage ./lldb { 123 + inherit llvm_meta; 124 + inherit (darwin) libobjc bootstrap_cmds; 125 + inherit (darwin.apple_sdk.libs) xpc; 126 + inherit (darwin.apple_sdk.frameworks) Foundation Carbon Cocoa; 127 + }; 128 + 129 + # Below, is the LLVM bootstrapping logic. It handles building a 130 + # fully LLVM toolchain from scratch. No GCC toolchain should be 131 + # pulled in. As a consequence, it is very quick to build different 132 + # targets provided by LLVM and we can also build for what GCC 133 + # doesn’t support like LLVM. Probably we should move to some other 134 + # file. 135 + 136 + bintools-unwrapped = callPackage ./bintools {}; 137 + 138 + bintoolsNoLibc = wrapBintoolsWith { 139 + bintools = tools.bintools-unwrapped; 140 + libc = preLibcCrossHeaders; 141 + }; 142 + 143 + bintools = wrapBintoolsWith { 144 + bintools = tools.bintools-unwrapped; 145 + }; 146 + 147 + clangUseLLVM = wrapCCWith rec { 148 + cc = tools.clang-unwrapped; 149 + libcxx = targetLlvmLibraries.libcxx; 150 + bintools = bintools'; 151 + extraPackages = [ 152 + targetLlvmLibraries.libcxxabi 153 + targetLlvmLibraries.compiler-rt 154 + ] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [ 155 + targetLlvmLibraries.libunwind 156 + ]; 157 + extraBuildCommands = '' 158 + echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags 159 + echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 160 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' 161 + echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags 162 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' 163 + echo "-lunwind" >> $out/nix-support/cc-ldflags 164 + '' + lib.optionalString stdenv.targetPlatform.isWasm '' 165 + echo "-fno-exceptions" >> $out/nix-support/cc-cflags 166 + '' + mkExtraBuildCommands cc; 167 + }; 168 + 169 + clangNoLibcxx = wrapCCWith rec { 170 + cc = tools.clang-unwrapped; 171 + libcxx = null; 172 + bintools = bintools'; 173 + extraPackages = [ 174 + targetLlvmLibraries.compiler-rt 175 + ]; 176 + extraBuildCommands = '' 177 + echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags 178 + echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 179 + echo "-nostdlib++" >> $out/nix-support/cc-cflags 180 + '' + mkExtraBuildCommands cc; 181 + }; 182 + 183 + clangNoLibc = wrapCCWith rec { 184 + cc = tools.clang-unwrapped; 185 + libcxx = null; 186 + bintools = bintoolsNoLibc'; 187 + extraPackages = [ 188 + targetLlvmLibraries.compiler-rt 189 + ]; 190 + extraBuildCommands = '' 191 + echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags 192 + echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 193 + '' + mkExtraBuildCommands cc; 194 + }; 195 + 196 + clangNoCompilerRt = wrapCCWith rec { 197 + cc = tools.clang-unwrapped; 198 + libcxx = null; 199 + bintools = bintoolsNoLibc'; 200 + extraPackages = [ ]; 201 + extraBuildCommands = '' 202 + echo "-nostartfiles" >> $out/nix-support/cc-cflags 203 + '' + mkExtraBuildCommands0 cc; 204 + }; 205 + 206 + clangNoCompilerRtWithLibc = wrapCCWith rec { 207 + cc = tools.clang-unwrapped; 208 + libcxx = null; 209 + bintools = bintools'; 210 + extraPackages = [ ]; 211 + extraBuildCommands = mkExtraBuildCommands0 cc; 212 + }; 213 + 214 + }); 215 + 216 + libraries = lib.makeExtensible (libraries: let 217 + callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; }); 218 + in { 219 + 220 + compiler-rt-libc = callPackage ./compiler-rt { 221 + inherit llvm_meta; 222 + stdenv = if stdenv.hostPlatform.useLLVM or false 223 + then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc 224 + else stdenv; 225 + }; 226 + 227 + compiler-rt-no-libc = callPackage ./compiler-rt { 228 + inherit llvm_meta; 229 + stdenv = if stdenv.hostPlatform.useLLVM or false 230 + then overrideCC stdenv buildLlvmTools.clangNoCompilerRt 231 + else stdenv; 232 + }; 233 + 234 + # N.B. condition is safe because without useLLVM both are the same. 235 + compiler-rt = if stdenv.hostPlatform.isAndroid 236 + then libraries.compiler-rt-libc 237 + else libraries.compiler-rt-no-libc; 238 + 239 + stdenv = overrideCC stdenv buildLlvmTools.clang; 240 + 241 + libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang; 242 + 243 + libcxx = callPackage ./libcxx { 244 + inherit llvm_meta; 245 + stdenv = if stdenv.hostPlatform.useLLVM or false 246 + then overrideCC stdenv buildLlvmTools.clangNoLibcxx 247 + else stdenv; 248 + }; 249 + 250 + libcxxabi = callPackage ./libcxxabi { 251 + inherit llvm_meta; 252 + stdenv = if stdenv.hostPlatform.useLLVM or false 253 + then overrideCC stdenv buildLlvmTools.clangNoLibcxx 254 + else stdenv; 255 + }; 256 + 257 + libunwind = callPackage ./libunwind { 258 + inherit llvm_meta; 259 + inherit (buildLlvmTools) llvm; 260 + stdenv = if stdenv.hostPlatform.useLLVM or false 261 + then overrideCC stdenv buildLlvmTools.clangNoLibcxx 262 + else stdenv; 263 + }; 264 + 265 + openmp = callPackage ./openmp { 266 + inherit llvm_meta; 267 + }; 268 + }); 269 + 270 + in { inherit tools libraries; } // libraries // tools
+60
pkgs/development/compilers/llvm/git/libcxx/default.nix
··· 1 + { lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version 2 + , enableShared ? !stdenv.hostPlatform.isStatic 3 + }: 4 + 5 + stdenv.mkDerivation { 6 + pname = "libcxx"; 7 + inherit version; 8 + 9 + src = fetch "libcxx" "1wf3ww29xkx7prs7pdwicy5qqfapib26110jgmkjrbka9z57bjvx"; 10 + 11 + postUnpack = '' 12 + unpackFile ${libcxxabi.src} 13 + mv libcxxabi-* libcxxabi 14 + unpackFile ${llvm.src} 15 + mv llvm-* llvm 16 + ''; 17 + 18 + outputs = [ "out" "dev" ]; 19 + 20 + patches = [ 21 + ./gnu-install-dirs.patch 22 + ] ++ lib.optionals stdenv.hostPlatform.isMusl [ 23 + ../../libcxx-0001-musl-hacks.patch 24 + ]; 25 + 26 + preConfigure = lib.optionalString stdenv.hostPlatform.isMusl '' 27 + patchShebangs utils/cat_files.py 28 + ''; 29 + 30 + nativeBuildInputs = [ cmake python3 ] 31 + ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; 32 + 33 + buildInputs = [ libcxxabi ]; 34 + 35 + cmakeFlags = [ 36 + "-DLIBCXX_CXX_ABI=libcxxabi" 37 + ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" 38 + ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON" 39 + ++ lib.optional stdenv.hostPlatform.isWasm [ 40 + "-DLIBCXX_ENABLE_THREADS=OFF" 41 + "-DLIBCXX_ENABLE_FILESYSTEM=OFF" 42 + "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" 43 + ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; 44 + 45 + passthru = { 46 + isLLVM = true; 47 + }; 48 + 49 + meta = llvm_meta // { 50 + homepage = "https://libcxx.llvm.org/"; 51 + description = "C++ standard library"; 52 + longDescription = '' 53 + libc++ is an implementation of the C++ standard library, targeting C++11, 54 + C++14 and above. 55 + ''; 56 + # "All of the code in libc++ is dual licensed under the MIT license and the 57 + # UIUC License (a BSD-like license)": 58 + license = with lib.licenses; [ mit ncsa ]; 59 + }; 60 + }
+100
pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index 9bf1a02f0908..612cd4aab76c 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -28,6 +28,8 @@ set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") 6 + if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD) 7 + project(libcxx CXX C) 8 + 9 + + include(GNUInstallDirs) 10 + + 11 + set(PACKAGE_NAME libcxx) 12 + set(PACKAGE_VERSION 12.0.0) 13 + set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") 14 + @@ -402,7 +404,7 @@ endif () 15 + if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) 16 + set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 17 + set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) 18 + - set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 19 + + set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 20 + if(LIBCXX_LIBDIR_SUBDIR) 21 + string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) 22 + string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) 23 + @@ -410,11 +412,11 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) 24 + elseif(LLVM_LIBRARY_OUTPUT_INTDIR) 25 + set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) 26 + set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) 27 + - set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) 28 + + set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}) 29 + else() 30 + set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) 31 + set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR}) 32 + - set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) 33 + + set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}) 34 + endif() 35 + 36 + file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") 37 + diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake 38 + index 5d2764e870e9..bb1ec5de6ca2 100644 39 + --- a/cmake/Modules/HandleLibCXXABI.cmake 40 + +++ b/cmake/Modules/HandleLibCXXABI.cmake 41 + @@ -63,7 +63,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs) 42 + 43 + if (LIBCXX_INSTALL_HEADERS) 44 + install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}" 45 + - DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir} 46 + + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir} 47 + COMPONENT cxx-headers 48 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ 49 + ) 50 + diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt 51 + index 29a317b8ae9a..4747263cfd1b 100644 52 + --- a/include/CMakeLists.txt 53 + +++ b/include/CMakeLists.txt 54 + @@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS) 55 + foreach(file ${files}) 56 + get_filename_component(dir ${file} DIRECTORY) 57 + install(FILES ${file} 58 + - DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} 59 + + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir} 60 + COMPONENT cxx-headers 61 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ 62 + ) 63 + @@ -260,7 +260,7 @@ if (LIBCXX_INSTALL_HEADERS) 64 + 65 + # Install the generated header as __config. 66 + install(FILES ${LIBCXX_BINARY_DIR}/__generated_config 67 + - DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 68 + + DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1 69 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ 70 + RENAME __config 71 + COMPONENT cxx-headers) 72 + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt 73 + index 9965104cb5b2..9b55dbb1d822 100644 74 + --- a/src/CMakeLists.txt 75 + +++ b/src/CMakeLists.txt 76 + @@ -352,21 +352,21 @@ if (LIBCXX_INSTALL_SHARED_LIBRARY) 77 + install(TARGETS cxx_shared 78 + ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx 79 + LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx 80 + - RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx) 81 + + RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx) 82 + endif() 83 + 84 + if (LIBCXX_INSTALL_STATIC_LIBRARY) 85 + install(TARGETS cxx_static 86 + ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx 87 + LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx 88 + - RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx) 89 + + RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx) 90 + endif() 91 + 92 + if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) 93 + install(TARGETS cxx_experimental 94 + LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx 95 + ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx 96 + - RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx) 97 + + RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx) 98 + endif() 99 + 100 + # NOTE: This install command must go after the cxx install command otherwise
+77
pkgs/development/compilers/llvm/git/libcxxabi/default.nix
··· 1 + { lib, stdenv, llvm_meta, cmake, python3, fetch, libcxx, libunwind, llvm, version 2 + , enableShared ? !stdenv.hostPlatform.isStatic 3 + }: 4 + 5 + stdenv.mkDerivation { 6 + pname = "libcxxabi"; 7 + inherit version; 8 + 9 + src = fetch "libcxxabi" "1cbmzspwjlr8f6sp73pw6ivf4dpg6rpc61by0q1m2zca2k6yif3a"; 10 + 11 + outputs = [ "out" "dev" ]; 12 + 13 + postUnpack = '' 14 + unpackFile ${libcxx.src} 15 + mv libcxx-* libcxx 16 + unpackFile ${llvm.src} 17 + mv llvm-* llvm 18 + '' + lib.optionalString stdenv.isDarwin '' 19 + export TRIPLE=x86_64-apple-darwin 20 + '' + lib.optionalString stdenv.hostPlatform.isMusl '' 21 + patch -p1 -d libcxx -i ${../../libcxx-0001-musl-hacks.patch} 22 + '' + lib.optionalString stdenv.hostPlatform.isWasm '' 23 + patch -p1 -d llvm -i ${./wasm.patch} 24 + ''; 25 + 26 + patches = [ 27 + ./gnu-install-dirs.patch 28 + ]; 29 + 30 + nativeBuildInputs = [ cmake python3 ]; 31 + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; 32 + 33 + cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ 34 + "-DLLVM_ENABLE_LIBCXX=ON" 35 + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" 36 + ] ++ lib.optionals stdenv.hostPlatform.isWasm [ 37 + "-DLIBCXXABI_ENABLE_THREADS=OFF" 38 + "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" 39 + ] ++ lib.optionals (!enableShared) [ 40 + "-DLIBCXXABI_ENABLE_SHARED=OFF" 41 + ]; 42 + 43 + installPhase = if stdenv.isDarwin 44 + then '' 45 + for file in lib/*.dylib; do 46 + # this should be done in CMake, but having trouble figuring out 47 + # the magic combination of necessary CMake variables 48 + # if you fancy a try, take a look at 49 + # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling 50 + install_name_tool -id $out/$file $file 51 + done 52 + make install 53 + install -d 755 $out/include 54 + install -m 644 ../include/*.h $out/include 55 + '' 56 + else '' 57 + install -d -m 755 $out/include $out/lib 58 + install -m 644 lib/libc++abi.a $out/lib 59 + install -m 644 ../include/cxxabi.h $out/include 60 + '' + lib.optionalString enableShared '' 61 + install -m 644 lib/libc++abi.so.1.0 $out/lib 62 + ln -s libc++abi.so.1.0 $out/lib/libc++abi.so 63 + ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 64 + ''; 65 + 66 + meta = llvm_meta // { 67 + homepage = "https://libcxxabi.llvm.org/"; 68 + description = "Provides C++ standard library support"; 69 + longDescription = '' 70 + libc++abi is a new implementation of low level support for a standard C++ library. 71 + ''; 72 + # "All of the code in libc++abi is dual licensed under the MIT license and 73 + # the UIUC License (a BSD-like license)": 74 + license = with lib.licenses; [ mit ncsa ]; 75 + maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ]; 76 + }; 77 + }
+34
pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index 426c855288fc..a9812a994f53 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -27,6 +27,8 @@ set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH 6 + if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD) 7 + project(libcxxabi CXX C) 8 + 9 + + include(GNUInstallDirs) 10 + + 11 + set(PACKAGE_NAME libcxxabi) 12 + set(PACKAGE_VERSION 11.0.0) 13 + set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") 14 + @@ -180,17 +182,17 @@ set(CMAKE_MODULE_PATH 15 + 16 + if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) 17 + set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 18 + - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 19 + + set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 20 + if(LIBCXX_LIBDIR_SUBDIR) 21 + string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) 22 + string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) 23 + endif() 24 + elseif(LLVM_LIBRARY_OUTPUT_INTDIR) 25 + set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) 26 + - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX}) 27 + + set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX}) 28 + else() 29 + set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX}) 30 + - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX}) 31 + + set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX}) 32 + endif() 33 + 34 + set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.")
+16
pkgs/development/compilers/llvm/git/libcxxabi/wasm.patch
··· 1 + diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake 2 + index 15497d405e0..33f7f18193a 100644 3 + --- a/cmake/modules/HandleLLVMOptions.cmake 4 + +++ b/cmake/modules/HandleLLVMOptions.cmake 5 + @@ -127,7 +127,10 @@ else(WIN32) 6 + set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) 7 + endif() 8 + else(FUCHSIA OR UNIX) 9 + - MESSAGE(SEND_ERROR "Unable to determine platform") 10 + + if(${CMAKE_SYSTEM_NAME} MATCHES "Wasi") 11 + + else() 12 + + MESSAGE(SEND_ERROR "Unable to determine platform") 13 + + endif() 14 + endif(FUCHSIA OR UNIX) 15 + endif(WIN32) 16 +
+39
pkgs/development/compilers/llvm/git/libunwind/default.nix
··· 1 + { lib, stdenv, llvm_meta, version, fetch, libcxx, llvm, cmake 2 + , enableShared ? !stdenv.hostPlatform.isStatic 3 + }: 4 + 5 + stdenv.mkDerivation rec { 6 + pname = "libunwind"; 7 + inherit version; 8 + 9 + src = fetch pname "1x8wpmsrsgnwj2v5ih52ylni7r6n8gzkcj6hx65zbxski2rablly"; 10 + 11 + postUnpack = '' 12 + unpackFile ${libcxx.src} 13 + mv libcxx-* libcxx 14 + unpackFile ${llvm.src} 15 + mv llvm-* llvm 16 + ''; 17 + 18 + patches = [ 19 + ./gnu-install-dirs.patch 20 + ]; 21 + 22 + outputs = [ "out" "dev" ]; 23 + 24 + nativeBuildInputs = [ cmake ]; 25 + 26 + cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; 27 + 28 + meta = llvm_meta // { 29 + # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst 30 + homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; 31 + description = "LLVM's unwinder library"; 32 + longDescription = '' 33 + The unwind library provides a family of _Unwind_* functions implementing 34 + the language-neutral stack unwinding portion of the Itanium C++ ABI (Level 35 + I). It is a dependency of the C++ ABI library, and sometimes is a 36 + dependency of other runtimes. 37 + ''; 38 + }; 39 + }
+34
pkgs/development/compilers/llvm/git/libunwind/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index 48cb8e004e08..fec8144fb95a 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -23,6 +23,8 @@ set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH 6 + if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD) 7 + project(libunwind LANGUAGES C CXX ASM) 8 + 9 + + include(GNUInstallDirs) 10 + + 11 + set(PACKAGE_NAME libunwind) 12 + set(PACKAGE_VERSION 12.0.0) 13 + set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") 14 + @@ -115,17 +117,17 @@ set(CMAKE_MODULE_PATH 15 + 16 + if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) 17 + set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 18 + - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 19 + + set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) 20 + if(LIBCXX_LIBDIR_SUBDIR) 21 + string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) 22 + string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) 23 + endif() 24 + elseif(LLVM_LIBRARY_OUTPUT_INTDIR) 25 + set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) 26 + - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX}) 27 + + set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX}) 28 + else() 29 + set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) 30 + - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX}) 31 + + set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX}) 32 + endif() 33 + 34 + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
+51
pkgs/development/compilers/llvm/git/lld/default.nix
··· 1 + { lib, stdenv, llvm_meta 2 + , buildLlvmTools 3 + , fetch 4 + , libunwind 5 + , cmake 6 + , libxml2 7 + , libllvm 8 + , version 9 + }: 10 + 11 + stdenv.mkDerivation rec { 12 + pname = "lld"; 13 + inherit version; 14 + 15 + src = fetch pname "1zakyxk5bwnh7jarckcd4rbmzi58jgn2dbah5j5cwcyfyfbx9drc"; 16 + 17 + patches = [ 18 + ./gnu-install-dirs.patch 19 + ]; 20 + 21 + postPatch = '' 22 + substituteInPlace MachO/CMakeLists.txt --replace \ 23 + '(''${LLVM_MAIN_SRC_DIR}/' '(' 24 + mkdir -p libunwind/include 25 + tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/" 26 + ''; 27 + 28 + nativeBuildInputs = [ cmake ]; 29 + buildInputs = [ libllvm libxml2 ]; 30 + 31 + cmakeFlags = [ 32 + "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}" 33 + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 34 + "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" 35 + ]; 36 + 37 + outputs = [ "out" "lib" "dev" ]; 38 + 39 + meta = llvm_meta // { 40 + homepage = "https://lld.llvm.org/"; 41 + description = "The LLVM linker"; 42 + longDescription = '' 43 + LLD is a linker from the LLVM project that is a drop-in replacement for 44 + system linkers and runs much faster than them. It also provides features 45 + that are useful for toolchain developers. 46 + The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and 47 + WebAssembly in descending order of completeness. Internally, LLD consists 48 + of several different linkers. 49 + ''; 50 + }; 51 + }
+68
pkgs/development/compilers/llvm/git/lld/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index d4e561b50d8f..cfa5bdd79c2a 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 6 + set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 + set(LLD_BUILT_STANDALONE TRUE) 8 + 9 + + include(GNUInstallDirs) 10 + + 11 + find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary") 12 + if(NOT LLVM_CONFIG_PATH) 13 + message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH") 14 + @@ -179,7 +181,7 @@ include_directories(BEFORE 15 + 16 + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 17 + install(DIRECTORY include/ 18 + - DESTINATION include 19 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 20 + FILES_MATCHING 21 + PATTERN "*.h" 22 + ) 23 + diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake 24 + index 23df41312403..d62372c88de7 100644 25 + --- a/cmake/modules/AddLLD.cmake 26 + +++ b/cmake/modules/AddLLD.cmake 27 + @@ -20,9 +20,9 @@ macro(add_lld_library name) 28 + install(TARGETS ${name} 29 + COMPONENT ${name} 30 + ${export_to_lldtargets} 31 + - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} 32 + - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} 33 + - RUNTIME DESTINATION bin) 34 + + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} 35 + + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} 36 + + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 37 + 38 + if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES) 39 + add_llvm_install_targets(install-${name} 40 + @@ -54,7 +54,7 @@ macro(add_lld_tool name) 41 + 42 + install(TARGETS ${name} 43 + ${export_to_lldtargets} 44 + - RUNTIME DESTINATION bin 45 + + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 46 + COMPONENT ${name}) 47 + 48 + if(NOT CMAKE_CONFIGURATION_TYPES) 49 + @@ -69,5 +69,5 @@ endmacro() 50 + macro(add_lld_symlink name dest) 51 + add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE) 52 + # Always generate install targets 53 + - llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE) 54 + + llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE) 55 + endmacro() 56 + diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt 57 + index 5cff736ff57f..64e775c771b9 100644 58 + --- a/tools/lld/CMakeLists.txt 59 + +++ b/tools/lld/CMakeLists.txt 60 + @@ -21,7 +21,7 @@ target_link_libraries(lld 61 + ) 62 + 63 + install(TARGETS lld 64 + - RUNTIME DESTINATION bin) 65 + + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 66 + 67 + if(NOT LLD_SYMLINKS_TO_CREATE) 68 + set(LLD_SYMLINKS_TO_CREATE
+130
pkgs/development/compilers/llvm/git/lldb/default.nix
··· 1 + { lib, stdenv, llvm_meta 2 + , runCommand 3 + , fetch 4 + , cmake 5 + , zlib 6 + , ncurses 7 + , swig 8 + , which 9 + , libedit 10 + , libxml2 11 + , libllvm 12 + , libclang 13 + , python3 14 + , version 15 + , libobjc 16 + , xpc 17 + , Foundation 18 + , bootstrap_cmds 19 + , Carbon 20 + , Cocoa 21 + , lit 22 + , enableManpages ? false 23 + }: 24 + 25 + stdenv.mkDerivation (rec { 26 + pname = "lldb"; 27 + inherit version; 28 + 29 + src = fetch pname "1v85qyq3snk81vjmwq5q7xikyyqsfpqy2c4qmr81mps4avsw1g0l"; 30 + 31 + patches = [ 32 + ./procfs.patch 33 + (runCommand "resource-dir.patch" { 34 + clangLibDir = "${libclang.lib}/lib"; 35 + } '' 36 + substitute '${./resource-dir.patch}' "$out" --subst-var clangLibDir 37 + '') 38 + ./gnu-install-dirs.patch 39 + ]; 40 + 41 + outputs = [ "out" "lib" "dev" ]; 42 + 43 + nativeBuildInputs = [ 44 + cmake python3 which swig lit 45 + ] ++ lib.optionals enableManpages [ 46 + python3.pkgs.sphinx python3.pkgs.recommonmark 47 + ]; 48 + 49 + buildInputs = [ 50 + ncurses 51 + zlib 52 + libedit 53 + libxml2 54 + libllvm 55 + ] 56 + ++ lib.optionals stdenv.isDarwin [ 57 + libobjc 58 + xpc 59 + Foundation 60 + bootstrap_cmds 61 + Carbon 62 + Cocoa 63 + ]; 64 + 65 + hardeningDisable = [ "format" ]; 66 + 67 + cmakeFlags = [ 68 + "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}" 69 + "-DLLVM_ENABLE_RTTI=OFF" 70 + "-DClang_DIR=${libclang.dev}/lib/cmake" 71 + "-DLLVM_EXTERNAL_LIT=${lit}/bin/lit" 72 + ] ++ lib.optionals stdenv.isDarwin [ 73 + "-DLLDB_USE_SYSTEM_DEBUGSERVER=ON" 74 + ] ++ lib.optionals (!stdenv.isDarwin) [ 75 + "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic 76 + ] ++ lib.optionals enableManpages [ 77 + "-DLLVM_ENABLE_SPHINX=ON" 78 + "-DSPHINX_OUTPUT_MAN=ON" 79 + "-DSPHINX_OUTPUT_HTML=OFF" 80 + ] ++ lib.optionals doCheck [ 81 + "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" 82 + "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++" 83 + ]; 84 + 85 + doCheck = false; 86 + 87 + postInstall = '' 88 + # Editor support 89 + # vscode: 90 + install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json 91 + mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin 92 + ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin 93 + ''; 94 + 95 + meta = llvm_meta // { 96 + homepage = "https://lldb.llvm.org/"; 97 + description = "A next-generation high-performance debugger"; 98 + longDescription = '' 99 + LLDB is a next generation, high-performance debugger. It is built as a set 100 + of reusable components which highly leverage existing libraries in the 101 + larger LLVM Project, such as the Clang expression parser and LLVM 102 + disassembler. 103 + ''; 104 + }; 105 + } // lib.optionalAttrs enableManpages { 106 + pname = "lldb-manpages"; 107 + 108 + buildPhase = '' 109 + make docs-lldb-man 110 + ''; 111 + 112 + propagatedBuildInputs = []; 113 + 114 + # manually install lldb man page 115 + installPhase = '' 116 + mkdir -p $out/share/man/man1 117 + install docs/man/lldb.1 -t $out/share/man/man1/ 118 + ''; 119 + 120 + postPatch = null; 121 + postInstall = null; 122 + 123 + outputs = [ "out" ]; 124 + 125 + doCheck = false; 126 + 127 + meta = llvm_meta // { 128 + description = "man pages for LLDB ${version}"; 129 + }; 130 + })
+65
pkgs/development/compilers/llvm/git/lldb/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index b5633e21c56a..f2f1035e9238 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -10,6 +10,8 @@ set(CMAKE_MODULE_PATH 6 + # If we are not building as part of LLVM, build LLDB as a standalone project, 7 + # using LLVM as an external library. 8 + if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) 9 + + include(GNUInstallDirs) 10 + + 11 + project(lldb) 12 + include(LLDBStandalone) 13 + 14 + diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake 15 + index 4ed5c647c5d2..89f96e710d55 100644 16 + --- a/cmake/modules/AddLLDB.cmake 17 + +++ b/cmake/modules/AddLLDB.cmake 18 + @@ -107,13 +107,13 @@ function(add_lldb_library name) 19 + endif() 20 + 21 + if(PARAM_SHARED) 22 + - set(install_dest lib${LLVM_LIBDIR_SUFFIX}) 23 + + set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) 24 + if(PARAM_INSTALL_PREFIX) 25 + set(install_dest ${PARAM_INSTALL_PREFIX}) 26 + endif() 27 + # RUNTIME is relevant for DLL platforms, FRAMEWORK for macOS 28 + install(TARGETS ${name} COMPONENT ${name} 29 + - RUNTIME DESTINATION bin 30 + + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 31 + LIBRARY DESTINATION ${install_dest} 32 + ARCHIVE DESTINATION ${install_dest} 33 + FRAMEWORK DESTINATION ${install_dest}) 34 + diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake 35 + index 2fdf1502d055..37364341ff8b 100644 36 + --- a/cmake/modules/LLDBConfig.cmake 37 + +++ b/cmake/modules/LLDBConfig.cmake 38 + @@ -225,7 +225,7 @@ include_directories(BEFORE 39 + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 40 + install(DIRECTORY include/ 41 + COMPONENT lldb-headers 42 + - DESTINATION include 43 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 44 + FILES_MATCHING 45 + PATTERN "*.h" 46 + PATTERN ".cmake" EXCLUDE 47 + @@ -233,7 +233,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 48 + 49 + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ 50 + COMPONENT lldb-headers 51 + - DESTINATION include 52 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 53 + FILES_MATCHING 54 + PATTERN "*.h" 55 + PATTERN ".cmake" EXCLUDE 56 + diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt 57 + index 734167e51bc5..f95761b5df58 100644 58 + --- a/tools/intel-features/CMakeLists.txt 59 + +++ b/tools/intel-features/CMakeLists.txt 60 + @@ -65,4 +65,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT) 61 + endif() 62 + 63 + install(TARGETS lldbIntelFeatures 64 + - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 65 + + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+31
pkgs/development/compilers/llvm/git/lldb/procfs.patch
··· 1 + --- a/source/Plugins/Process/Linux/Procfs.h 2 + +++ b/source/Plugins/Process/Linux/Procfs.h 3 + @@ -11,21 +11,12 @@ 4 + // sys/procfs.h on Android/Linux for all supported architectures. 5 + 6 + #include <sys/ptrace.h> 7 + +#include <asm/ptrace.h> 8 + 9 + -#ifdef __ANDROID__ 10 + -#if defined(__arm64__) || defined(__aarch64__) 11 + -typedef unsigned long elf_greg_t; 12 + -typedef elf_greg_t 13 + - elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))]; 14 + -typedef struct user_fpsimd_state elf_fpregset_t; 15 + -#ifndef NT_FPREGSET 16 + -#define NT_FPREGSET NT_PRFPREG 17 + -#endif // NT_FPREGSET 18 + -#elif defined(__mips__) 19 + -#ifndef NT_FPREGSET 20 + -#define NT_FPREGSET NT_PRFPREG 21 + -#endif // NT_FPREGSET 22 + -#endif 23 + -#else // __ANDROID__ 24 + +#if !defined(__GLIBC__) && defined(__powerpc__) 25 + +#define pt_regs musl_pt_regs 26 + +#include <sys/procfs.h> 27 + +#undef pt_regs 28 + +#else 29 + #include <sys/procfs.h> 30 + -#endif // __ANDROID__ 31 + +#endif
+13
pkgs/development/compilers/llvm/git/lldb/resource-dir.patch
··· 1 + diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake 2 + index 37364341ff8b..7f74c1a3e257 100644 3 + --- a/cmake/modules/LLDBConfig.cmake 4 + +++ b/cmake/modules/LLDBConfig.cmake 5 + @@ -257,7 +257,7 @@ if (NOT TARGET clang-resource-headers) 6 + # Iterate over the possible places where the external resource directory 7 + # could be and pick the first that exists. 8 + foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}" 9 + - "${LLVM_BUILD_LIBRARY_DIR}" 10 + + "${LLVM_BUILD_LIBRARY_DIR}" "@clangLibDir@" 11 + "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}") 12 + # Build the resource directory path by appending 'clang/<version number>'. 13 + set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
+229
pkgs/development/compilers/llvm/git/llvm/default.nix
··· 1 + { lib, stdenv, llvm_meta 2 + , pkgsBuildBuild 3 + , fetch 4 + , fetchpatch 5 + , cmake 6 + , python3 7 + , libffi 8 + , libbfd 9 + , libpfm 10 + , libxml2 11 + , ncurses 12 + , version 13 + , release_version 14 + , zlib 15 + , buildLlvmTools 16 + , debugVersion ? false 17 + , enableManpages ? false 18 + , enableSharedLibraries ? !stdenv.hostPlatform.isStatic 19 + , enablePFM ? !(stdenv.isDarwin 20 + || stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245 21 + || stdenv.isAarch32 # broken for the armv7l builder 22 + ) 23 + , enablePolly ? false 24 + }: 25 + 26 + let 27 + inherit (lib) optional optionals optionalString; 28 + 29 + # Used when creating a version-suffixed symlink of libLLVM.dylib 30 + shortVersion = with lib; 31 + concatStringsSep "." (take 1 (splitString "." release_version)); 32 + 33 + in stdenv.mkDerivation (rec { 34 + pname = "llvm"; 35 + inherit version; 36 + 37 + src = fetch pname "0l4b79gwfvxild974aigcq1yigypjsk2j5p59syhl6ksd744gp29"; 38 + polly_src = fetch "polly" "1ixl9yj526n8iqh9ckyiah2vzravs9d1akybqq7rvy32n9vgr6hd"; 39 + 40 + unpackPhase = '' 41 + unpackFile $src 42 + mv llvm-${release_version}* llvm 43 + sourceRoot=$PWD/llvm 44 + '' + optionalString enablePolly '' 45 + unpackFile $polly_src 46 + mv polly-* $sourceRoot/tools/polly 47 + ''; 48 + 49 + outputs = [ "out" "lib" "dev" "python" ]; 50 + 51 + nativeBuildInputs = [ cmake python3 ] 52 + ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ]; 53 + 54 + buildInputs = [ libxml2 libffi ] 55 + ++ optional enablePFM libpfm; # exegesis 56 + 57 + propagatedBuildInputs = [ ncurses zlib ]; 58 + 59 + patches = [ 60 + ./gnu-install-dirs.patch 61 + # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test. 62 + (fetchpatch { 63 + name = "uops-CMOV16rm-noreg.diff"; 64 + url = "https://github.com/llvm/llvm-project/commit/9e9f991ac033.diff"; 65 + sha256 = "sha256:12s8vr6ibri8b48h2z38f3afhwam10arfiqfy4yg37bmc054p5hi"; 66 + stripLen = 1; 67 + }) 68 + ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch; 69 + 70 + postPatch = optionalString stdenv.isDarwin '' 71 + substituteInPlace cmake/modules/AddLLVM.cmake \ 72 + --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \ 73 + --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' "" 74 + '' 75 + # Patch llvm-config to return correct library path based on --link-{shared,static}. 76 + + optionalString (enableSharedLibraries) '' 77 + substitute '${./outputs.patch}' ./outputs.patch --subst-var lib 78 + patch -p1 < ./outputs.patch 79 + '' + '' 80 + # FileSystem permissions tests fail with various special bits 81 + substituteInPlace unittests/Support/CMakeLists.txt \ 82 + --replace "Path.cpp" "" 83 + rm unittests/Support/Path.cpp 84 + substituteInPlace unittests/IR/CMakeLists.txt \ 85 + --replace "PassBuilderCallbacksTest.cpp" "" 86 + rm unittests/IR/PassBuilderCallbacksTest.cpp 87 + '' + optionalString stdenv.hostPlatform.isMusl '' 88 + patch -p1 -i ${../../TLI-musl.patch} 89 + substituteInPlace unittests/Support/CMakeLists.txt \ 90 + --replace "add_subdirectory(DynamicLibrary)" "" 91 + rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp 92 + # valgrind unhappy with musl or glibc, but fails w/musl only 93 + rm test/CodeGen/AArch64/wineh4.mir 94 + '' + optionalString stdenv.hostPlatform.isAarch32 '' 95 + # skip failing X86 test cases on 32-bit ARM 96 + rm test/DebugInfo/X86/convert-debugloc.ll 97 + rm test/DebugInfo/X86/convert-inlined.ll 98 + rm test/DebugInfo/X86/convert-linked.ll 99 + rm test/tools/dsymutil/X86/op-convert.test 100 + '' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") '' 101 + # Seems to require certain floating point hardware (NEON?) 102 + rm test/ExecutionEngine/frem.ll 103 + '' + '' 104 + patchShebangs test/BugPoint/compile-custom.ll.py 105 + ''; 106 + 107 + # hacky fix: created binaries need to be run before installation 108 + preBuild = '' 109 + mkdir -p $out/ 110 + ln -sv $PWD/lib $out 111 + ''; 112 + 113 + # E.g. mesa.drivers use the build-id as a cache key (see #93946): 114 + LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1"; 115 + 116 + cmakeFlags = with stdenv; [ 117 + "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/" 118 + "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}" 119 + "-DLLVM_INSTALL_UTILS=ON" # Needed by rustc 120 + "-DLLVM_BUILD_TESTS=ON" 121 + "-DLLVM_ENABLE_FFI=ON" 122 + "-DLLVM_ENABLE_RTTI=ON" 123 + "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" 124 + "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" 125 + "-DLLVM_ENABLE_DUMP=ON" 126 + ] ++ optionals enableSharedLibraries [ 127 + "-DLLVM_LINK_LLVM_DYLIB=ON" 128 + ] ++ optionals enableManpages [ 129 + "-DLLVM_BUILD_DOCS=ON" 130 + "-DLLVM_ENABLE_SPHINX=ON" 131 + "-DSPHINX_OUTPUT_MAN=ON" 132 + "-DSPHINX_OUTPUT_HTML=OFF" 133 + "-DSPHINX_WARNINGS_AS_ERRORS=OFF" 134 + ] ++ optionals (!isDarwin) [ 135 + "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" 136 + ] ++ optionals isDarwin [ 137 + "-DLLVM_ENABLE_LIBCXX=ON" 138 + "-DCAN_TARGET_i386=false" 139 + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 140 + "-DCMAKE_CROSSCOMPILING=True" 141 + "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen" 142 + ( 143 + let 144 + nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc; 145 + nativeBintools = nativeCC.bintools.bintools; 146 + nativeToolchainFlags = [ 147 + "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc" 148 + "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++" 149 + "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar" 150 + "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip" 151 + "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib" 152 + ]; 153 + in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}" 154 + ) 155 + ]; 156 + 157 + postBuild = '' 158 + rm -fR $out 159 + ''; 160 + 161 + preCheck = '' 162 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib 163 + ''; 164 + 165 + postInstall = '' 166 + mkdir -p $python/share 167 + mv $out/share/opt-viewer $python/share/opt-viewer 168 + moveToOutput "bin/llvm-config*" "$dev" 169 + substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ 170 + --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \ 171 + --replace "$out/bin/llvm-config" "$dev/bin/llvm-config" 172 + substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \ 173 + --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")' 174 + '' 175 + + optionalString (stdenv.isDarwin && enableSharedLibraries) '' 176 + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib 177 + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib 178 + '' 179 + + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' 180 + cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native 181 + ''; 182 + 183 + doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl); 184 + 185 + checkTarget = "check-all"; 186 + 187 + requiredSystemFeatures = [ "big-parallel" ]; 188 + meta = llvm_meta // { 189 + homepage = "https://llvm.org/"; 190 + description = "A collection of modular and reusable compiler and toolchain technologies"; 191 + longDescription = '' 192 + The LLVM Project is a collection of modular and reusable compiler and 193 + toolchain technologies. Despite its name, LLVM has little to do with 194 + traditional virtual machines. The name "LLVM" itself is not an acronym; it 195 + is the full name of the project. 196 + LLVM began as a research project at the University of Illinois, with the 197 + goal of providing a modern, SSA-based compilation strategy capable of 198 + supporting both static and dynamic compilation of arbitrary programming 199 + languages. Since then, LLVM has grown to be an umbrella project consisting 200 + of a number of subprojects, many of which are being used in production by 201 + a wide variety of commercial and open source projects as well as being 202 + widely used in academic research. Code in the LLVM project is licensed 203 + under the "Apache 2.0 License with LLVM exceptions". 204 + ''; 205 + }; 206 + } // lib.optionalAttrs enableManpages { 207 + pname = "llvm-manpages"; 208 + 209 + buildPhase = '' 210 + make docs-llvm-man 211 + ''; 212 + 213 + propagatedBuildInputs = []; 214 + 215 + installPhase = '' 216 + make -C docs install 217 + ''; 218 + 219 + postPatch = null; 220 + postInstall = null; 221 + 222 + outputs = [ "out" ]; 223 + 224 + doCheck = false; 225 + 226 + meta = llvm_meta // { 227 + description = "man pages for LLVM ${version}"; 228 + }; 229 + })
+105
pkgs/development/compilers/llvm/git/llvm/gnu-install-dirs-polly.patch
··· 1 + diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt 2 + index ca7c04c565bb..6ed5db5dd4f8 100644 3 + --- a/tools/polly/CMakeLists.txt 4 + +++ b/tools/polly/CMakeLists.txt 5 + @@ -2,7 +2,11 @@ 6 + if (NOT DEFINED LLVM_MAIN_SRC_DIR) 7 + project(Polly) 8 + cmake_minimum_required(VERSION 3.13.4) 9 + +endif() 10 + + 11 + +include(GNUInstallDirs) 12 + 13 + +if (NOT DEFINED LLVM_MAIN_SRC_DIR) 14 + # Where is LLVM installed? 15 + find_package(LLVM CONFIG REQUIRED) 16 + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR}) 17 + @@ -122,13 +126,13 @@ include_directories( 18 + 19 + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 20 + install(DIRECTORY include/ 21 + - DESTINATION include 22 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 23 + FILES_MATCHING 24 + PATTERN "*.h" 25 + ) 26 + 27 + install(DIRECTORY ${POLLY_BINARY_DIR}/include/ 28 + - DESTINATION include 29 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 30 + FILES_MATCHING 31 + PATTERN "*.h" 32 + PATTERN "CMakeFiles" EXCLUDE 33 + diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt 34 + index 7cc129ba2e90..137be25e4b80 100644 35 + --- a/tools/polly/cmake/CMakeLists.txt 36 + +++ b/tools/polly/cmake/CMakeLists.txt 37 + @@ -79,18 +79,18 @@ file(GENERATE 38 + 39 + # Generate PollyConfig.cmake for the install tree. 40 + unset(POLLY_EXPORTS) 41 + -set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 42 + +set(POLLY_INSTALL_PREFIX "") 43 + set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") 44 + -set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}") 45 + -set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}") 46 + +set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}") 47 + +set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}") 48 + if (POLLY_BUNDLED_ISL) 49 + set(POLLY_CONFIG_INCLUDE_DIRS 50 + - "${POLLY_INSTALL_PREFIX}/include" 51 + - "${POLLY_INSTALL_PREFIX}/include/polly" 52 + + "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}" 53 + + "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly" 54 + ) 55 + else() 56 + set(POLLY_CONFIG_INCLUDE_DIRS 57 + - "${POLLY_INSTALL_PREFIX}/include" 58 + + "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}" 59 + ${ISL_INCLUDE_DIRS} 60 + ) 61 + endif() 62 + @@ -100,12 +100,12 @@ endif() 63 + foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS) 64 + get_target_property(tgt_type ${tgt} TYPE) 65 + if (tgt_type STREQUAL "EXECUTABLE") 66 + - set(tgt_prefix "bin/") 67 + + set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/") 68 + else() 69 + - set(tgt_prefix "lib/") 70 + + set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/") 71 + endif() 72 + 73 + - set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>") 74 + + set(tgt_path "${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>") 75 + file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path}) 76 + 77 + if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY") 78 + diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake 79 + index 518a09b45a42..bd9d6f5542ad 100644 80 + --- a/tools/polly/cmake/polly_macros.cmake 81 + +++ b/tools/polly/cmake/polly_macros.cmake 82 + @@ -44,8 +44,8 @@ macro(add_polly_library name) 83 + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly") 84 + install(TARGETS ${name} 85 + EXPORT LLVMExports 86 + - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} 87 + - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 88 + + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} 89 + + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) 90 + endif() 91 + set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) 92 + endmacro(add_polly_library) 93 + diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt 94 + index 8991094d92c7..178d8ad606bb 100644 95 + --- a/tools/polly/lib/External/CMakeLists.txt 96 + +++ b/tools/polly/lib/External/CMakeLists.txt 97 + @@ -275,7 +275,7 @@ if (POLLY_BUNDLED_ISL) 98 + install(DIRECTORY 99 + ${ISL_SOURCE_DIR}/include/ 100 + ${ISL_BINARY_DIR}/include/ 101 + - DESTINATION include/polly 102 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly 103 + FILES_MATCHING 104 + PATTERN "*.h" 105 + PATTERN "CMakeFiles" EXCLUDE
+417
pkgs/development/compilers/llvm/git/llvm/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index 277d0fe54d7b..af69c8be8745 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -256,15 +256,21 @@ if (CMAKE_BUILD_TYPE AND 6 + message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") 7 + endif() 8 + 9 + +include(GNUInstallDirs) 10 + + 11 + set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) 12 + 13 + -set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')") 14 + +set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING 15 + + "Path for binary subdirectory (defaults to 'bin')") 16 + mark_as_advanced(LLVM_TOOLS_INSTALL_DIR) 17 + 18 + set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING 19 + "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)") 20 + mark_as_advanced(LLVM_UTILS_INSTALL_DIR) 21 + 22 + +set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING 23 + + "Path for CMake subdirectory (defaults to lib/cmake/llvm)" ) 24 + + 25 + # They are used as destination of target generators. 26 + set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) 27 + set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) 28 + @@ -567,9 +573,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF) 29 + option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON) 30 + option (LLVM_ENABLE_BINDINGS "Build bindings." ON) 31 + 32 + -set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html" 33 + +set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html" 34 + CACHE STRING "Doxygen-generated HTML documentation install directory") 35 + -set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html" 36 + +set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html" 37 + CACHE STRING "OCamldoc-generated HTML documentation install directory") 38 + 39 + option (LLVM_BUILD_EXTERNAL_COMPILER_RT 40 + @@ -1027,7 +1033,7 @@ endif() 41 + 42 + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 43 + install(DIRECTORY include/llvm include/llvm-c 44 + - DESTINATION include 45 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 46 + COMPONENT llvm-headers 47 + FILES_MATCHING 48 + PATTERN "*.def" 49 + @@ -1038,7 +1044,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 50 + ) 51 + 52 + install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c 53 + - DESTINATION include 54 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 55 + COMPONENT llvm-headers 56 + FILES_MATCHING 57 + PATTERN "*.def" 58 + @@ -1052,13 +1058,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 59 + 60 + if (LLVM_INSTALL_MODULEMAPS) 61 + install(DIRECTORY include/llvm include/llvm-c 62 + - DESTINATION include 63 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 64 + COMPONENT llvm-headers 65 + FILES_MATCHING 66 + PATTERN "module.modulemap" 67 + ) 68 + install(FILES include/llvm/module.install.modulemap 69 + - DESTINATION include/llvm 70 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm 71 + COMPONENT llvm-headers 72 + RENAME "module.extern.modulemap" 73 + ) 74 + diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake 75 + index 97c9980c7de3..409e8b615f75 100644 76 + --- a/cmake/modules/AddLLVM.cmake 77 + +++ b/cmake/modules/AddLLVM.cmake 78 + @@ -804,9 +804,9 @@ macro(add_llvm_library name) 79 + 80 + install(TARGETS ${name} 81 + ${export_to_llvmexports} 82 + - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} 83 + - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} 84 + - RUNTIME DESTINATION bin COMPONENT ${name}) 85 + + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} 86 + + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} 87 + + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name}) 88 + 89 + if (NOT LLVM_ENABLE_IDE) 90 + add_llvm_install_targets(install-${name} 91 + @@ -1022,7 +1022,7 @@ function(process_llvm_pass_plugins) 92 + "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})") 93 + install(FILES 94 + ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake 95 + - DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} 96 + + DESTINATION ${LLVM_INSTALL_CMAKE_DIR} 97 + COMPONENT cmake-exports) 98 + 99 + set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def") 100 + @@ -1242,7 +1242,7 @@ macro(add_llvm_example name) 101 + endif() 102 + add_llvm_executable(${name} ${ARGN}) 103 + if( LLVM_BUILD_EXAMPLES ) 104 + - install(TARGETS ${name} RUNTIME DESTINATION examples) 105 + + install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples) 106 + endif() 107 + set_target_properties(${name} PROPERTIES FOLDER "Examples") 108 + endmacro(add_llvm_example name) 109 + @@ -1854,7 +1854,7 @@ function(llvm_install_library_symlink name dest type) 110 + set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX}) 111 + set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX}) 112 + 113 + - set(output_dir lib${LLVM_LIBDIR_SUFFIX}) 114 + + set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) 115 + if(WIN32 AND "${type}" STREQUAL "SHARED") 116 + set(output_dir bin) 117 + endif() 118 + @@ -1871,7 +1871,7 @@ function(llvm_install_library_symlink name dest type) 119 + endif() 120 + endfunction() 121 + 122 + -function(llvm_install_symlink name dest) 123 + +function(llvm_install_symlink name dest output_dir) 124 + cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN}) 125 + foreach(path ${CMAKE_MODULE_PATH}) 126 + if(EXISTS ${path}/LLVMInstallSymlink.cmake) 127 + @@ -1894,7 +1894,7 @@ function(llvm_install_symlink name dest) 128 + set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX}) 129 + 130 + install(SCRIPT ${INSTALL_SYMLINK} 131 + - CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})" 132 + + CODE "install_symlink(${full_name} ${full_dest} ${output_dir})" 133 + COMPONENT ${component}) 134 + 135 + if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE) 136 + @@ -1977,7 +1977,8 @@ function(add_llvm_tool_symlink link_name target) 137 + endif() 138 + 139 + if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS) 140 + - llvm_install_symlink(${link_name} ${target}) 141 + + GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR) 142 + + llvm_install_symlink(${link_name} ${target} ${output_dir}) 143 + endif() 144 + endif() 145 + endfunction() 146 + @@ -2100,9 +2101,9 @@ function(llvm_setup_rpath name) 147 + 148 + if (APPLE) 149 + set(_install_name_dir INSTALL_NAME_DIR "@rpath") 150 + - set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 151 + + set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 152 + elseif(UNIX) 153 + - set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 154 + + set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 155 + if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") 156 + set_property(TARGET ${name} APPEND_STRING PROPERTY 157 + LINK_FLAGS " -Wl,-z,origin ") 158 + diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake 159 + index 554046b20edf..4d1ad980641e 100644 160 + --- a/cmake/modules/AddOCaml.cmake 161 + +++ b/cmake/modules/AddOCaml.cmake 162 + @@ -144,9 +144,9 @@ function(add_ocaml_library name) 163 + endforeach() 164 + 165 + if( APPLE ) 166 + - set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}") 167 + + set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}") 168 + elseif( UNIX ) 169 + - set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}") 170 + + set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}") 171 + endif() 172 + list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}") 173 + 174 + diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake 175 + index e80c3b5c1cac..482f6d715ef5 100644 176 + --- a/cmake/modules/AddSphinxTarget.cmake 177 + +++ b/cmake/modules/AddSphinxTarget.cmake 178 + @@ -90,7 +90,7 @@ function (add_sphinx_target builder project) 179 + endif() 180 + elseif (builder STREQUAL html) 181 + string(TOUPPER "${project}" project_upper) 182 + - set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html" 183 + + set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html" 184 + CACHE STRING "HTML documentation install directory for ${project}") 185 + 186 + # '/.' indicates: copy the contents of the directory directly into 187 + diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt 188 + index 505dc9a29d70..36e6c63af3f4 100644 189 + --- a/cmake/modules/CMakeLists.txt 190 + +++ b/cmake/modules/CMakeLists.txt 191 + @@ -1,4 +1,4 @@ 192 + -set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) 193 + +set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')") 194 + set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") 195 + 196 + # First for users who use an installed LLVM, create the LLVMExports.cmake file. 197 + @@ -107,13 +107,13 @@ foreach(p ${_count}) 198 + set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE} 199 + get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)") 200 + endforeach(p) 201 + -set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include") 202 + +set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") 203 + set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}") 204 + set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}") 205 + -set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}") 206 + +set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}") 207 + set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}") 208 + set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}") 209 + -set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin") 210 + +set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") 211 + 212 + # Generate a default location for lit 213 + if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) 214 + diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake 215 + index 09fed8085c23..aa79f192abf0 100644 216 + --- a/cmake/modules/LLVMInstallSymlink.cmake 217 + +++ b/cmake/modules/LLVMInstallSymlink.cmake 218 + @@ -10,7 +10,7 @@ function(install_symlink name target outdir) 219 + set(LINK_OR_COPY copy) 220 + endif() 221 + 222 + - set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/") 223 + + set(bindir "${DESTDIR}${outdir}/") 224 + 225 + message(STATUS "Creating ${name}") 226 + 227 + diff --git a/docs/CMake.rst b/docs/CMake.rst 228 + index bb821b417ad9..6a528f7c2ad3 100644 229 + --- a/docs/CMake.rst 230 + +++ b/docs/CMake.rst 231 + @@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``. 232 + **LLVM_LIBDIR_SUFFIX**:STRING 233 + Extra suffix to append to the directory where libraries are to be 234 + installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64`` 235 + - to install libraries to ``/usr/lib64``. 236 + + to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``. 237 + 238 + **CMAKE_C_FLAGS**:STRING 239 + Extra flags to use when compiling C source files. 240 + @@ -550,8 +550,8 @@ LLVM-specific variables 241 + 242 + **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING 243 + The path to install Doxygen-generated HTML documentation to. This path can 244 + - either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to 245 + - `share/doc/llvm/doxygen-html`. 246 + + either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to 247 + + `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`. 248 + 249 + **LLVM_ENABLE_SPHINX**:BOOL 250 + If specified, CMake will search for the ``sphinx-build`` executable and will make 251 + @@ -582,13 +582,33 @@ LLVM-specific variables 252 + 253 + **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING 254 + The path to install Sphinx-generated HTML documentation to. This path can 255 + - either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to 256 + - `share/doc/llvm/html`. 257 + + either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to 258 + + `${CMAKE_INSTALL_DOCDIR}/${project}/html`. 259 + 260 + **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING 261 + The path to install OCamldoc-generated HTML documentation to. This path can 262 + - either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to 263 + - `share/doc/llvm/ocaml-html`. 264 + + either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to 265 + + `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`. 266 + + 267 + +**CMAKE_INSTALL_BINDIR**:STRING 268 + + The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``. 269 + + Defaults to `bin`. 270 + + 271 + +**CMAKE_INSTALL_LIBDIR**:STRING 272 + + The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``. 273 + + Defaults to `lib`. 274 + + 275 + +**CMAKE_INSTALL_INCLUDEDIR**:STRING 276 + + The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``. 277 + + Defaults to `include`. 278 + + 279 + +**CMAKE_INSTALL_DOCDIR**:STRING 280 + + The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``. 281 + + Defaults to `share/doc`. 282 + + 283 + +**CMAKE_INSTALL_MANDIR**:STRING 284 + + The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``. 285 + + Defaults to `share/man`. 286 + 287 + **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL 288 + macOS Only: If enabled CMake will generate a target named 289 + @@ -786,9 +806,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``). 290 + 291 + This file is available in two different locations. 292 + 293 + -* ``<INSTALL_PREFIX>/lib/cmake/llvm/LLVMConfig.cmake`` where 294 + - ``<INSTALL_PREFIX>`` is the install prefix of an installed version of LLVM. 295 + - On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``. 296 + +* ``<LLVM_INSTALL_PACKAGE_DIR>LLVMConfig.cmake`` where 297 + + ``<LLVM_INSTALL_PACKAGE_DIR>`` is the location where LLVM CMake modules are 298 + + installed as part of an installed version of LLVM. This is typically 299 + + ``cmake/llvm/`` within the lib directory. On Linux, this is typically 300 + + ``/usr/lib/cmake/llvm/LLVMConfig.cmake``. 301 + 302 + * ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where 303 + ``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only 304 + diff --git a/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt 305 + index bb96edb4b4bf..678c22fb43c8 100644 306 + --- a/examples/Bye/CMakeLists.txt 307 + +++ b/examples/Bye/CMakeLists.txt 308 + @@ -14,6 +14,6 @@ if (NOT WIN32) 309 + BUILDTREE_ONLY 310 + ) 311 + 312 + - install(TARGETS ${name} RUNTIME DESTINATION examples) 313 + + install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples) 314 + set_target_properties(${name} PROPERTIES FOLDER "Examples") 315 + endif() 316 + diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt 317 + index b46319f24fc8..2feabd1954e4 100644 318 + --- a/include/llvm/CMakeLists.txt 319 + +++ b/include/llvm/CMakeLists.txt 320 + @@ -5,5 +5,5 @@ add_subdirectory(Frontend) 321 + # If we're doing an out-of-tree build, copy a module map for generated 322 + # header files into the build area. 323 + if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") 324 + - configure_file(module.modulemap.build module.modulemap COPYONLY) 325 + + configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY) 326 + endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") 327 + diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in 328 + index ebe5b73a5c65..70c497be12f5 100644 329 + --- a/tools/llvm-config/BuildVariables.inc.in 330 + +++ b/tools/llvm-config/BuildVariables.inc.in 331 + @@ -23,6 +23,10 @@ 332 + #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@" 333 + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" 334 + #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@" 335 + +#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@" 336 + +#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@" 337 + +#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@" 338 + +#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@" 339 + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" 340 + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" 341 + #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@" 342 + diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp 343 + index 1a2f04552d13..44fa7d3eec6b 100644 344 + --- a/tools/llvm-config/llvm-config.cpp 345 + +++ b/tools/llvm-config/llvm-config.cpp 346 + @@ -357,12 +357,26 @@ int main(int argc, char **argv) { 347 + ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include"); 348 + } else { 349 + ActivePrefix = CurrentExecPrefix; 350 + - ActiveIncludeDir = ActivePrefix + "/include"; 351 + - SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR)); 352 + - sys::fs::make_absolute(ActivePrefix, path); 353 + - ActiveBinDir = std::string(path.str()); 354 + - ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; 355 + - ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; 356 + + { 357 + + SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR)); 358 + + sys::fs::make_absolute(ActivePrefix, path); 359 + + ActiveIncludeDir = std::string(path.str()); 360 + + } 361 + + { 362 + + SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR)); 363 + + sys::fs::make_absolute(ActivePrefix, path); 364 + + ActiveBinDir = std::string(path.str()); 365 + + } 366 + + { 367 + + SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX)); 368 + + sys::fs::make_absolute(ActivePrefix, path); 369 + + ActiveLibDir = std::string(path.str()); 370 + + } 371 + + { 372 + + SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR)); 373 + + sys::fs::make_absolute(ActivePrefix, path); 374 + + ActiveCMakeDir = std::string(path.str()); 375 + + } 376 + ActiveIncludeOption = "-I" + ActiveIncludeDir; 377 + } 378 + 379 + diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt 380 + index 2963f97cad88..69d66c9c9ca1 100644 381 + --- a/tools/lto/CMakeLists.txt 382 + +++ b/tools/lto/CMakeLists.txt 383 + @@ -25,7 +25,7 @@ add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS 384 + intrinsics_gen) 385 + 386 + install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h 387 + - DESTINATION include/llvm-c 388 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c 389 + COMPONENT LTO) 390 + 391 + if (APPLE) 392 + diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt 393 + index ead73ec13a8f..250362021f17 100644 394 + --- a/tools/opt-viewer/CMakeLists.txt 395 + +++ b/tools/opt-viewer/CMakeLists.txt 396 + @@ -8,7 +8,7 @@ set (files 397 + 398 + foreach (file ${files}) 399 + install(PROGRAMS ${file} 400 + - DESTINATION share/opt-viewer 401 + + DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer 402 + COMPONENT opt-viewer) 403 + endforeach (file) 404 + 405 + diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt 406 + index 865436247270..ce1daa62f6ab 100644 407 + --- a/tools/remarks-shlib/CMakeLists.txt 408 + +++ b/tools/remarks-shlib/CMakeLists.txt 409 + @@ -19,7 +19,7 @@ if(LLVM_ENABLE_PIC) 410 + endif() 411 + 412 + install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h 413 + - DESTINATION include/llvm-c 414 + + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c 415 + COMPONENT Remarks) 416 + 417 + if (APPLE)
+26
pkgs/development/compilers/llvm/git/llvm/outputs.patch
··· 1 + diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp 2 + index 94d426b..37f7794 100644 3 + --- a/tools/llvm-config/llvm-config.cpp 4 + +++ b/tools/llvm-config/llvm-config.cpp 5 + @@ -333,6 +333,21 @@ int main(int argc, char **argv) { 6 + ActiveIncludeOption = "-I" + ActiveIncludeDir; 7 + } 8 + 9 + + /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared 10 + + if (!IsInDevelopmentTree) { 11 + + bool WantShared = true; 12 + + for (int i = 1; i < argc; ++i) { 13 + + StringRef Arg = argv[i]; 14 + + if (Arg == "--link-shared") 15 + + WantShared = true; 16 + + else if (Arg == "--link-static") 17 + + WantShared = false; // the last one wins 18 + + } 19 + + 20 + + if (WantShared) 21 + + ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX; 22 + + } 23 + + 24 + /// We only use `shared library` mode in cases where the static library form 25 + /// of the components provided are not available; note however that this is 26 + /// skipped if we're run from within the build dir. However, once installed,
+34
pkgs/development/compilers/llvm/git/openmp/default.nix
··· 1 + { lib 2 + , stdenv 3 + , llvm_meta 4 + , fetch 5 + , cmake 6 + , llvm 7 + , perl 8 + , version 9 + }: 10 + 11 + stdenv.mkDerivation rec { 12 + pname = "openmp"; 13 + inherit version; 14 + 15 + src = fetch pname "0z8n1wanby6aq3i7d91mgk72hb33zfl5blayk0a22cs7l8i706zb"; 16 + 17 + nativeBuildInputs = [ cmake perl ]; 18 + buildInputs = [ llvm ]; 19 + 20 + meta = llvm_meta // { 21 + homepage = "https://openmp.llvm.org/"; 22 + description = "Support for the OpenMP language"; 23 + longDescription = '' 24 + The OpenMP subproject of LLVM contains the components required to build an 25 + executable OpenMP program that are outside the compiler itself. 26 + Contains the code for the runtime library against which code compiled by 27 + "clang -fopenmp" must be linked before it can run and the library that 28 + supports offload to target devices. 29 + ''; 30 + # "All of the code is dual licensed under the MIT license and the UIUC 31 + # License (a BSD-like license)": 32 + license = with lib.licenses; [ mit ncsa ]; 33 + }; 34 + }
+7
pkgs/top-level/aliases.nix
··· 1071 1071 sddm 1072 1072 ; 1073 1073 1074 + # LLVM packages for (integration) testing that should not be used inside Nixpkgs: 1075 + llvmPackages_git = recurseIntoAttrs (callPackage ../development/compilers/llvm/git { 1076 + inherit (stdenvAdapters) overrideCC; 1077 + buildLlvmTools = buildPackages.llvmPackages_git.tools; 1078 + targetLlvmLibraries = targetPackages.llvmPackages_git.libraries; 1079 + }); 1080 + 1074 1081 })