diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/16')
23 files changed, 0 insertions, 1405 deletions
diff --git a/pkgs/development/compilers/llvm/16/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/16/clang/gnu-install-dirs.patch deleted file mode 100644 index e5465c9bf4f9..000000000000 --- a/pkgs/development/compilers/llvm/16/clang/gnu-install-dirs.patch +++ /dev/null @@ -1,109 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 090cfa352078..624b7c9f3400 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -38,12 +38,26 @@ if(CLANG_BUILT_STANDALONE) - find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}") - list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}") - -- # Turn into CACHE PATHs for overwritting -- set(LLVM_INCLUDE_DIRS ${LLVM_INCLUDE_DIRS} CACHE PATH "Path to llvm/include and any other header dirs needed") -- set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}" CACHE PATH "Path to LLVM build tree") -- set(LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" CACHE PATH "Path to LLVM source tree") -- set(LLVM_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}" CACHE PATH "Path to llvm/bin") -- set(LLVM_LIBRARY_DIR "${LLVM_LIBRARY_DIR}" CACHE PATH "Path to llvm/lib") -+ # We can't check LLVM_CONFIG here, because find_package(LLVM ...) also sets -+ # LLVM_CONFIG. -+ if (NOT LLVM_CONFIG_FOUND) -+ # Pull values from LLVMConfig.cmake. We can drop this once the llvm-config -+ # path is removed. -+ set(INCLUDE_DIRS ${LLVM_INCLUDE_DIRS}) -+ set(LLVM_OBJ_DIR "${LLVM_BINARY_DIR}") -+ # N.B. this is just a default value, the CACHE PATHs below can be overriden. -+ set(MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm") -+ set(TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}") -+ set(LIBRARY_DIR "${LLVM_LIBRARY_DIR}") -+ else() -+ set(INCLUDE_DIRS "${LLVM_BINARY_DIR}/include" "${MAIN_INCLUDE_DIR}") -+ endif() -+ -+ set(LLVM_INCLUDE_DIRS ${INCLUDE_DIRS} CACHE PATH "Path to llvm/include and any other header dirs needed") -+ set(LLVM_BINARY_DIR "${LLVM_OBJ_ROOT}" CACHE PATH "Path to LLVM build tree") -+ set(LLVM_MAIN_SRC_DIR "${MAIN_SRC_DIR}" CACHE PATH "Path to LLVM source tree") -+ set(LLVM_TOOLS_BINARY_DIR "${TOOLS_BINARY_DIR}" CACHE PATH "Path to llvm/bin") -+ set(LLVM_LIBRARY_DIR "${LIBRARY_DIR}" CACHE PATH "Path to llvm/lib") - - find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} - NO_DEFAULT_PATH) -diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake -index 75b0080f6715..c895b884cd27 100644 ---- a/cmake/modules/AddClang.cmake -+++ b/cmake/modules/AddClang.cmake -@@ -119,8 +119,8 @@ macro(add_clang_library name) - install(TARGETS ${lib} - COMPONENT ${lib} - ${export_to_clangtargets} -- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} -- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - - if (NOT LLVM_ENABLE_IDE) -diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt -index bb9a11eabbef..e2de91c65fbb 100644 ---- a/lib/Headers/CMakeLists.txt -+++ b/lib/Headers/CMakeLists.txt -@@ -437,7 +437,7 @@ add_header_target("openmp-resource-headers" ${openmp_wrapper_files}) - add_header_target("windows-resource-headers" ${windows_only_files}) - add_header_target("utility-resource-headers" ${utility_files}) - --set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR}/include) -+set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR}/include) - - ############################################################# - # Install rules for the catch-all clang-resource-headers target -diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt -index 4f23065a2472..6a0f55991e24 100644 ---- a/tools/libclang/CMakeLists.txt -+++ b/tools/libclang/CMakeLists.txt -@@ -234,7 +234,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS}) - COMPONENT - libclang-python-bindings - DESTINATION -- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages") -+ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages") - endforeach() - if(NOT LLVM_ENABLE_IDE) - add_custom_target(libclang-python-bindings) -diff --git a/tools/scan-build-py/CMakeLists.txt b/tools/scan-build-py/CMakeLists.txt -index 3aca22c0b0a8..3115353e3fe3 100644 ---- a/tools/scan-build-py/CMakeLists.txt -+++ b/tools/scan-build-py/CMakeLists.txt -@@ -88,7 +88,7 @@ foreach(lib ${LibScanbuild}) - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/${lib}) - list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/${lib}) - install(FILES lib/libscanbuild/${lib} -- DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libscanbuild -+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libscanbuild" - COMPONENT scan-build-py) - endforeach() - -@@ -106,7 +106,7 @@ foreach(resource ${LibScanbuildResources}) - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/resources/${resource}) - list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources/${resource}) - install(FILES lib/libscanbuild/resources/${resource} -- DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libscanbuild/resources -+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libscanbuild/resources" - COMPONENT scan-build-py) - endforeach() - -@@ -122,7 +122,7 @@ foreach(lib ${LibEar}) - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libear/${lib}) - list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libear/${lib}) - install(FILES lib/libear/${lib} -- DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libear -+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libear" - COMPONENT scan-build-py) - endforeach() - diff --git a/pkgs/development/compilers/llvm/16/clang/purity.patch b/pkgs/development/compilers/llvm/16/clang/purity.patch deleted file mode 100644 index 1c94f293eb93..000000000000 --- a/pkgs/development/compilers/llvm/16/clang/purity.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001 -From: Will Dietz <w@wdtz.org> -Date: Thu, 18 May 2017 11:56:12 -0500 -Subject: [PATCH] "purity" patch for 5.0 - ---- - lib/Driver/ToolChains/Gnu.cpp | 7 ------- - 1 file changed, 7 deletions(-) - -diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp -index fe3c0191bb..c6a482bece 100644 ---- a/lib/Driver/ToolChains/Gnu.cpp -+++ b/lib/Driver/ToolChains/Gnu.cpp -@@ -487,13 +487,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, - } else { - if (Args.hasArg(options::OPT_rdynamic)) - CmdArgs.push_back("-export-dynamic"); - -- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE && -- !Args.hasArg(options::OPT_r)) { -- CmdArgs.push_back("-dynamic-linker"); -- CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) + -- ToolChain.getDynamicLinker(Args))); -- } - } - - CmdArgs.push_back("-o"); --- -2.11.0 diff --git a/pkgs/development/compilers/llvm/16/compiler-rt/X86-support-extension.patch b/pkgs/development/compilers/llvm/16/compiler-rt/X86-support-extension.patch deleted file mode 100644 index 07013e5a6825..000000000000 --- a/pkgs/development/compilers/llvm/16/compiler-rt/X86-support-extension.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt -index 3a66dd9c3fb..7efc85d9f9f 100644 ---- a/lib/builtins/CMakeLists.txt -+++ b/lib/builtins/CMakeLists.txt -@@ -348,4 +348,8 @@ if (NOT MSVC) - -+ set(i486_SOURCES ${i386_SOURCES}) -+ set(i586_SOURCES ${i386_SOURCES}) -+ set(i686_SOURCES ${i386_SOURCES}) -+ - if (WIN32) - set(i386_SOURCES - ${i386_SOURCES} -@@ -723,6 +723,7 @@ else () - endif() - - foreach (arch ${BUILTIN_SUPPORTED_ARCH}) -+ message("arch: ${arch}") - if (CAN_TARGET_${arch}) - # For ARM archs, exclude any VFP builtins if VFP is not supported - if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$") diff --git a/pkgs/development/compilers/llvm/16/compiler-rt/asan-offset.patch b/pkgs/development/compilers/llvm/16/compiler-rt/asan-offset.patch deleted file mode 100644 index 46afe5c00734..000000000000 --- a/pkgs/development/compilers/llvm/16/compiler-rt/asan-offset.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/lib/asan/CMakeLists.txt 2022-06-22 16:46:24.000000000 +0000 -+++ b/lib/asan/CMakeLists.txt -@@ -46,7 +46,7 @@ set(ASAN_STATIC_SOURCES - asan_rtl_static.cpp - ) - --if (NOT WIN32 AND NOT APPLE) -+if (LINUX) - list(APPEND ASAN_STATIC_SOURCES - asan_rtl_x86_64.S - ) diff --git a/pkgs/development/compilers/llvm/16/compiler-rt/darwin-targetconditionals.patch b/pkgs/development/compilers/llvm/16/compiler-rt/darwin-targetconditionals.patch deleted file mode 100644 index 425dc2af01e7..000000000000 --- a/pkgs/development/compilers/llvm/16/compiler-rt/darwin-targetconditionals.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff --git a/lib/sanitizer_common/sanitizer_mac.cpp b/lib/sanitizer_common/sanitizer_mac.cpp ---- a/lib/sanitizer_common/sanitizer_mac.cpp -+++ b/lib/sanitizer_common/sanitizer_mac.cpp -@@ -613,9 +613,15 @@ HandleSignalMode GetHandleSignalMode(int signum) { - // Offset example: - // XNU 17 -- macOS 10.13 -- iOS 11 -- tvOS 11 -- watchOS 4 - constexpr u16 GetOSMajorKernelOffset() { -- if (TARGET_OS_OSX) return 4; -- if (TARGET_OS_IOS || TARGET_OS_TV) return 6; -- if (TARGET_OS_WATCH) return 13; -+#if TARGET_OS_OSX -+ return 4; -+#endif -+#if TARGET_OS_IOS || TARGET_OS_TV -+ return 6; -+#endif -+#if TARGET_OS_WATCH -+ return 13; -+#endif - } - - using VersStr = char[64]; -@@ -627,13 +633,13 @@ static uptr ApproximateOSVersionViaKernelVersion(VersStr vers) { - u16 os_major = kernel_major - offset; - - const char *format = "%d.0"; -- if (TARGET_OS_OSX) { -- if (os_major >= 16) { // macOS 11+ -- os_major -= 5; -- } else { // macOS 10.15 and below -- format = "10.%d"; -- } -+#if TARGET_OS_OSX -+ if (os_major >= 16) { // macOS 11+ -+ os_major -= 5; -+ } else { // macOS 10.15 and below -+ format = "10.%d"; - } -+#endif - return internal_snprintf(vers, sizeof(VersStr), format, os_major); - } - -@@ -681,15 +687,14 @@ void ParseVersion(const char *vers, u16 *major, u16 *minor) { - // Aligned versions example: - // macOS 10.15 -- iOS 13 -- tvOS 13 -- watchOS 6 - static void MapToMacos(u16 *major, u16 *minor) { -- if (TARGET_OS_OSX) -- return; -- -- if (TARGET_OS_IOS || TARGET_OS_TV) -+#if !TARGET_OS_OSX -+#if TARGET_OS_IOS || TARGET_OS_TV - *major += 2; -- else if (TARGET_OS_WATCH) -+#elif TARGET_OS_WATCH - *major += 9; -- else -+#else - UNREACHABLE("unsupported platform"); -+#endif - - if (*major >= 16) { // macOS 11+ - *major -= 5; -@@ -697,6 +702,7 @@ static void MapToMacos(u16 *major, u16 *minor) { - *minor = *major; - *major = 10; - } -+#endif - } - - static MacosVersion GetMacosAlignedVersionInternal() { diff --git a/pkgs/development/compilers/llvm/16/compiler-rt/freebsd-i386.patch b/pkgs/development/compilers/llvm/16/compiler-rt/freebsd-i386.patch deleted file mode 100644 index 0a221750552a..000000000000 --- a/pkgs/development/compilers/llvm/16/compiler-rt/freebsd-i386.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/lib/builtins/fp_lib.h 1969-12-31 16:00:01.000000000 -0800 -+++ b/lib/builtins/fp_lib.h 2023-12-21 23:39:36.066927293 -0800 -@@ -26,18 +26,6 @@ - #include <stdbool.h> - #include <stdint.h> - --// x86_64 FreeBSD prior v9.3 define fixed-width types incorrectly in --// 32-bit mode. --#if defined(__FreeBSD__) && defined(__i386__) --#include <sys/param.h> --#if __FreeBSD_version < 903000 // v9.3 --#define uint64_t unsigned long long --#define int64_t long long --#undef UINT64_C --#define UINT64_C(c) (c##ULL) --#endif --#endif -- - #if defined SINGLE_PRECISION - - typedef uint16_t half_rep_t; diff --git a/pkgs/development/compilers/llvm/16/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/16/compiler-rt/gnu-install-dirs.patch deleted file mode 100644 index f3b1f63a7d71..000000000000 --- a/pkgs/development/compilers/llvm/16/compiler-rt/gnu-install-dirs.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake -index 8a6219568b3f..30ee68a47ccf 100644 ---- a/cmake/base-config-ix.cmake -+++ b/cmake/base-config-ix.cmake -@@ -100,13 +100,13 @@ endif() - if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - set(COMPILER_RT_OUTPUT_LIBRARY_DIR - ${COMPILER_RT_OUTPUT_DIR}/lib) -- extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" lib) -+ extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_LIBDIR}") - set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH - "Path where built compiler-rt libraries should be installed.") - else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - set(COMPILER_RT_OUTPUT_LIBRARY_DIR - ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) -- extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "lib/${COMPILER_RT_OS_DIR}") -+ extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_LIBDIR}/${COMPILER_RT_OS_DIR}") - set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH - "Path where built compiler-rt libraries should be installed.") - endif() diff --git a/pkgs/development/compilers/llvm/16/compiler-rt/normalize-var.patch b/pkgs/development/compilers/llvm/16/compiler-rt/normalize-var.patch deleted file mode 100644 index 2b25fd4a0744..000000000000 --- a/pkgs/development/compilers/llvm/16/compiler-rt/normalize-var.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake -index 4c85551d7766..297d7a47c54b 100644 ---- a/cmake/Modules/CompilerRTUtils.cmake -+++ b/cmake/Modules/CompilerRTUtils.cmake -@@ -328,8 +328,9 @@ macro(load_llvm_config) - endif() - endif() - -- set(LLVM_LIBRARY_OUTPUT_INTDIR -- ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) -+ get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR -+ ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX} -+ REALPATH) - - set(LLVM_MAIN_SRC_DIR "${LLVM_MAIN_SRC_DIR_DEFAULT}" CACHE PATH "Path to LLVM source tree") - message(STATUS "LLVM_MAIN_SRC_DIR: \"${LLVM_MAIN_SRC_DIR}\"") diff --git a/pkgs/development/compilers/llvm/16/default.nix b/pkgs/development/compilers/llvm/16/default.nix deleted file mode 100644 index 521e1ed92e3e..000000000000 --- a/pkgs/development/compilers/llvm/16/default.nix +++ /dev/null @@ -1,434 +0,0 @@ -{ lowPrio, newScope, pkgs, lib, stdenv -, preLibcCrossHeaders -, substitute, substituteAll, fetchFromGitHub -, overrideCC, wrapCCWith, wrapBintoolsWith -, buildLlvmTools # tools, but from the previous stage, for cross -, targetLlvmLibraries # libraries, but from the next stage, for cross -, targetLlvm -# This is the default binutils, but with *this* version of LLD rather -# than the default LLVM verion's, if LLD is the choice. We use these for -# the `useLLVM` bootstrapping below. -, bootBintoolsNoLibc ? - if stdenv.targetPlatform.linker == "lld" - then null - else pkgs.bintoolsNoLibc -, bootBintools ? - if stdenv.targetPlatform.linker == "lld" - then null - else pkgs.bintools -, darwin -# LLVM release information; specify one of these but not both: -, gitRelease ? null - # i.e.: - # { - # version = /* i.e. "15.0.0" */; - # rev = /* commit SHA */; - # rev-version = /* human readable version; i.e. "unstable-2022-26-07" */; - # sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */; - # } -, officialRelease ? { version = "16.0.6"; sha256 = "sha256-fspqSReX+VD+Nl/Cfq+tDcdPtnQPV1IRopNDfd5VtUs="; } - # i.e.: - # { - # version = /* i.e. "15.0.0" */; - # candidate = /* optional; if specified, should be: "rcN" */ - # sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */; - # } -# By default, we'll try to fetch a release from `github:llvm/llvm-project` -# corresponding to the `gitRelease` or `officialRelease` specified. -# -# You can provide your own LLVM source by specifying this arg but then it's up -# to you to make sure that the LLVM repo given matches the release configuration -# specified. -, monorepoSrc ? null -# Allows passthrough to packages via newScope. This makes it possible to -# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get -# an llvmPackages whose packages are overridden in an internally consistent way. -, ... -}@args: - -assert - lib.assertMsg - (lib.xor - (gitRelease != null) - (officialRelease != null)) - ("must specify `gitRelease` or `officialRelease`" + - (lib.optionalString (gitRelease != null) " — not both")); -let - monorepoSrc' = monorepoSrc; -in let - - metadata = rec { - # Import releaseInfo separately to avoid infinite recursion - inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; - inherit (releaseInfo) release_version version; - inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc; - }; - - lldbPlugins = lib.makeExtensible (lldbPlugins: let - callPackage = newScope (lldbPlugins // { inherit stdenv; inherit (tools) lldb; }); - in { - llef = callPackage ../common/lldb-plugins/llef.nix {}; - }); - - tools = lib.makeExtensible (tools: let - callPackage = newScope (tools // args // metadata); - major = lib.versions.major metadata.release_version; - mkExtraBuildCommands0 = cc: '' - rsrc="$out/resource-root" - mkdir "$rsrc" - ln -s "${cc.lib}/lib/clang/${major}/include" "$rsrc" - echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - ''; - mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + '' - ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" - ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share" - ''; - - bintoolsNoLibc' = - if bootBintoolsNoLibc == null - then tools.bintoolsNoLibc - else bootBintoolsNoLibc; - bintools' = - if bootBintools == null - then tools.bintools - else bootBintools; - - in { - - libllvm = callPackage ../common/llvm { - patches = [ - ./llvm/gnu-install-dirs.patch - - # Running the tests involves invoking binaries (like `opt`) that depend on - # the LLVM dylibs and reference them by absolute install path (i.e. their - # nix store path). - # - # Because we have not yet run the install phase (we're running these tests - # as part of `checkPhase` instead of `installCheckPhase`) these absolute - # paths do not exist yet; to work around this we point the loader (`ld` on - # unix, `dyld` on macOS) at the `lib` directory which will later become this - # package's `lib` output. - # - # Previously we would just set `LD_LIBRARY_PATH` to include the build `lib` - # dir but: - # - this doesn't generalize well to other platforms; `lit` doesn't forward - # `DYLD_LIBRARY_PATH` (macOS): - # + https://github.com/llvm/llvm-project/blob/0d89963df354ee309c15f67dc47c8ab3cb5d0fb2/llvm/utils/lit/lit/TestingConfig.py#L26 - # - even if `lit` forwarded this env var, we actually cannot set - # `DYLD_LIBRARY_PATH` in the child processes `lit` launches because - # `DYLD_LIBRARY_PATH` (and `DYLD_FALLBACK_LIBRARY_PATH`) is cleared for - # "protected processes" (i.e. the python interpreter that runs `lit`): - # https://stackoverflow.com/a/35570229 - # - other LLVM subprojects deal with this issue by having their `lit` - # configuration set these env vars for us; it makes sense to do the same - # for LLVM: - # + https://github.com/llvm/llvm-project/blob/4c106cfdf7cf7eec861ad3983a3dd9a9e8f3a8ae/clang-tools-extra/test/Unit/lit.cfg.py#L22-L31 - # - # !!! TODO: look into upstreaming this patch - ./llvm/llvm-lit-cfg-add-libs-to-dylib-path.patch - - # `lit` has a mode where it executes run lines as a shell script which is - # constructs; this is problematic for macOS because it means that there's - # another process in between `lit` and the binaries being tested. As noted - # above, this means that `DYLD_LIBRARY_PATH` is cleared which means that our - # tests fail with dyld errors. - # - # To get around this we patch `lit` to reintroduce `DYLD_LIBRARY_PATH`, when - # present in the test configuration. - # - # It's not clear to me why this isn't an issue for LLVM developers running - # on macOS (nothing about this _seems_ nix specific).. - ./llvm/lit-shell-script-runner-set-dyld-library-path.patch - ]; - pollyPatches = [ - ./llvm/gnu-install-dirs-polly.patch - - # Just like the `llvm-lit-cfg` patch, but for `polly`. - ./llvm/polly-lit-cfg-add-libs-to-dylib-path.patch - ]; - }; - - # `llvm` historically had the binaries. When choosing an output explicitly, - # we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get* - llvm = tools.libllvm; - - libclang = callPackage ../common/clang { - patches = [ - ./clang/purity.patch - # https://reviews.llvm.org/D51899 - ./clang/gnu-install-dirs.patch - ../common/clang/add-nostdlibinc-flag.patch - (substituteAll { - src = ../common/clang/clang-at-least-16-LLVMgold-path.patch; - libllvmLibdir = "${tools.libllvm.lib}/lib"; - }) - ]; - }; - - clang-unwrapped = tools.libclang; - - llvm-manpages = lowPrio (tools.libllvm.override { - enableManpages = true; - python3 = pkgs.python3; # don't use python-boot - }); - - clang-manpages = lowPrio (tools.libclang.override { - enableManpages = true; - python3 = pkgs.python3; # don't use python-boot - }); - - lldb-manpages = lowPrio (tools.lldb.override { - enableManpages = true; - python3 = pkgs.python3; # don't use python-boot - }); - - # pick clang appropriate for package set we are targeting - clang = - /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM - else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang - else tools.libcxxClang; - - libstdcxxClang = wrapCCWith rec { - cc = tools.clang-unwrapped; - # libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper. - libcxx = null; - extraPackages = [ - targetLlvmLibraries.compiler-rt - ]; - extraBuildCommands = mkExtraBuildCommands cc; - }; - - libcxxClang = wrapCCWith rec { - cc = tools.clang-unwrapped; - libcxx = targetLlvmLibraries.libcxx; - extraPackages = [ - targetLlvmLibraries.compiler-rt - ]; - extraBuildCommands = mkExtraBuildCommands cc; - }; - - lld = callPackage ../common/lld { - patches = [ - ./lld/gnu-install-dirs.patch - ./lld/add-table-base.patch - ]; - }; - - mlir = callPackage ../common/mlir {}; - - lldb = callPackage ../common/lldb.nix { - src = callPackage ({ runCommand }: runCommand "lldb-src-${metadata.version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/lldb "$out" - '') { }; - patches = - let - resourceDirPatch = callPackage - ({ substituteAll, libclang }: substituteAll - { - src = ./lldb/resource-dir.patch; - clangLibDir = "${libclang.lib}/lib"; - }) - { }; - in - [ - # FIXME: do we need this? ./procfs.patch - resourceDirPatch - ../common/lldb/gnu-install-dirs.patch - ] - # This is a stopgap solution if/until the macOS SDK used for x86_64 is - # updated. - # - # The older 10.12 SDK used on x86_64 as of this writing has a `mach/machine.h` - # header that does not define `CPU_SUBTYPE_ARM64E` so we replace the one use - # of this preprocessor symbol in `lldb` with its expansion. - # - # See here for some context: - # https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132 - ++ lib.optional ( - stdenv.targetPlatform.isDarwin - && !stdenv.targetPlatform.isAarch64 - && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0") - ) ./lldb/cpu_subtype_arm64e_replacement.patch; - }; - - # Below, is the LLVM bootstrapping logic. It handles building a - # fully LLVM toolchain from scratch. No GCC toolchain should be - # pulled in. As a consequence, it is very quick to build different - # targets provided by LLVM and we can also build for what GCC - # doesn’t support like LLVM. Probably we should move to some other - # file. - - bintools-unwrapped = callPackage ../common/bintools.nix { }; - - bintoolsNoLibc = wrapBintoolsWith { - bintools = tools.bintools-unwrapped; - libc = preLibcCrossHeaders; - }; - - bintools = wrapBintoolsWith { - bintools = tools.bintools-unwrapped; - }; - - clangUseLLVM = wrapCCWith rec { - cc = tools.clang-unwrapped; - libcxx = targetLlvmLibraries.libcxx; - bintools = bintools'; - extraPackages = [ - targetLlvmLibraries.compiler-rt - ] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [ - targetLlvmLibraries.libunwind - ]; - extraBuildCommands = mkExtraBuildCommands cc; - nixSupport.cc-cflags = - [ "-rtlib=compiler-rt" - "-Wno-unused-command-line-argument" - "-B${targetLlvmLibraries.compiler-rt}/lib" - ] - ++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind" - ++ lib.optional - (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) - "-lunwind" - ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; - nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ]; - }; - - clangNoLibcxx = wrapCCWith rec { - cc = tools.clang-unwrapped; - libcxx = null; - bintools = bintools'; - extraPackages = [ - targetLlvmLibraries.compiler-rt - ]; - extraBuildCommands = mkExtraBuildCommands cc; - nixSupport.cc-cflags = - [ - "-rtlib=compiler-rt" - "-B${targetLlvmLibraries.compiler-rt}/lib" - "-nostdlib++" - ] - ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; - }; - - clangNoLibc = wrapCCWith rec { - cc = tools.clang-unwrapped; - libcxx = null; - bintools = bintoolsNoLibc'; - extraPackages = [ - targetLlvmLibraries.compiler-rt - ]; - extraBuildCommands = mkExtraBuildCommands cc; - nixSupport.cc-cflags = - [ - "-rtlib=compiler-rt" - "-B${targetLlvmLibraries.compiler-rt}/lib" - ] - ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; - }; - - clangNoCompilerRt = wrapCCWith rec { - cc = tools.clang-unwrapped; - libcxx = null; - bintools = bintoolsNoLibc'; - extraPackages = [ ]; - extraBuildCommands = mkExtraBuildCommands0 cc; - nixSupport.cc-cflags = - [ - "-nostartfiles" - ] - ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; - }; - - clangNoCompilerRtWithLibc = wrapCCWith (rec { - cc = tools.clang-unwrapped; - libcxx = null; - bintools = bintools'; - extraPackages = [ ]; - extraBuildCommands = mkExtraBuildCommands0 cc; - } // lib.optionalAttrs stdenv.targetPlatform.isWasm { - nixSupport.cc-cflags = [ "-fno-exceptions" ]; - }); - - # Has to be in tools despite mostly being a library, - # because we use a native helper executable from a - # non-cross build in cross builds. - libclc = callPackage ../common/libclc.nix {}; - }); - - libraries = lib.makeExtensible (libraries: let - callPackage = newScope (libraries // buildLlvmTools // args // metadata); - in { - - compiler-rt-libc = callPackage ../common/compiler-rt { - patches = [ - ./compiler-rt/X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config - ./compiler-rt/gnu-install-dirs.patch - # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the - # extra `/`. - ./compiler-rt/normalize-var.patch - # Prevent a compilation error on darwin - ./compiler-rt/darwin-targetconditionals.patch - # See: https://github.com/NixOS/nixpkgs/pull/186575 - ../common/compiler-rt/darwin-plistbuddy-workaround.patch - # See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893 - # ../common/compiler-rt/armv7l-15.patch - ]; - stdenv = if stdenv.hostPlatform.useLLVM or false || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic) - then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc - else stdenv; - }; - - compiler-rt-no-libc = callPackage ../common/compiler-rt { - patches = [ - ./compiler-rt/X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config - ./compiler-rt/gnu-install-dirs.patch - # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the - # extra `/`. - ./compiler-rt/normalize-var.patch - # Prevent a compilation error on darwin - ./compiler-rt/darwin-targetconditionals.patch - # See: https://github.com/NixOS/nixpkgs/pull/186575 - ../common/compiler-rt/darwin-plistbuddy-workaround.patch - # See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893 - # ../common/compiler-rt/armv7l-15.patch - ]; - stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.clangNoCompilerRt - else stdenv; - }; - - # N.B. condition is safe because without useLLVM both are the same. - compiler-rt = if stdenv.hostPlatform.isAndroid || stdenv.hostPlatform.isDarwin - then libraries.compiler-rt-libc - else libraries.compiler-rt-no-libc; - - stdenv = overrideCC stdenv buildLlvmTools.clang; - - libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang; - - # `libcxx` requires a fairly modern C++ compiler, - # so: we use the clang from this LLVM package set instead of the regular - # stdenv's compiler. - libcxx = callPackage ../common/libcxx { - stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; - }; - - libunwind = callPackage ../common/libunwind { - patches = [ - ./libunwind/gnu-install-dirs.patch - ]; - stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; - }; - - openmp = callPackage ../common/openmp { - patches = [ - ./openmp/fix-find-tool.patch - ./openmp/gnu-install-dirs.patch - ./openmp/run-lit-directly.patch - ]; - }; - }); - noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ]; - -in { inherit tools libraries lldbPlugins; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools) diff --git a/pkgs/development/compilers/llvm/16/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/16/libunwind/gnu-install-dirs.patch deleted file mode 100644 index edfb2a8760bd..000000000000 --- a/pkgs/development/compilers/llvm/16/libunwind/gnu-install-dirs.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5a06805f05f1..86a50329e6a8 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -117,7 +117,7 @@ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH - - if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}) -- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH -+ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH - "Path where built libunwind libraries should be installed.") - if(LIBCXX_LIBDIR_SUBDIR) - string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) -@@ -129,7 +129,7 @@ else() - else() - set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) - endif() -- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH -+ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH - "Path where built libunwind libraries should be installed.") - endif() - diff --git a/pkgs/development/compilers/llvm/16/lld/add-table-base.patch b/pkgs/development/compilers/llvm/16/lld/add-table-base.patch deleted file mode 100644 index 15fc903a5e3f..000000000000 --- a/pkgs/development/compilers/llvm/16/lld/add-table-base.patch +++ /dev/null @@ -1,190 +0,0 @@ -From 93adcb770b99351b18553089c164fe3ef2119699 Mon Sep 17 00:00:00 2001 -From: Sam Clegg <sbc@chromium.org> -Date: Fri, 25 Aug 2023 13:56:16 -0700 -Subject: [PATCH] [lld][WebAssembly] Add `--table-base` setting - -This is similar to `--global-base` but determines where to place the -table segments rather than that data segments. - -See https://github.com/emscripten-core/emscripten/issues/20097 - -Differential Revision: https://reviews.llvm.org/D158892 ---- - test/wasm/table-base.s | 72 ++++++++++++++++++++++++++++++++++++++ - wasm/Driver.cpp | 19 ++++++++-- - wasm/Options.td | 5 ++- - wasm/Writer.cpp | 8 ----- - 4 files changed, 93 insertions(+), 11 deletions(-) - create mode 100644 test/wasm/table-base.s - -diff --git a/test/wasm/table-base.s b/test/wasm/table-base.s -new file mode 100644 -index 000000000000000..56fff414fd31d96 ---- /dev/null -+++ b/test/wasm/table-base.s -@@ -0,0 +1,72 @@ -+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o -+ -+# RUN: wasm-ld --export=__table_base -o %t.wasm %t.o -+# RUN: obj2yaml %t.wasm | FileCheck %s -check-prefix=CHECK-DEFAULT -+ -+# RUN: wasm-ld --table-base=100 --export=__table_base -o %t.wasm %t.o -+# RUN: obj2yaml %t.wasm | FileCheck %s -check-prefix=CHECK-100 -+ -+.globl _start -+_start: -+ .functype _start () -> () -+ i32.const _start -+ drop -+ end_function -+ -+# CHECK-DEFAULT: - Type: TABLE -+# CHECK-DEFAULT-NEXT: Tables: -+# CHECK-DEFAULT-NEXT: - Index: 0 -+# CHECK-DEFAULT-NEXT: ElemType: FUNCREF -+# CHECK-DEFAULT-NEXT: Limits: -+# CHECK-DEFAULT-NEXT: Flags: [ HAS_MAX ] -+# CHECK-DEFAULT-NEXT: Minimum: 0x2 -+# CHECK-DEFAULT-NEXT: Maximum: 0x2 -+ -+# CHECK-DEFAULT: - Type: GLOBAL -+# CHECK-DEFAULT-NEXT: Globals: -+# CHECK-DEFAULT-NEXT: - Index: 0 -+# CHECK-DEFAULT-NEXT: Type: I32 -+# CHECK-DEFAULT-NEXT: Mutable: true -+# CHECK-DEFAULT-NEXT: InitExpr: -+# CHECK-DEFAULT-NEXT: Opcode: I32_CONST -+# CHECK-DEFAULT-NEXT: Value: 66560 -+# CHECK-DEFAULT-NEXT: - Index: 1 -+# CHECK-DEFAULT-NEXT: Type: I32 -+# CHECK-DEFAULT-NEXT: Mutable: false -+# CHECK-DEFAULT-NEXT: InitExpr: -+# CHECK-DEFAULT-NEXT: Opcode: I32_CONST -+# CHECK-DEFAULT-NEXT: Value: 1 -+ -+# CHECK-DEFAULT: - Type: EXPORT -+# CHECK-DEFAULT: - Name: __table_base -+# CHECK-DEFAULT-NEXT: Kind: GLOBAL -+# CHECK-DEFAULT-NEXT: Index: 1 -+ -+# CHECK-100: - Type: TABLE -+# CHECK-100-NEXT: Tables: -+# CHECK-100-NEXT: - Index: 0 -+# CHECK-100-NEXT: ElemType: FUNCREF -+# CHECK-100-NEXT: Limits: -+# CHECK-100-NEXT: Flags: [ HAS_MAX ] -+# CHECK-100-NEXT: Minimum: 0x65 -+# CHECK-100-NEXT: Maximum: 0x65 -+ -+# CHECK-100: - Type: GLOBAL -+# CHECK-100-NEXT: Globals: -+# CHECK-100-NEXT: - Index: 0 -+# CHECK-100-NEXT: Type: I32 -+# CHECK-100-NEXT: Mutable: true -+# CHECK-100-NEXT: InitExpr: -+# CHECK-100-NEXT: Opcode: I32_CONST -+# CHECK-100-NEXT: Value: 66560 -+# CHECK-100-NEXT: - Index: 1 -+# CHECK-100-NEXT: Type: I32 -+# CHECK-100-NEXT: Mutable: false -+# CHECK-100-NEXT: InitExpr: -+# CHECK-100-NEXT: Opcode: I32_CONST -+# CHECK-100-NEXT: Value: 100 -+ -+# CHECK-100: - Type: EXPORT -+# CHECK-100: - Name: __table_base -+# CHECK-100-NEXT: Kind: GLOBAL -+# CHECK-100-NEXT: Index: 1 -diff --git a/wasm/Driver.cpp b/wasm/Driver.cpp -index 84304881f5ca34e..c2f5f0185781f36 100644 ---- a/wasm/Driver.cpp -+++ b/wasm/Driver.cpp -@@ -502,6 +502,7 @@ static void readConfigs(opt::InputArgList &args) { - - config->initialMemory = args::getInteger(args, OPT_initial_memory, 0); - config->globalBase = args::getInteger(args, OPT_global_base, 0); -+ config->tableBase = args::getInteger(args, OPT_table_base, 0); - config->maxMemory = args::getInteger(args, OPT_max_memory, 0); - config->zStackSize = - args::getZOptionValue(args, OPT_z, "stack-size", WasmPageSize); -@@ -573,6 +574,17 @@ static void setConfigs() { - if (config->exportTable) - error("-shared/-pie is incompatible with --export-table"); - config->importTable = true; -+ } else { -+ // Default table base. Defaults to 1, reserving 0 for the NULL function -+ // pointer. -+ if (!config->tableBase) -+ config->tableBase = 1; -+ // The default offset for static/global data, for when --global-base is -+ // not specified on the command line. The precise value of 1024 is -+ // somewhat arbitrary, and pre-dates wasm-ld (Its the value that -+ // emscripten used prior to wasm-ld). -+ if (!config->globalBase && !config->relocatable && !config->stackFirst) -+ config->globalBase = 1024; - } - - if (config->relocatable) { -@@ -666,8 +678,11 @@ static void checkOptions(opt::InputArgList &args) { - warn("-Bsymbolic is only meaningful when combined with -shared"); - } - -- if (config->globalBase && config->isPic) { -- error("--global-base may not be used with -shared/-pie"); -+ if (config->isPic) { -+ if (config->globalBase) -+ error("--global-base may not be used with -shared/-pie"); -+ if (config->tableBase) -+ error("--table-base may not be used with -shared/-pie"); - } - } - -diff --git a/wasm/Options.td b/wasm/Options.td -index 50417d2928e0a34..bb764396bf4df14 100644 ---- a/wasm/Options.td -+++ b/wasm/Options.td -@@ -191,7 +191,7 @@ def growable_table: FF<"growable-table">, - HelpText<"Remove maximum size from function table, allowing table to grow">; - - def global_base: JJ<"global-base=">, -- HelpText<"Where to start to place global data">; -+ HelpText<"Memory offset at which to place global data (Defaults to 1024)">; - - def import_memory: FF<"import-memory">, - HelpText<"Import the module's memory from the default module of \"env\" with the name \"memory\".">; -@@ -224,6 +224,9 @@ def no_entry: FF<"no-entry">, - def stack_first: FF<"stack-first">, - HelpText<"Place stack at start of linear memory rather than after data">; - -+def table_base: JJ<"table-base=">, -+ HelpText<"Table offset at which to place address taken functions (Defaults to 1)">; -+ - defm whole_archive: B<"whole-archive", - "Force load of all members in a static library", - "Do not force load of all members in a static library (default)">; -diff --git a/wasm/Writer.cpp b/wasm/Writer.cpp -index f25d358dc5bae6f..0576bf2907e49c4 100644 ---- a/wasm/Writer.cpp -+++ b/wasm/Writer.cpp -@@ -358,13 +358,6 @@ void Writer::layoutMemory() { - memoryPtr = config->globalBase; - } - } else { -- if (!config->globalBase && !config->relocatable && !config->isPic) { -- // The default offset for static/global data, for when --global-base is -- // not specified on the command line. The precise value of 1024 is -- // somewhat arbitrary, and pre-dates wasm-ld (Its the value that -- // emscripten used prior to wasm-ld). -- config->globalBase = 1024; -- } - memoryPtr = config->globalBase; - } - -@@ -1685,7 +1678,6 @@ void Writer::run() { - // For PIC code the table base is assigned dynamically by the loader. - // For non-PIC, we start at 1 so that accessing table index 0 always traps. - if (!config->isPic) { -- config->tableBase = 1; - if (WasmSym::definedTableBase) - WasmSym::definedTableBase->setVA(config->tableBase); - if (WasmSym::definedTableBase32) diff --git a/pkgs/development/compilers/llvm/16/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/16/lld/gnu-install-dirs.patch deleted file mode 100644 index 86e76f4a16d8..000000000000 --- a/pkgs/development/compilers/llvm/16/lld/gnu-install-dirs.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3d6225646fe6..9b5d0b15af13 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -33,10 +33,22 @@ if(LLD_BUILT_STANDALONE) - find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}") - list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}") - -- # Turn into CACHE PATHs for overwriting -- set(LLVM_INCLUDE_DIRS ${LLVM_INCLUDE_DIRS} CACHE PATH "Path to llvm/include and any other header dirs needed") -- set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}" CACHE PATH "Path to LLVM build tree") -- set(LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" CACHE PATH "Path to LLVM source tree") -+ # We can't check LLVM_CONFIG here, because find_package(LLVM ...) also sets -+ # LLVM_CONFIG. -+ if (NOT LLVM_CONFIG_FOUND) -+ # Pull values from LLVMConfig.cmake. We can drop this once the llvm-config -+ # path is removed. -+ set(INCLUDE_DIRS ${LLVM_INCLUDE_DIRS}) -+ set(LLVM_OBJ_DIR "${LLVM_BINARY_DIR}") -+ # N.B. this is just a default value, the CACHE PATHs below can be overridden. -+ set(MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm") -+ else() -+ set(INCLUDE_DIRS "${LLVM_BINARY_DIR}/include" "${MAIN_INCLUDE_DIR}") -+ endif() -+ -+ set(LLVM_INCLUDE_DIRS ${INCLUDE_DIRS} CACHE PATH "Path to llvm/include and any other header dirs needed") -+ set(LLVM_BINARY_DIR "${LLVM_OBJ_ROOT}" CACHE PATH "Path to LLVM build tree") -+ set(LLVM_MAIN_SRC_DIR "${MAIN_SRC_DIR}" CACHE PATH "Path to LLVM source tree") - - find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} - NO_DEFAULT_PATH) -diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake -index d3924f7243d4..42a7cd62281c 100644 ---- a/cmake/modules/AddLLD.cmake -+++ b/cmake/modules/AddLLD.cmake -@@ -18,8 +18,8 @@ macro(add_lld_library name) - install(TARGETS ${name} - COMPONENT ${name} - ${export_to_lldtargets} -- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} -- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - - if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES) diff --git a/pkgs/development/compilers/llvm/16/lldb/cpu_subtype_arm64e_replacement.patch b/pkgs/development/compilers/llvm/16/lldb/cpu_subtype_arm64e_replacement.patch deleted file mode 100644 index 20d35c9f3ea9..000000000000 --- a/pkgs/development/compilers/llvm/16/lldb/cpu_subtype_arm64e_replacement.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/source/Host/macosx/objcxx/HostInfoMacOSX.mm ---- a/source/Host/macosx/objcxx/HostInfoMacOSX.mm -+++ b/source/Host/macosx/objcxx/HostInfoMacOSX.mm -@@ -233,7 +233,7 @@ void HostInfoMacOSX::ComputeHostArchitectureSupport(ArchSpec &arch_32, - len = sizeof(is_64_bit_capable); - ::sysctlbyname("hw.cpu64bit_capable", &is_64_bit_capable, &len, NULL, 0); - -- if (cputype == CPU_TYPE_ARM64 && cpusubtype == CPU_SUBTYPE_ARM64E) { -+ if (cputype == CPU_TYPE_ARM64 && cpusubtype == ((cpu_subtype_t) 2)) { // CPU_SUBTYPE_ARM64E is not available in the macOS 10.12 headers - // The arm64e architecture is a preview. Pretend the host architecture - // is arm64. - cpusubtype = CPU_SUBTYPE_ARM64_ALL; diff --git a/pkgs/development/compilers/llvm/16/lldb/procfs.patch b/pkgs/development/compilers/llvm/16/lldb/procfs.patch deleted file mode 100644 index 7b200e86505c..000000000000 --- a/pkgs/development/compilers/llvm/16/lldb/procfs.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/source/Plugins/Process/Linux/Procfs.h -+++ b/source/Plugins/Process/Linux/Procfs.h -@@ -10,6 +10,13 @@ - // sys/procfs.h on Android/Linux for all supported architectures. - - #include <sys/ptrace.h> -+#include <asm/ptrace.h> -+ -+// on i686 preprocessor symbols with these register names are defined as -+// numeric constants; these symbols clash with identifier names used in -+// `llvm/Support/VirtualFileSystem.h` and `llvm/ADT/SmallVector.h` -+#undef FS -+#undef CS - - #include "lldb/lldb-types.h" - -@@ -17,23 +24,13 @@ - - #include <vector> - --#ifdef __ANDROID__ --#if defined(__arm64__) || defined(__aarch64__) --typedef unsigned long elf_greg_t; --typedef elf_greg_t -- elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))]; --typedef struct user_fpsimd_state elf_fpregset_t; --#ifndef NT_FPREGSET --#define NT_FPREGSET NT_PRFPREG --#endif // NT_FPREGSET --#elif defined(__mips__) --#ifndef NT_FPREGSET --#define NT_FPREGSET NT_PRFPREG --#endif // NT_FPREGSET --#endif --#else // __ANDROID__ -+#if !defined(__GLIBC__) && defined(__powerpc__) -+#define pt_regs musl_pt_regs -+#include <sys/procfs.h> -+#undef pt_regs -+#else - #include <sys/procfs.h> --#endif // __ANDROID__ -+#endif - - namespace lldb_private { - namespace process_linux { diff --git a/pkgs/development/compilers/llvm/16/lldb/resource-dir.patch b/pkgs/development/compilers/llvm/16/lldb/resource-dir.patch deleted file mode 100644 index 3e1a8b7d7142..000000000000 --- a/pkgs/development/compilers/llvm/16/lldb/resource-dir.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake -index ec06ba285f27..286162f098fb 100644 ---- a/cmake/modules/LLDBConfig.cmake -+++ b/cmake/modules/LLDBConfig.cmake -@@ -290,7 +290,8 @@ if (NOT TARGET clang-resource-headers) - # could be and pick the first that exists. - foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}" - "${LLVM_BUILD_LIBRARY_DIR}" -- "${LLVM_LIBRARY_DIR}") -+ "${LLVM_LIBRARY_DIR}" -+ "@clangLibDir@") - # Build the resource directory path by appending 'clang/<version number>'. - set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}") - if (IS_DIRECTORY "${CANDIDATE_RESOURCE_DIR}") diff --git a/pkgs/development/compilers/llvm/16/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/16/llvm/gnu-install-dirs-polly.patch deleted file mode 100644 index b01363e98aa0..000000000000 --- a/pkgs/development/compilers/llvm/16/llvm/gnu-install-dirs-polly.patch +++ /dev/null @@ -1,19 +0,0 @@ -This is the one remaining Polly install dirs related change that hasn't made it -into upstream yet; previously this patch file also included: -https://reviews.llvm.org/D117541 - -diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake -index 518a09b45a42..bd9d6f5542ad 100644 ---- a/tools/polly/cmake/polly_macros.cmake -+++ b/tools/polly/cmake/polly_macros.cmake -@@ -44,8 +44,8 @@ macro(add_polly_library name) - if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly") - install(TARGETS ${name} - EXPORT LLVMExports -- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} -- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) - endif() - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) - endmacro(add_polly_library) diff --git a/pkgs/development/compilers/llvm/16/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/16/llvm/gnu-install-dirs.patch deleted file mode 100644 index 1c2d52d59ef2..000000000000 --- a/pkgs/development/compilers/llvm/16/llvm/gnu-install-dirs.patch +++ /dev/null @@ -1,161 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7e25e0407db2..72f031a82b75 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -995,7 +995,7 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "") - add_subdirectory(${TENSORFLOW_AOT_PATH}/xla_aot_runtime_src - ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime) - install(TARGETS tf_xla_runtime EXPORT LLVMExports -- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime) -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime) - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS tf_xla_runtime) - # Once we add more modules, we should handle this more automatically. - if (DEFINED LLVM_OVERRIDE_MODEL_HEADER_INLINERSIZEMODEL) -diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake -index 93e6d67551de..8d367457af5a 100644 ---- a/cmake/modules/AddLLVM.cmake -+++ b/cmake/modules/AddLLVM.cmake -@@ -874,8 +874,8 @@ macro(add_llvm_library name) - get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella}) - install(TARGETS ${name} - ${export_to_llvmexports} -- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} -- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" COMPONENT ${name} -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" COMPONENT ${name} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name}) - - if (NOT LLVM_ENABLE_IDE) -@@ -2043,7 +2043,7 @@ function(llvm_install_library_symlink name dest type) - set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX}) - set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX}) - -- set(output_dir lib${LLVM_LIBDIR_SUFFIX}) -+ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) - if(WIN32 AND "${type}" STREQUAL "SHARED") - set(output_dir "${CMAKE_INSTALL_BINDIR}") - endif() -@@ -2312,16 +2312,37 @@ function(llvm_setup_rpath name) - - if (APPLE) - set(_install_name_dir INSTALL_NAME_DIR "@rpath") -- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) -+ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS) - # $ORIGIN is not interpreted at link time by aix ld. - # Since BUILD_SHARED_LIBS is only recommended for use by developers, - # hardcode the rpath to build/install lib dir first in this mode. - # FIXME: update this when there is better solution. -- set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) -+ set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) - elseif(UNIX) -- set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) -- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}") -+ # Note that we add `extra_libdir` (aka `LLVM_LIBRARY_DIR` in our case) back -+ # to `_install_rpath` here. -+ # -+ # In nixpkgs we do not build and install LLVM alongside rdeps of LLVM (i.e. -+ # clang); instead LLVM is its own package and thus lands at its own nix -+ # store path. This makes it so that the default relative rpath (`../lib/`) -+ # does not point at the LLVM shared objects. -+ # -+ # More discussion here: -+ # - https://github.com/NixOS/nixpkgs/pull/235624#discussion_r1220150329 -+ # - https://reviews.llvm.org/D146918 (16.0.5+) -+ # -+ # Note that we leave `extra_libdir` in `_build_rpath`: without FHS there is -+ # no potential that this will result in us pulling in the "wrong" LLVM. -+ # Adding this to the build rpath means we aren't forced to use -+ # `installCheckPhase` instead of `checkPhase` (i.e. binaries in the build -+ # dir, pre-install, will have the right rpath for LLVM). -+ # -+ # As noted in the differential above, an alternative solution is to have -+ # all rdeps of nixpkgs' LLVM (that use the AddLLVM.cmake machinery) set -+ # `CMAKE_INSTALL_RPATH`. -+ set(_build_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) -+ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) - if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") - set_property(TARGET ${name} APPEND_STRING PROPERTY - LINK_FLAGS " -Wl,-z,origin ") -diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake -index 891c9e6d618c..8d963f3b0069 100644 ---- a/cmake/modules/AddOCaml.cmake -+++ b/cmake/modules/AddOCaml.cmake -@@ -147,9 +147,9 @@ function(add_ocaml_library name) - endforeach() - - if( APPLE ) -- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}") -+ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}") - elseif( UNIX ) -- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}") -+ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}") - endif() - list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}") - -diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt -index d99af79aa38e..21e794224b99 100644 ---- a/cmake/modules/CMakeLists.txt -+++ b/cmake/modules/CMakeLists.txt -@@ -127,7 +127,7 @@ set(LLVM_CONFIG_INCLUDE_DIRS - ) - list(REMOVE_DUPLICATES LLVM_CONFIG_INCLUDE_DIRS) - --extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "lib\${LLVM_LIBDIR_SUFFIX}") -+extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}") - set(LLVM_CONFIG_LIBRARY_DIRS - "${LLVM_CONFIG_LIBRARY_DIR}" - # FIXME: Should there be other entries here? -diff --git a/docs/CMake.rst b/docs/CMake.rst -index 7926de258ec8..5ae01adc3905 100644 ---- a/docs/CMake.rst -+++ b/docs/CMake.rst -@@ -250,7 +250,7 @@ description is in `LLVM-related variables`_ below. - **LLVM_LIBDIR_SUFFIX**:STRING - Extra suffix to append to the directory where libraries are to be - installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64`` -- to install libraries to ``/usr/lib64``. -+ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``. - - **LLVM_PARALLEL_{COMPILE,LINK}_JOBS**:STRING - Building the llvm toolchain can use a lot of resources, particularly -@@ -284,6 +284,10 @@ manual, or execute ``cmake --help-variable VARIABLE_NAME``. - The path to install executables, relative to the *CMAKE_INSTALL_PREFIX*. - Defaults to "bin". - -+**CMAKE_INSTALL_LIBDIR**:PATH -+ The path to install libraries, relative to the *CMAKE_INSTALL_PREFIX*. -+ Defaults to "lib". -+ - **CMAKE_INSTALL_INCLUDEDIR**:PATH - The path to install header files, relative to the *CMAKE_INSTALL_PREFIX*. - Defaults to "include". -diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in -index 370005cd8d7d..7e790bc52111 100644 ---- a/tools/llvm-config/BuildVariables.inc.in -+++ b/tools/llvm-config/BuildVariables.inc.in -@@ -23,6 +23,7 @@ - #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@" - #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" - #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@" -+#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@" - #define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@" - #define LLVM_INSTALL_PACKAGE_DIR "@LLVM_INSTALL_PACKAGE_DIR@" - #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" -diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp -index b1d795a0a349..de6cb1514f05 100644 ---- a/tools/llvm-config/llvm-config.cpp -+++ b/tools/llvm-config/llvm-config.cpp -@@ -366,7 +366,11 @@ int main(int argc, char **argv) { - sys::fs::make_absolute(ActivePrefix, Path); - ActiveBinDir = std::string(Path.str()); - } -- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; -+ { -+ SmallString<256> Path(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX); -+ sys::fs::make_absolute(ActivePrefix, Path); -+ ActiveLibDir = std::string(Path.str()); -+ } - { - SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); - sys::fs::make_absolute(ActivePrefix, Path); diff --git a/pkgs/development/compilers/llvm/16/llvm/lit-shell-script-runner-set-dyld-library-path.patch b/pkgs/development/compilers/llvm/16/llvm/lit-shell-script-runner-set-dyld-library-path.patch deleted file mode 100644 index 82b7b21c55fb..000000000000 --- a/pkgs/development/compilers/llvm/16/llvm/lit-shell-script-runner-set-dyld-library-path.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py -index 0242e0b75af3..d732011306f7 100644 ---- a/utils/lit/lit/TestRunner.py -+++ b/utils/lit/lit/TestRunner.py -@@ -1029,6 +1029,12 @@ def executeScript(test, litConfig, tmpBase, commands, cwd): - f.write('@echo off\n') - f.write('\n@if %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands)) - else: -+ # This env var is *purged* when invoking subprocesses so we have to -+ # manually set it from within the bash script in order for the commands -+ # in run lines to see this var: -+ if "DYLD_LIBRARY_PATH" in test.config.environment: -+ f.write(f'export DYLD_LIBRARY_PATH="{test.config.environment["DYLD_LIBRARY_PATH"]}"\n') -+ - for i, ln in enumerate(commands): - match = re.match(kPdbgRegex, ln) - if match: diff --git a/pkgs/development/compilers/llvm/16/llvm/llvm-lit-cfg-add-libs-to-dylib-path.patch b/pkgs/development/compilers/llvm/16/llvm/llvm-lit-cfg-add-libs-to-dylib-path.patch deleted file mode 100644 index d824516c0a16..000000000000 --- a/pkgs/development/compilers/llvm/16/llvm/llvm-lit-cfg-add-libs-to-dylib-path.patch +++ /dev/null @@ -1,79 +0,0 @@ -diff --git a/test/Unit/lit.cfg.py b/test/Unit/lit.cfg.py -index 81e8dc04acea..479ff95681e2 100644 ---- a/test/Unit/lit.cfg.py -+++ b/test/Unit/lit.cfg.py -@@ -3,6 +3,7 @@ - # Configuration file for the 'lit' test runner. - - import os -+import platform - import subprocess - - import lit.formats -@@ -55,3 +56,26 @@ if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir): - # Win32 may use %SYSTEMDRIVE% during file system shell operations, so propogate. - if sys.platform == 'win32' and 'SYSTEMDRIVE' in os.environ: - config.environment['SYSTEMDRIVE'] = os.environ['SYSTEMDRIVE'] -+ -+# Add the LLVM dynamic libs to the platform-specific loader search path env var: -+# -+# TODO: this is copied from `clang`'s `lit.cfg.py`; should unify.. -+def find_shlibpath_var(): -+ if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'OpenBSD', 'SunOS']: -+ yield 'LD_LIBRARY_PATH' -+ elif platform.system() == 'Darwin': -+ yield 'DYLD_LIBRARY_PATH' -+ elif platform.system() == 'Windows': -+ yield 'PATH' -+ elif platform.system() == 'AIX': -+ yield 'LIBPATH' -+ -+for shlibpath_var in find_shlibpath_var(): -+ shlibpath = os.path.pathsep.join( -+ (config.shlibdir, -+ config.environment.get(shlibpath_var, ''))) -+ config.environment[shlibpath_var] = shlibpath -+ break -+else: -+ lit_config.warning("unable to inject shared library path on '{}'" -+ .format(platform.system())) -diff --git a/test/lit.cfg.py b/test/lit.cfg.py -index 75a38b4c5dad..856fc75c9d74 100644 ---- a/test/lit.cfg.py -+++ b/test/lit.cfg.py -@@ -42,6 +42,26 @@ llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True) - llvm_config.with_system_environment( - ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP']) - -+# Add the LLVM dynamic libs to the platform-specific loader search path env var: -+# -+# TODO: this is copied from `clang`'s `lit.cfg.py`; should unify.. -+def find_shlibpath_var(): -+ if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'OpenBSD', 'SunOS']: -+ yield 'LD_LIBRARY_PATH' -+ elif platform.system() == 'Darwin': -+ yield 'DYLD_LIBRARY_PATH' -+ elif platform.system() == 'Windows': -+ yield 'PATH' -+ elif platform.system() == 'AIX': -+ yield 'LIBPATH' -+ -+for shlibpath_var in find_shlibpath_var(): -+ shlibpath = config.llvm_shlib_dir -+ llvm_config.with_environment(shlibpath_var, shlibpath, append_path = True) -+ break -+else: -+ lit_config.warning("unable to inject shared library path on '{}'" -+ .format(platform.system())) - - # Set up OCAMLPATH to include newly built OCaml libraries. - top_ocaml_lib = os.path.join(config.llvm_lib_dir, 'ocaml') -@@ -318,7 +338,7 @@ def have_cxx_shared_library(): - - try: - readobj_cmd = subprocess.Popen( -- [readobj_exe, '--needed-libs', readobj_exe], stdout=subprocess.PIPE) -+ [readobj_exe, '--needed-libs', readobj_exe], stdout=subprocess.PIPE, env=config.environment) - except OSError: - print('could not exec llvm-readobj') - return False diff --git a/pkgs/development/compilers/llvm/16/llvm/polly-lit-cfg-add-libs-to-dylib-path.patch b/pkgs/development/compilers/llvm/16/llvm/polly-lit-cfg-add-libs-to-dylib-path.patch deleted file mode 100644 index 1354ad267314..000000000000 --- a/pkgs/development/compilers/llvm/16/llvm/polly-lit-cfg-add-libs-to-dylib-path.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/tools/polly/test/lit.cfg b/tools/polly/test/lit.cfg -index 41e3a589c61e..09f3b17498b0 100644 ---- a/tools/polly/test/lit.cfg -+++ b/tools/polly/test/lit.cfg -@@ -36,9 +36,17 @@ base_paths = [config.llvm_tools_dir, config.environment['PATH']] - path = os.path.pathsep.join(base_paths + config.extra_paths) - config.environment['PATH'] = path - -+# (Copied from polly/test/Unit/lit.cfg) -+if platform.system() == 'Darwin': -+ shlibpath_var = 'DYLD_LIBRARY_PATH' -+elif platform.system() == 'Windows': -+ shlibpath_var = 'PATH' -+else: -+ shlibpath_var = 'LD_LIBRARY_PATH' -+ - path = os.path.pathsep.join((config.llvm_libs_dir, -- config.environment.get('LD_LIBRARY_PATH',''))) --config.environment['LD_LIBRARY_PATH'] = path -+ config.environment.get(shlibpath_var,''))) -+config.environment[shlibpath_var] = path - - llvm_config.use_default_substitutions() - diff --git a/pkgs/development/compilers/llvm/16/openmp/fix-find-tool.patch b/pkgs/development/compilers/llvm/16/openmp/fix-find-tool.patch deleted file mode 100644 index dd0a79f1d325..000000000000 --- a/pkgs/development/compilers/llvm/16/openmp/fix-find-tool.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/libomptarget/DeviceRTL/CMakeLists.txt b/libomptarget/DeviceRTL/CMakeLists.txt -index 49b398c9f765..6f1dd1340010 100644 ---- a/libomptarget/DeviceRTL/CMakeLists.txt -+++ b/libomptarget/DeviceRTL/CMakeLists.txt -@@ -27,11 +27,11 @@ endif() - if (LLVM_DIR) - # Builds that use pre-installed LLVM have LLVM_DIR set. - # A standalone or LLVM_ENABLE_RUNTIMES=openmp build takes this route -- find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) -- find_program(PACKAGER_TOOL clang-offload-packager PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) -- find_program(LINK_TOOL llvm-link PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) -- find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) -- find_program(EXTRACT_TOOL llvm-extract PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) -+ find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR}) -+ find_program(PACKAGER_TOOL clang-offload-packager PATHS ${LLVM_TOOLS_BINARY_DIR}) -+ find_program(LINK_TOOL llvm-link PATHS ${LLVM_TOOLS_BINARY_DIR}) -+ find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR}) -+ find_program(EXTRACT_TOOL llvm-extract PATHS ${LLVM_TOOLS_BINARY_DIR}) - if ((NOT CLANG_TOOL) OR (NOT LINK_TOOL) OR (NOT OPT_TOOL) OR (NOT EXTRACT_TOOL) OR (NOT PACKAGER_TOOL)) - libomptarget_say("Not building DeviceRTL. Missing clang: ${CLANG_TOOL}, llvm-link: ${LINK_TOOL}, opt: ${OPT_TOOL}, llvm-extract: ${EXTRACT_TOOL}, or clang-offload-packager: ${PACKAGER_TOOL}") - return() diff --git a/pkgs/development/compilers/llvm/16/openmp/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/16/openmp/gnu-install-dirs.patch deleted file mode 100644 index 77a93208832a..000000000000 --- a/pkgs/development/compilers/llvm/16/openmp/gnu-install-dirs.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b6ddbe90516d..311ab1d50e7f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -29,7 +29,7 @@ if (OPENMP_STANDALONE_BUILD) - set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING - "Suffix of lib installation directory, e.g. 64 => lib64") - # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR. -- set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}") -+ set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}${OPENMP_LIBDIR_SUFFIX}") - - # Group test settings. - set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING -@@ -40,7 +40,7 @@ if (OPENMP_STANDALONE_BUILD) - else() - set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR}) - # If building in tree, we honor the same install suffix LLVM uses. -- set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}") -+ set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}") - - if (NOT MSVC) - set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang) diff --git a/pkgs/development/compilers/llvm/16/openmp/run-lit-directly.patch b/pkgs/development/compilers/llvm/16/openmp/run-lit-directly.patch deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/pkgs/development/compilers/llvm/16/openmp/run-lit-directly.patch +++ /dev/null |