Merge pull request #133148 from primeos/llvmPackages_git
llvmPackages_git: Forward port the patches from llvmPackages_12
This commit is contained in:
commit
fff53fa030
@ -1,4 +1,4 @@
|
||||
{ lib, stdenv, llvm_meta, src, cmake, libxml2, libllvm, version, python3
|
||||
{ lib, stdenv, llvm_meta, src, substituteAll, cmake, libxml2, libllvm, version, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
@ -37,6 +37,10 @@ let
|
||||
./purity.patch
|
||||
# https://reviews.llvm.org/D51899
|
||||
./gnu-install-dirs.patch
|
||||
(substituteAll {
|
||||
src = ../../clang-11-12-LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
@ -52,12 +56,7 @@ let
|
||||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
@ -2,9 +2,7 @@ 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
|
||||
@@ -301,6 +301,10 @@ if (NOT MSVC)
|
||||
i386/umoddi3.S
|
||||
)
|
||||
@@ -345,4 +345,8 @@ if (NOT MSVC)
|
||||
|
||||
+ set(i486_SOURCES ${i386_SOURCES})
|
||||
+ set(i586_SOURCES ${i386_SOURCES})
|
||||
|
@ -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() {
|
@ -60,6 +60,8 @@ stdenv.mkDerivation {
|
||||
# extra `/`.
|
||||
./normalize-var.patch
|
||||
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
# Prevent a compilation error on darwin
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin ./darwin-targetconditionals.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
|
@ -19,6 +19,7 @@
|
||||
, Carbon
|
||||
, Cocoa
|
||||
, lit
|
||||
, makeWrapper
|
||||
, enableManpages ? false
|
||||
}:
|
||||
|
||||
@ -42,7 +43,7 @@ stdenv.mkDerivation (rec {
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake python3 which swig lit
|
||||
cmake python3 which swig lit makeWrapper
|
||||
] ++ lib.optionals enableManpages [
|
||||
python3.pkgs.sphinx python3.pkgs.recommonmark
|
||||
];
|
||||
@ -84,7 +85,15 @@ stdenv.mkDerivation (rec {
|
||||
|
||||
doCheck = false;
|
||||
|
||||
installCheckPhase = ''
|
||||
if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
|
||||
return 1;
|
||||
fi
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
|
||||
|
||||
# Editor support
|
||||
# vscode:
|
||||
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
|
||||
|
@ -63,3 +63,29 @@ index 734167e51bc5..f95761b5df58 100644
|
||||
install(TARGETS lldbIntelFeatures
|
||||
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
|
||||
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
|
||||
index 752113b..010f187 100644
|
||||
--- a/cmake/modules/LLDBStandalone.cmake
|
||||
+++ b/cmake/modules/LLDBStandalone.cmake
|
||||
@@ -62,7 +62,7 @@ endif()
|
||||
|
||||
# They are used as destination of target generators.
|
||||
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
|
||||
-set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
|
||||
+set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
|
||||
if(WIN32 OR CYGWIN)
|
||||
# DLL platform -- put DLLs into bin.
|
||||
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b5633e2..86e4738 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -79,7 +79,7 @@ if (LLDB_ENABLE_PYTHON)
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
set(lldb_python_target_dir "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
|
||||
else()
|
||||
- set(lldb_python_target_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
|
||||
+ set(lldb_python_target_dir "${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH}/lldb")
|
||||
endif()
|
||||
get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
|
||||
finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
|
||||
|
Loading…
Reference in New Issue
Block a user