From f7576a7bef5ca33c5598ad6b63a37f6d4c69aa98 Mon Sep 17 00:00:00 2001 From: Butta Date: Fri, 2 Oct 2020 14:03:49 +0530 Subject: [PATCH] [android] Add support for building the toolchain for ARMv7 --- cmake/modules/AddSwift.cmake | 10 ++++++++++ lib/ClangImporter/ImportType.cpp | 2 +- stdlib/public/runtime/Float16Support.cpp | 2 +- utils/build-script-impl | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake index ec61d2abb836a..0b9ce10842ac2 100644 --- a/cmake/modules/AddSwift.cmake +++ b/cmake/modules/AddSwift.cmake @@ -291,6 +291,16 @@ function(_add_host_variant_c_compile_flags target) target_compile_options(${target} PRIVATE -march=core2) endif() endif() + + # The LLVM backend is built with these defines on most 32-bit platforms, + # llvm/llvm-project@66395c9, which can cause incompatibilities with the Swift + # frontend if not built the same way. + if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv6|armv7|i686" AND + NOT (SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID AND SWIFT_ANDROID_API_LEVEL LESS 24)) + target_compile_definitions(${target} PRIVATE + _LARGEFILE_SOURCE + _FILE_OFFSET_BITS=64) + endif() endfunction() function(_add_host_variant_link_flags target) diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index f58dbb837e5dd..70bd70dff9ac6 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -556,7 +556,7 @@ namespace { if (size > 4096) return Type(); - SmallVector elts{size, elementType}; + SmallVector elts{static_cast(size), elementType}; return TupleType::get(elts, elementType->getASTContext()); } diff --git a/stdlib/public/runtime/Float16Support.cpp b/stdlib/public/runtime/Float16Support.cpp index d7377400ba0be..9d8c4940054df 100644 --- a/stdlib/public/runtime/Float16Support.cpp +++ b/stdlib/public/runtime/Float16Support.cpp @@ -29,7 +29,7 @@ // Android NDK