commit f7576a7bef5ca33c5598ad6b63a37f6d4c69aa98 Date: Fri, 2 Oct 2020 14:03:49 +0530 Subject: [android] Add support for building the toolchain for ARMv7 diff --git a/swift/cmake/modules/AddSwift.cmake b/swift/cmake/modules/AddSwift.cmake index ec61d2abb836..0b9ce10842ac 100644 --- a/swift/cmake/modules/AddSwift.cmake +++ b/swift/cmake/modules/AddSwift.cmake @@ -291,6 +291,15 @@ function(_add_host_variant_c_compile_flags target) 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("${CFLAGS_ARCH}" MATCHES "armv6|armv7|i686" AND + NOT (CFLAGS_SDK STREQUAL ANDROID AND SWIFT_ANDROID_API_LEVEL LESS 24)) + list(APPEND result + "-D_LARGEFILE_SOURCE" + "-D_FILE_OFFSET_BITS=64") + endif() set("${CFLAGS_RESULT_VAR_NAME}" "${result}" PARENT_SCOPE) endfunction() diff --git a/swift/lib/ClangImporter/ImportType.cpp b/swift/lib/ClangImporter/ImportType.cpp index f58dbb837e5d..70bd70dff9ac 100644 --- a/swift/lib/ClangImporter/ImportType.cpp +++ b/swift/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/swift/stdlib/public/runtime/Float16Support.cpp b/swift/stdlib/public/runtime/Float16Support.cpp index d7377400ba0b..9d8c4940054d 100644 --- a/swift/stdlib/public/runtime/Float16Support.cpp +++ b/swift/stdlib/public/runtime/Float16Support.cpp @@ -29,7 +29,7 @@ // Android NDK