Merge pull request #329305 from ExpidusOS/feat/llvm-19
llvmPackages_19: init
This commit is contained in:
commit
109e5635e0
@ -0,0 +1,71 @@
|
||||
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
|
||||
index 75b0080f6..c895b884c 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 e6ae4e19e..5ef01aea2 100644
|
||||
--- a/lib/Headers/CMakeLists.txt
|
||||
+++ b/lib/Headers/CMakeLists.txt
|
||||
@@ -337,6 +337,7 @@ set(llvm_libc_wrapper_files
|
||||
|
||||
include(GetClangResourceDir)
|
||||
get_clang_resource_dir(output_dir PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. SUBDIR include)
|
||||
+set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR}/include)
|
||||
set(out_files)
|
||||
set(generated_files)
|
||||
|
||||
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
|
||||
index b5b6d2807..6b592d255 100644
|
||||
--- a/tools/libclang/CMakeLists.txt
|
||||
+++ b/tools/libclang/CMakeLists.txt
|
||||
@@ -246,7 +246,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 3aca22c0b..3115353e3 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()
|
||||
|
25
pkgs/development/compilers/llvm/19/clang/purity.patch
Normal file
25
pkgs/development/compilers/llvm/19/clang/purity.patch
Normal file
@ -0,0 +1,25 @@
|
||||
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 | 3 ---
|
||||
1 file changed, 3 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
|
||||
@@ -446,9 +446,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
ToolChain.isPIEDefault(Args));
|
||||
if (IsPIE)
|
||||
CmdArgs.push_back("-pie");
|
||||
- CmdArgs.push_back("-dynamic-linker");
|
||||
- CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
|
||||
- ToolChain.getDynamicLinker(Args)));
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.11.0
|
@ -0,0 +1,21 @@
|
||||
diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
|
||||
index 3a66dd9c3fb..7efc85d9f9f 100644
|
||||
--- a/lib/builtins/CMakeLists.txt
|
||||
+++ b/lib/builtins/CMakeLists.txt
|
||||
@@ -348,4 +348,8 @@ if (NOT MSVC)
|
||||
|
||||
+ set(i486_SOURCES ${i386_SOURCES})
|
||||
+ set(i586_SOURCES ${i386_SOURCES})
|
||||
+ set(i686_SOURCES ${i386_SOURCES})
|
||||
+
|
||||
if (WIN32)
|
||||
set(i386_SOURCES
|
||||
${i386_SOURCES}
|
||||
@@ -723,6 +723,7 @@ else ()
|
||||
endif()
|
||||
|
||||
foreach (arch ${BUILTIN_SUPPORTED_ARCH})
|
||||
+ message("arch: ${arch}")
|
||||
if (CAN_TARGET_${arch})
|
||||
# For ARM archs, exclude any VFP builtins if VFP is not supported
|
||||
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
|
@ -0,0 +1,71 @@
|
||||
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() {
|
@ -0,0 +1,16 @@
|
||||
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}\"")
|
@ -0,0 +1,31 @@
|
||||
From 9c1cb26c1dd3f92d1c1177e548107d2cd3c5e616 Mon Sep 17 00:00:00 2001
|
||||
From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com>
|
||||
Date: Fri, 23 Feb 2024 22:58:58 +0000
|
||||
Subject: [PATCH] darwin 10.12 mbstate_t fix
|
||||
|
||||
https://github.com/llvm/llvm-project/issues/64226
|
||||
|
||||
removes space from
|
||||
https://github.com/macports/macports-ports/raw/acd8acb171f1658596ed1cf25da48d5b932e2d19/lang/llvm-17/files/0042-mbstate_t-not-defined.patch
|
||||
so it applies cleanly
|
||||
---
|
||||
libcxx/include/__mbstate_t.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/libcxx/include/__mbstate_t.h b/libcxx/include/__mbstate_t.h
|
||||
index bfa6d61..5f51112 100644
|
||||
--- a/libcxx/include/__mbstate_t.h
|
||||
+++ b/libcxx/include/__mbstate_t.h
|
||||
@@ -42,6 +42,9 @@
|
||||
#elif __has_include(<bits/types/mbstate_t.h>)
|
||||
# include <bits/types/mbstate_t.h> // works on most Unixes
|
||||
#elif __has_include(<sys/_types/_mbstate_t.h>)
|
||||
+# if __has_include(<machine/_types.h>)
|
||||
+# include <machine/_types.h>
|
||||
+# endif
|
||||
# include <sys/_types/_mbstate_t.h> // works on Darwin
|
||||
#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)
|
||||
# include_next <wchar.h> // fall back to the C standard provider of mbstate_t
|
||||
--
|
||||
2.43.0
|
||||
|
@ -0,0 +1,15 @@
|
||||
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)
|
@ -0,0 +1,12 @@
|
||||
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;
|
46
pkgs/development/compilers/llvm/19/lldb/procfs.patch
Normal file
46
pkgs/development/compilers/llvm/19/lldb/procfs.patch
Normal file
@ -0,0 +1,46 @@
|
||||
--- 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 {
|
@ -0,0 +1,13 @@
|
||||
--- a/tools/polly/cmake/polly_macros.cmake 2024-03-15 17:36:20.550893344 -0700
|
||||
+++ b/tools/polly/cmake/polly_macros.cmake 2024-03-15 17:37:06.277332960 -0700
|
||||
@@ -45,8 +45,8 @@
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${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})
|
||||
add_llvm_install_targets(install-${name}
|
||||
COMPONENT ${name})
|
||||
endif()
|
137
pkgs/development/compilers/llvm/19/llvm/gnu-install-dirs.patch
Normal file
137
pkgs/development/compilers/llvm/19/llvm/gnu-install-dirs.patch
Normal file
@ -0,0 +1,137 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 471817d68286..c51463304159 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1010,7 +1010,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 230620c37027..dd16cab1835e 100644
|
||||
--- a/cmake/modules/AddLLVM.cmake
|
||||
+++ b/cmake/modules/AddLLVM.cmake
|
||||
@@ -876,8 +876,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)
|
||||
@@ -2069,7 +2069,7 @@ function(llvm_install_library_symlink name dest type)
|
||||
set(LLVM_LINK_OR_COPY copy)
|
||||
endif()
|
||||
|
||||
- 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()
|
||||
@@ -2344,16 +2344,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 ${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/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
|
||||
+ set(_install_rpath ${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 ${LLVM_LIBRARY_DIR})
|
||||
elseif( UNIX )
|
||||
- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
|
||||
+ set(ocaml_rpath ${LLVM_LIBRARY_DIR})
|
||||
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/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 e86eb2b44b10..f63e207e792e 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);
|
@ -0,0 +1,12 @@
|
||||
--- a/utils/lit/lit/TestRunner.py 2024-03-15 17:27:53.170780798 -0700
|
||||
+++ b/utils/lit/lit/TestRunner.py 2024-03-15 17:28:43.277447791 -0700
|
||||
@@ -1183,6 +1183,9 @@
|
||||
f.write("@echo on\n")
|
||||
f.write("\n@if %ERRORLEVEL% NEQ 0 EXIT\n".join(commands))
|
||||
else:
|
||||
+ 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.fullmatch(kPdbgRegex, ln)
|
||||
if match:
|
@ -0,0 +1,80 @@
|
||||
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")
|
||||
|
@ -0,0 +1,24 @@
|
||||
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()
|
||||
|
@ -0,0 +1,17 @@
|
||||
diff --git a/libomptarget/DeviceRTL/CMakeLists.txt b/libomptarget/DeviceRTL/CMakeLists.txt
|
||||
index 630947abec7e..9f032dc7bd3f 100644
|
||||
--- a/libomptarget/DeviceRTL/CMakeLists.txt
|
||||
+++ b/libomptarget/DeviceRTL/CMakeLists.txt
|
||||
@@ -27,10 +27,10 @@ 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(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR})
|
||||
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(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR})
|
||||
if ((NOT CLANG_TOOL) OR (NOT LINK_TOOL) OR (NOT OPT_TOOL) OR (NOT PACKAGER_TOOL))
|
||||
libomptarget_say("Not building DeviceRTL. Missing clang: ${CLANG_TOOL}, llvm-link: ${LINK_TOOL}, opt: ${OPT_TOOL}, or clang-offload-packager: ${PACKAGER_TOOL}")
|
||||
return()
|
@ -22,6 +22,7 @@ let
|
||||
"16.0.6".officialRelease.sha256 = "sha256-fspqSReX+VD+Nl/Cfq+tDcdPtnQPV1IRopNDfd5VtUs=";
|
||||
"17.0.6".officialRelease.sha256 = "sha256-8MEDLLhocshmxoEBRSKlJ/GzJ8nfuzQ8qn0X/vLA+ag=";
|
||||
"18.1.8".officialRelease.sha256 = "sha256-iiZKMRo/WxJaBXct9GdAcAT3cz9d9pnAcO1mmR6oPNE=";
|
||||
"19.1.0-rc1".officialRelease.sha256 = "sha256-uaM+CKE+l+ksLtfhVMTLXbLlu+lUZScf+ucBcRENSDM=";
|
||||
"19.0.0-git".gitRelease = {
|
||||
rev = "d15ada24b1fbbd72776022383a5c557a1a056413";
|
||||
rev-version = "19.0.0-unstable-2024-07-21";
|
||||
@ -49,31 +50,28 @@ let
|
||||
attrName =
|
||||
args.name or (if (gitRelease != null) then "git" else lib.versions.major release_version);
|
||||
in
|
||||
callPackage ./common {
|
||||
inherit (stdenvAdapters) overrideCC;
|
||||
buildLlvmTools = buildPackages."llvmPackages_${attrName}".tools;
|
||||
targetLlvmLibraries =
|
||||
targetPackages."llvmPackages_${attrName}".libraries or llvmPackages."${attrName}".libraries;
|
||||
targetLlvm = targetPackages."llvmPackages_${attrName}".llvm or llvmPackages."${attrName}".llvm;
|
||||
stdenv =
|
||||
if (lib.versions.major release_version == "13" && stdenv.cc.cc.isGNU or false) then
|
||||
gcc12Stdenv
|
||||
else
|
||||
stdenv; # does not build with gcc13
|
||||
inherit bootBintoolsNoLibc bootBintools;
|
||||
inherit
|
||||
officialRelease
|
||||
gitRelease
|
||||
monorepoSrc
|
||||
version
|
||||
;
|
||||
};
|
||||
lib.nameValuePair attrName (
|
||||
callPackage ./common {
|
||||
inherit (stdenvAdapters) overrideCC;
|
||||
buildLlvmTools = buildPackages."llvmPackages_${attrName}".tools;
|
||||
targetLlvmLibraries =
|
||||
targetPackages."llvmPackages_${attrName}".libraries or llvmPackages."${attrName}".libraries;
|
||||
targetLlvm = targetPackages."llvmPackages_${attrName}".llvm or llvmPackages."${attrName}".llvm;
|
||||
stdenv =
|
||||
if (lib.versions.major release_version == "13" && stdenv.cc.cc.isGNU or false) then
|
||||
gcc12Stdenv
|
||||
else
|
||||
stdenv; # does not build with gcc13
|
||||
inherit bootBintoolsNoLibc bootBintools;
|
||||
inherit
|
||||
officialRelease
|
||||
gitRelease
|
||||
monorepoSrc
|
||||
version
|
||||
;
|
||||
}
|
||||
);
|
||||
|
||||
llvmPackages = lib.mapAttrs' (
|
||||
version: args:
|
||||
lib.nameValuePair (if (args ? gitRelease) then "git" else lib.versions.major version) (
|
||||
mkPackage (args // { inherit version; })
|
||||
)
|
||||
) versions;
|
||||
llvmPackages = lib.mapAttrs' (version: args: mkPackage (args // { inherit version; })) versions;
|
||||
in
|
||||
llvmPackages
|
||||
|
@ -15990,6 +15990,12 @@ with pkgs;
|
||||
lldb_18 = llvmPackages_18.lldb;
|
||||
llvm_18 = llvmPackages_18.llvm;
|
||||
|
||||
llvmPackages_19 = llvmPackagesSet."19";
|
||||
clang_19 = llvmPackages_19.clang;
|
||||
lld_19 = llvmPackages_19.lld;
|
||||
lldb_19 = llvmPackages_19.lldb;
|
||||
llvm_19 = llvmPackages_19.llvm;
|
||||
|
||||
llvmPackages_git = llvmPackagesSet.git;
|
||||
}) llvmPackages_13
|
||||
llvmPackages_14
|
||||
@ -16001,6 +16007,11 @@ with pkgs;
|
||||
lld_18
|
||||
lldb_18
|
||||
llvm_18
|
||||
llvmPackages_19
|
||||
clang_19
|
||||
lld_19
|
||||
lldb_19
|
||||
llvm_19
|
||||
llvmPackages_git;
|
||||
|
||||
lorri = callPackage ../tools/misc/lorri {
|
||||
|
Loading…
Reference in New Issue
Block a user