swift: get the on-device build working
%ci:no-build
This commit is contained in:
parent
01b076d958
commit
008011eee5
33
packages/swift/compiler-rt.patch
Normal file
33
packages/swift/compiler-rt.patch
Normal file
@ -0,0 +1,33 @@
|
||||
diff --git a/llvm-project/clang/runtime/CMakeLists.txt b/llvm-project/clang/runtime/CMakeLists.txt
|
||||
index 61b1c60bf590..5b0d10a67699 100644
|
||||
--- a/llvm-project/clang/runtime/CMakeLists.txt
|
||||
+++ b/llvm-project/clang/runtime/CMakeLists.txt
|
||||
@@ -75,6 +75,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
|
||||
CMAKE_ARGS ${CLANG_COMPILER_RT_CMAKE_ARGS}
|
||||
-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
|
||||
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
|
||||
+ -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
|
||||
-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||
@@ -84,6 +85,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
|
||||
-DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
|
||||
-DCOMPILER_RT_INSTALL_PATH:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
|
||||
-DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
|
||||
+ -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
|
||||
-DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX}
|
||||
-DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
|
||||
diff --git a/llvm-project/compiler-rt/cmake/Modules/HandleCompilerRT.cmake b/llvm-project/compiler-rt/cmake/Modules/HandleCompilerRT.cmake
|
||||
index ac9e0871489d..b495cbfb5c2e 100644
|
||||
--- a/llvm-project/compiler-rt/cmake/Modules/HandleCompilerRT.cmake
|
||||
+++ b/llvm-project/compiler-rt/cmake/Modules/HandleCompilerRT.cmake
|
||||
@@ -31,7 +31,7 @@ function(find_compiler_rt_library name target variable)
|
||||
# If the cache variable is not defined, invoke clang and then
|
||||
# set it with cache_compiler_rt_library.
|
||||
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${SANITIZER_COMMON_FLAGS}
|
||||
- "--rtlib=compiler-rt" "-print-libgcc-file-name")
|
||||
+ "--rtlib=compiler-rt" "-print-libgcc-file-name" "-resource-dir=$ENV{PREFIX}/lib/clang/$ENV{TERMUX_CLANG_VERSION}/")
|
||||
if(target)
|
||||
list(APPEND CLANG_COMMAND "--target=${target}")
|
||||
endif()
|
@ -0,0 +1,44 @@
|
||||
commit a478b0a199f4928041390d1f35dd5e226936b42c
|
||||
Author: Ryan Prichard <rprichard@google.com>
|
||||
Date: Tue Mar 9 14:20:45 2021 -0800
|
||||
|
||||
[Android] Default to --rtlib=compiler-rt
|
||||
|
||||
By default, the driver uses the compiler-rt builtins and links with
|
||||
-l:libunwind.a.
|
||||
|
||||
Restore the previous behavior by passing --rtlib=libgcc.
|
||||
|
||||
Reviewed By: danalbert
|
||||
|
||||
Differential Revision: https://reviews.llvm.org/D96404
|
||||
|
||||
diff --git a/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp b/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
index 93a56be6a7a4..ad98013dd4f0 100644
|
||||
--- a/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ b/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
@@ -363,6 +363,12 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
}
|
||||
}
|
||||
|
||||
+ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
|
||||
+ if (getTriple().isAndroid())
|
||||
+ return ToolChain::RLT_CompilerRT;
|
||||
+ return Generic_ELF::GetDefaultRuntimeLibType();
|
||||
+}
|
||||
+
|
||||
ToolChain::CXXStdlibType Linux::GetDefaultCXXStdlibType() const {
|
||||
if (getTriple().isAndroid())
|
||||
return ToolChain::CST_Libcxx;
|
||||
diff --git a/llvm-project/clang/lib/Driver/ToolChains/Linux.h b/llvm-project/clang/lib/Driver/ToolChains/Linux.h
|
||||
index a45236bc10d3..05e01a208456 100644
|
||||
--- a/llvm-project/clang/lib/Driver/ToolChains/Linux.h
|
||||
+++ b/llvm-project/clang/lib/Driver/ToolChains/Linux.h
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
+ RuntimeLibType GetDefaultRuntimeLibType() const override;
|
||||
CXXStdlibType GetDefaultCXXStdlibType() const override;
|
||||
bool isPIEDefault() const override;
|
||||
bool isNoExecStackDefault() const override;
|
@ -0,0 +1,36 @@
|
||||
commit 729e25d92d05a8c4a8136e831ec6123bbf7f2654
|
||||
Author: Evan Wilde <ewilde@apple.com>
|
||||
Date: Thu Aug 19 11:57:34 2021 -0700
|
||||
|
||||
Removing unused refcount variable
|
||||
|
||||
The rebranch branch is failing to build due to an unused refcount
|
||||
variable in runtime.c. The variable is only used by an os_assert and
|
||||
nowhere else. I've removed it and instead put the check directly in the
|
||||
assert.
|
||||
|
||||
diff --git a/swift-corelibs-libdispatch/src/BlocksRuntime/runtime.c b/swift-corelibs-libdispatch/src/BlocksRuntime/runtime.c
|
||||
index bfec1a0..4b7d4bf 100644
|
||||
--- a/swift-corelibs-libdispatch/src/BlocksRuntime/runtime.c
|
||||
+++ b/swift-corelibs-libdispatch/src/BlocksRuntime/runtime.c
|
||||
@@ -468,18 +468,16 @@ static void _Block_byref_assign_copy(void *dest, const void *arg, const int flag
|
||||
// Old compiler SPI
|
||||
static void _Block_byref_release(const void *arg) {
|
||||
struct Block_byref *byref = (struct Block_byref *)arg;
|
||||
- int32_t refcount;
|
||||
|
||||
// dereference the forwarding pointer since the compiler isn't doing this anymore (ever?)
|
||||
byref = byref->forwarding;
|
||||
-
|
||||
+
|
||||
// To support C++ destructors under GC we arrange for there to be a finalizer for this
|
||||
// by using an isa that directs the code to a finalizer that calls the byref_destroy method.
|
||||
if ((byref->flags & BLOCK_BYREF_NEEDS_FREE) == 0) {
|
||||
return; // stack or GC or global
|
||||
}
|
||||
- refcount = byref->flags & BLOCK_REFCOUNT_MASK;
|
||||
- os_assert(refcount);
|
||||
+ os_assert(byref->flags & BLOCK_REFCOUNT_MASK);
|
||||
if (latching_decr_int_should_deallocate(&byref->flags)) {
|
||||
if (byref->flags & BLOCK_BYREF_HAS_COPY_DISPOSE) {
|
||||
struct Block_byref_2 *byref2 = (struct Block_byref_2 *)(byref+1);
|
@ -183,8 +183,8 @@ index 57288b33049..73ab70240e3 100644
|
||||
list(APPEND link_libraries "dl" "log")
|
||||
# We need to add the math library, which is linked implicitly by libc++
|
||||
list(APPEND result "-lm")
|
||||
+ list(APPEND result "-rtlib=compiler-rt")
|
||||
+ if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
|
||||
+ list(APPEND result "-rtlib=compiler-rt")
|
||||
+ list(APPEND result "-resource-dir=${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/${SWIFT_ANDROID_NDK_CLANG_VERSION}")
|
||||
+ endif()
|
||||
|
||||
@ -344,6 +344,14 @@ index 3971ac0c5e1..93efa3811eb 100755
|
||||
|
||||
## Darwin Options
|
||||
darwin-crash-reporter-client "" "whether to enable CrashReporter integration"
|
||||
@@ -516,6 +515,7 @@ function set_build_options_for_host() {
|
||||
# variable.
|
||||
if [[ "${PREFIX}" ]] ; then
|
||||
llvm_cmake_options+=(
|
||||
+ -DCLANG_DEFAULT_LINKER:STRING="lld"
|
||||
-DDEFAULT_SYSROOT:STRING="$(dirname ${PREFIX})"
|
||||
)
|
||||
fi
|
||||
@@ -1892,7 +1891,6 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
cmake_options=(
|
||||
"${cmake_options[@]}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user