Skip to content

Commit 7fa1b4b

Browse files
committed
[android] Update to NDK 23
The latest Long Term Support NDK finally removed binutils, including the bfd/gold linkers and libgcc. This simplifies our Android support, including making lld the default linker for Android. Disable three reflection tests that now fail, likely related to issues with swift-reflection-dump and switching to lld. Also, add the libatomic dependency for Android armv7, just as on linux.
1 parent 0ecd4ff commit 7fa1b4b

File tree

20 files changed

+60
-116
lines changed

20 files changed

+60
-116
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ set(CLANG_COMPILER_VERSION "" CACHE STRING
180180
# build environment.
181181
if(LLVM_USE_LINKER)
182182
set(SWIFT_USE_LINKER_default "${LLVM_USE_LINKER}")
183+
elseif(${SWIFT_HOST_VARIANT_SDK} STREQUAL ANDROID)
184+
set(SWIFT_USE_LINKER_default "lld")
183185
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
184186
set(SWIFT_USE_LINKER_default "lld")
185187
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
@@ -306,8 +308,8 @@ set(SWIFT_ANDROID_API_LEVEL "" CACHE STRING
306308

307309
set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING
308310
"Path to the directory that contains the Android NDK tools that are executable on the build machine")
309-
set(SWIFT_ANDROID_NDK_GCC_VERSION "" CACHE STRING
310-
"The GCC version to use when building for Android. Currently only 4.9 is supported.")
311+
set(SWIFT_ANDROID_NDK_CLANG_VERSION "12.0.5" CACHE STRING
312+
"The Clang version to use when building for Android.")
311313
set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
312314
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
313315

cmake/modules/AddSwift.cmake

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,9 @@ function(_add_host_variant_c_compile_link_flags name)
145145
endif()
146146

147147
if(SWIFT_HOST_VARIANT_SDK STREQUAL ANDROID)
148-
# lld can handle targeting the android build. However, if lld is not
149-
# enabled, then fallback to the linker included in the android NDK.
150-
if(NOT SWIFT_USE_LINKER STREQUAL "lld")
151-
swift_android_tools_path(${SWIFT_HOST_VARIANT_ARCH} tools_path)
152-
target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-B${tools_path}>)
153-
endif()
148+
# Make sure the Android NDK lld is used.
149+
swift_android_tools_path(${SWIFT_HOST_VARIANT_ARCH} tools_path)
150+
target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:-B${tools_path}>)
154151
endif()
155152

156153
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
@@ -384,11 +381,6 @@ function(_add_host_variant_link_flags target)
384381
cxx_link_libraries)
385382
target_link_libraries(${target} PRIVATE
386383
${cxx_link_libraries})
387-
388-
swift_android_libgcc_for_arch_cross_compile(${SWIFT_HOST_VARIANT_ARCH}
389-
${SWIFT_HOST_VARIANT_ARCH}_LIB)
390-
target_link_directories(${target} PRIVATE
391-
${${SWIFT_HOST_VARIANT_ARCH}_LIB})
392384
else()
393385
# If lto is enabled, we need to add the object path flag so that the LTO code
394386
# generator leaves the intermediate object file in a place where it will not

cmake/modules/AddSwiftUnittests.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ function(add_swift_unittest test_dirname)
3232
COMMAND "${SWIFT_SOURCE_DIR}/utils/swift-rpathize.py"
3333
"$<TARGET_FILE:${test_dirname}>")
3434
elseif("${SWIFT_HOST_VARIANT}" STREQUAL "android")
35-
swift_android_libgcc_for_arch_cross_compile(${SWIFT_HOST_VARIANT_ARCH} android_system_libs)
36-
set_property(TARGET "${test_dirname}" APPEND PROPERTY LINK_DIRECTORIES
37-
"${android_system_libs}")
3835
set_property(TARGET "${test_dirname}" APPEND PROPERTY LINK_LIBRARIES "log")
3936
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
4037
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")

cmake/modules/SwiftAndroidSupport.cmake

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,7 @@
1-
function(swift_android_prebuilt_host_name prebuilt_var_name)
2-
# Get the prebuilt suffix to create the correct toolchain path when using the NDK
3-
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
4-
set(${prebuilt_var_name} darwin-x86_64 PARENT_SCOPE)
5-
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
6-
set(${prebuilt_var_name} linux-x86_64 PARENT_SCOPE)
7-
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
8-
set(${prebuilt_var_name} Windows-x86_64 PARENT_SCOPE)
9-
else()
10-
message(SEND_ERROR "cannot cross-compile to android from ${CMAKE_HOST_SYSTEM_NAME}")
11-
endif()
12-
endfunction()
13-
14-
function(swift_android_libgcc_for_arch_cross_compile arch var)
15-
set(paths)
16-
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
17-
list(APPEND paths "${SWIFT_SDK_ANDROID_ARCH_${arch}_PATH}/../lib/gcc/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}/${SWIFT_ANDROID_NDK_GCC_VERSION}.x")
18-
endif()
19-
set(${var} ${paths} PARENT_SCOPE)
20-
endfunction()
21-
221
function(swift_android_sysroot sysroot_var_name)
232
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
24-
swift_android_prebuilt_host_name(prebuilt_build)
25-
set(${sysroot_var_name} "${SWIFT_ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/${prebuilt_build}/sysroot" PARENT_SCOPE)
3+
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} platform)
4+
set(${sysroot_var_name} "${SWIFT_ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/${platform}-x86_64/sysroot" PARENT_SCOPE)
265
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
276
set(${sysroot_var_name} "${SWIFT_ANDROID_NATIVE_SYSROOT}" PARENT_SCOPE)
287
else()
@@ -32,19 +11,8 @@ endfunction()
3211

3312
function(swift_android_tools_path arch path_var_name)
3413
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
35-
swift_android_prebuilt_host_name(prebuilt_build)
36-
if("${arch}" STREQUAL "i686")
37-
set(ndk_prebuilt_path
38-
"${SWIFT_ANDROID_NDK_PATH}/toolchains/x86-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${prebuilt_build}")
39-
elseif("${arch}" STREQUAL "x86_64")
40-
set(ndk_prebuilt_path
41-
"${SWIFT_ANDROID_NDK_PATH}/toolchains/x86_64-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${prebuilt_build}")
42-
else()
43-
set(ndk_prebuilt_path
44-
"${SWIFT_ANDROID_NDK_PATH}/toolchains/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${prebuilt_build}")
45-
endif()
46-
47-
set(${path_var_name} "${ndk_prebuilt_path}/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}/bin" PARENT_SCOPE)
14+
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} platform)
15+
set(${path_var_name} "${SWIFT_ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/${platform}-x86_64/bin" PARENT_SCOPE)
4816
elseif(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
4917
set(${path_var_name} "${SWIFT_ANDROID_NATIVE_SYSROOT}/usr/bin" PARENT_SCOPE)
5018
else()

docs/Android.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ To follow along with this guide, you'll need:
3333
Ubuntu 18.04 or Ubuntu 16.04. Before attempting to build for Android,
3434
please make sure you are able to build for Linux by following the
3535
instructions in the Swift project README.
36-
2. The latest version of the Android NDK (r21e at the time of this writing,
37-
only r19 or later are supported), available to download here:
36+
2. The latest version of the Android NDK (r23 at the time of this writing),
37+
available to download here:
3838
https://developer.android.com/ndk/downloads/index.html.
3939
3. An Android device with remote debugging enabled or the emulator. We require
4040
remote debugging in order to deploy built stdlib products to the device. You
@@ -73,7 +73,7 @@ Android NDK, as well as the directories that contain the `libicuucswift.so` and
7373

7474
```
7575
$ ARM_DIR=path/to/libiconv-libicu-android/armeabi-v7a
76-
$ NDK_PATH=path/to/android-ndk-r21e
76+
$ NDK_PATH=path/to/android-ndk-r23
7777
$ utils/build-script \
7878
-R \ # Build in ReleaseAssert mode.
7979
--android \ # Build for Android.
@@ -99,7 +99,7 @@ Then use the built Swift compiler from the previous step to compile a Swift
9999
source file, targeting Android:
100100

101101
```
102-
$ NDK_PATH="path/to/android-ndk-r21e"
102+
$ NDK_PATH="path/to/android-ndk-r23"
103103
$ build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc \ # The Swift compiler built in the previous step
104104
# The location of the tools used to build Android binaries
105105
-tools-directory ${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/ \
@@ -153,7 +153,7 @@ adb push /path/to/libicu-android/armeabi-v7a/libicuucswift.so /data/local/tmp
153153
In addition, you'll also need to copy the Android NDK's libc++:
154154

155155
```
156-
$ adb push /path/to/android-ndk-r21e/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so /data/local/tmp
156+
$ adb push /path/to/android-ndk-r23/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so /data/local/tmp
157157
```
158158

159159
Finally, you'll need to copy the `hello` executable you built in the
@@ -196,7 +196,7 @@ $ utils/build-script \
196196
-R \ # Build in ReleaseAssert mode.
197197
-T \ # Run all tests, including on the Android device (add --host-test to only run Android tests on the linux host).
198198
--android \ # Build for Android.
199-
--android-ndk ~/android-ndk-r21e \ # Path to an Android NDK.
199+
--android-ndk ~/android-ndk-r23 \ # Path to an Android NDK.
200200
--android-arch armv7 \ # Optionally specify Android architecture, alternately aarch64
201201
--android-ndk-version 21 \
202202
--android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \

lib/Driver/UnixToolChains.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ ToolChain::InvocationInfo toolchains::GenericUnix::constructInvocation(
8585
}
8686

8787
std::string toolchains::GenericUnix::getDefaultLinker() const {
88+
if (getTriple().isAndroid())
89+
return "lld";
90+
8891
switch (getTriple().getArch()) {
8992
case llvm::Triple::arm:
9093
case llvm::Triple::aarch64:

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,9 @@ function(_add_target_variant_c_compile_link_flags)
9494
endif()
9595

9696
if("${CFLAGS_SDK}" STREQUAL "ANDROID")
97-
# lld can handle targeting the android build. However, if lld is not
98-
# enabled, then fallback to the linker included in the android NDK.
99-
if(NOT SWIFT_USE_LINKER STREQUAL "lld")
100-
swift_android_tools_path(${CFLAGS_ARCH} tools_path)
101-
list(APPEND result "-B" "${tools_path}")
102-
endif()
97+
# Make sure the Android NDK lld is used.
98+
swift_android_tools_path(${CFLAGS_ARCH} tools_path)
99+
list(APPEND result "-B" "${tools_path}")
103100
endif()
104101

105102
if("${CFLAGS_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
@@ -389,8 +386,8 @@ function(_add_target_variant_link_flags)
389386
MACCATALYST_BUILD_FLAVOR "${LFLAGS_MACCATALYST_BUILD_FLAVOR}")
390387
if("${LFLAGS_SDK}" STREQUAL "LINUX")
391388
list(APPEND link_libraries "pthread" "dl")
392-
if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv6|armv7|i686")
393-
list(APPEND link_libraries PRIVATE "atomic")
389+
if("${LFLAGS_ARCH}" MATCHES "armv6|armv7|i686")
390+
list(APPEND link_libraries "atomic")
394391
endif()
395392
elseif("${LFLAGS_SDK}" STREQUAL "FREEBSD")
396393
list(APPEND link_libraries "pthread")
@@ -417,8 +414,14 @@ function(_add_target_variant_link_flags)
417414
list(APPEND result "-Wl,-Bsymbolic")
418415
elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")
419416
list(APPEND link_libraries "dl" "log")
417+
if("${LFLAGS_ARCH}" STREQUAL "armv7")
418+
list(APPEND link_libraries "atomic")
419+
endif()
420420
# We need to add the math library, which is linked implicitly by libc++
421421
list(APPEND result "-lm")
422+
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
423+
list(APPEND result "-resource-dir=${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/${SWIFT_ANDROID_NDK_CLANG_VERSION}")
424+
endif()
422425

423426
# link against the custom C++ library
424427
swift_android_cxx_libraries_for_arch(${LFLAGS_ARCH} cxx_link_libraries)
@@ -428,11 +431,6 @@ function(_add_target_variant_link_flags)
428431
list(APPEND link_libraries
429432
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_I18N}
430433
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_UC})
431-
432-
swift_android_libgcc_for_arch_cross_compile(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
433-
foreach(path IN LISTS ${LFLAGS_ARCH}_LIB)
434-
list(APPEND library_search_directories ${path})
435-
endforeach()
436434
else()
437435
# If lto is enabled, we need to add the object path flag so that the LTO code
438436
# generator leaves the intermediate object file in a place where it will not
@@ -460,10 +458,17 @@ function(_add_target_variant_link_flags)
460458
endif()
461459

462460
if(SWIFT_USE_LINKER AND NOT SWIFT_COMPILER_IS_MSVC_LIKE)
461+
# The linker is normally chosen based on the host, but the Android NDK only
462+
# uses lld now.
463+
if("${LFLAGS_SDK}" STREQUAL "ANDROID")
464+
set(linker "lld")
465+
else()
466+
set(linker "${SWIFT_USE_LINKER}")
467+
endif()
463468
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
464-
list(APPEND result "-fuse-ld=${SWIFT_USE_LINKER}.exe")
469+
list(APPEND result "-fuse-ld=${linker}.exe")
465470
else()
466-
list(APPEND result "-fuse-ld=${SWIFT_USE_LINKER}")
471+
list(APPEND result "-fuse-ld=${linker}")
467472
endif()
468473
endif()
469474

stdlib/public/runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ foreach(sdk ${SWIFT_SDKS})
228228
endif()
229229
set(libpthread -lpthread)
230230
set(android_libraries)
231-
if(sdk STREQUAL ANDROID)
231+
if(${sdk} STREQUAL ANDROID)
232232
set(android_libraries -llog)
233233
set(libpthread)
234234
endif()

test/AutoDiff/validation-test/reflection.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: no_asan
2+
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi
23
// RUN: %empty-directory(%t)
34
import _Differentiation
45

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// REQUIRES: OS=linux-androideabi || OS=linux-android
2+
// RUN: %empty-directory(%t)
3+
// RUN: %target-build-swift -Xfrontend -function-sections -emit-module -emit-library -static -parse-stdlib %S/Inputs/FunctionSections.swift
4+
// RUN: %target-build-swift -Xlinker --gc-sections -Xlinker -Map=%t/../../FunctionSections.map -I%t/../.. -L%t/../.. -lFunctionSections %S/Inputs/FunctionSectionsUse.swift
5+
// RUN: %FileCheck %s < %t/../../FunctionSections.map
6+
7+
// CHECK-NOT: .text.$s16FunctionSections5func2yyF
8+
// CHECK: .text.$s16FunctionSections5func1yyF

test/LinkerSections/function_sections.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: OS=linux-gnu || OS=linux-androideabi || OS=linux-android || OS=freebsd
1+
// REQUIRES: OS=linux-gnu || OS=freebsd
22
// RUN: %empty-directory(%t)
33
// RUN: %target-build-swift -Xfrontend -function-sections -emit-module -emit-library -static -parse-stdlib %S/Inputs/FunctionSections.swift
44
// RUN: %target-build-swift -Xlinker --gc-sections -Xlinker -Map=%t/../../FunctionSections.map -I%t/../.. -L%t/../.. -lFunctionSections %S/Inputs/FunctionSectionsUse.swift

test/Reflection/capture_descriptors.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
// SR-12893
55
// XFAIL: openbsd
6+
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi
67

78
// RUN: %empty-directory(%t)
89
// RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -o %t/capture_descriptors%{target-shared-library-suffix} -L%t/../../.. -lBlocksRuntime

test/Reflection/typeref_decoding_imported.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// RUN: %target-swift-reflection-dump -binary-filename %t/%target-library-name(TypesToReflect) | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-cpu
1717

1818
// UNSUPPORTED: CPU=arm64e
19+
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi
1920

2021
// CHECK-32: FIELDS:
2122
// CHECK-32: =======

test/lit.cfg

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,7 @@ differentiable_programming = lit_config.params.get('differentiable_programming',
440440
if differentiable_programming is not None:
441441
config.available_features.add('differentiable_programming')
442442

443-
# On Android, LLVM LTO is only supported when the driver uses lld.
444-
# And skip lto tests when driver uses gold linker.
445-
if not (run_os in ['linux-android', 'linux-androideabi']) or (config.android_linker_name == 'lld'):
446-
config.available_features.add('lld_lto')
443+
config.available_features.add('lld_lto')
447444

448445
test_options = os.environ.get('SWIFT_TEST_OPTIONS')
449446
if test_options:
@@ -1489,18 +1486,14 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
14891486
config.android_ndk_path, "toolchains", "llvm", "prebuilt",
14901487
prebuilt_directory)
14911488
tools_directory = shell_quote(make_path(
1492-
toolchain_directory, ndk_platform_triple, "bin"))
1489+
toolchain_directory, "bin"))
14931490
lit_config.note("Testing Android " + config.variant_triple)
14941491
config.target_object_format = "elf"
14951492
config.target_shared_library_prefix = 'lib'
14961493
config.target_shared_library_suffix = ".so"
14971494
config.target_runtime = "native"
14981495
config.target_swift_autolink_extract = inferSwiftBinary("swift-autolink-extract")
14991496
config.target_sdk_name = "android"
1500-
android_link_paths_opt = "-L {}".format(
1501-
shell_quote(make_path(
1502-
toolchain_directory, "lib", "gcc", ndk_platform_triple,
1503-
"{}.x".format(config.android_ndk_gcc_version))))
15041497
config.resource_dir_opt = ("-resource-dir %s" % test_resource_dir)
15051498
# Since NDK r19, the headers and libraries are available in a unified
15061499
# sysroot at $NDK_PATH/toolchains/llvm/prebuilt/$prebuilt_directory/sysroot,
@@ -1511,7 +1504,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
15111504
'-sdk', config.variant_sdk, '-Xclang-linker',
15121505
'--target={}{}'.format(config.variant_triple, config.android_api_level),
15131506
'-tools-directory', tools_directory,
1514-
android_link_paths_opt, '-use-ld=%s' % config.android_linker_name,
1507+
'-use-ld=%s' % config.android_linker_name,
15151508
config.resource_dir_opt, mcp_opt, config.swift_test_options,
15161509
config.swift_driver_test_options, swift_execution_tests_extra_flags])
15171510
config.target_codesign = "echo"
@@ -1523,7 +1516,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
15231516
config.target_swift_frontend = ' '.join([
15241517
config.swift_frontend,
15251518
'-target', config.variant_triple,
1526-
'-sdk', config.variant_sdk, android_link_paths_opt, config.resource_dir_opt,
1519+
'-sdk', config.variant_sdk, config.resource_dir_opt,
15271520
mcp_opt, config.swift_test_options, config.swift_frontend_test_options])
15281521
subst_target_swift_frontend_mock_sdk = config.target_swift_frontend
15291522
subst_target_swift_frontend_mock_sdk_after = ""
@@ -1558,7 +1551,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
15581551
'-sdk', config.variant_sdk, '-Xclang-linker',
15591552
'--target={}{}'.format(config.variant_triple, config.android_api_level),
15601553
'-tools-directory', tools_directory,
1561-
android_link_paths_opt, config.resource_dir_opt, mcp_opt,
1554+
config.resource_dir_opt, mcp_opt,
15621555
'-use-ld=%s' % config.android_linker_name,
15631556
config.swift_driver_test_options])
15641557
config.target_swift_modulewrap = ' '.join([

test/lit.site.cfg.in

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ config.swift_frontend_test_options = "@SWIFT_FRONTEND_TEST_OPTIONS@"
4242
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
4343

4444
# --- android ---
45+
config.android_linker_name = "lld"
4546
config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
46-
config.android_ndk_gcc_version = "@SWIFT_ANDROID_NDK_GCC_VERSION@"
4747
config.android_api_level = "@SWIFT_ANDROID_API_LEVEL@"
4848

4949
# --- Windows ---
@@ -127,12 +127,6 @@ if "@SWIFT_ENABLE_SOURCEKIT_TESTS@" == "TRUE":
127127
if "@SWIFT_HAVE_LIBXML2@" == "TRUE":
128128
config.available_features.add('libxml2')
129129

130-
if "@SWIFT_USE_LINKER@" == "lld":
131-
config.android_linker_name = "lld"
132-
else:
133-
# even if SWIFT_USE_LINKER isn't set, we cannot use BFD for Android
134-
config.android_linker_name = "gold"
135-
136130
if '@SWIFT_INCLUDE_TOOLS@' == 'TRUE':
137131
config.available_features.add('swift_tools_extra')
138132

utils/build-script-impl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ KNOWN_SETTINGS=(
9595
android-icu-uc "" "Path to libicuuc.so"
9696
android-icu-uc-include "" "Path to a directory containing headers for libicuuc"
9797
android-ndk "" "An absolute path to the NDK that will be used as a libc implementation for Android builds"
98-
android-ndk-gcc-version "" "The GCC version to use when building for Android. Currently only 4.9 is supported"
9998

10099
## Darwin Options
101100
darwin-crash-reporter-client "" "whether to enable CrashReporter integration"
@@ -1892,7 +1891,6 @@ for host in "${ALL_HOSTS[@]}"; do
18921891
cmake_options=(
18931892
"${cmake_options[@]}"
18941893
-DSWIFT_ANDROID_NDK_PATH:STRING="${ANDROID_NDK}"
1895-
-DSWIFT_ANDROID_NDK_GCC_VERSION:STRING="${ANDROID_NDK_GCC_VERSION}"
18961894
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_UC:STRING="${ANDROID_ICU_UC}"
18971895
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_UC_INCLUDE:STRING="${ANDROID_ICU_UC_INCLUDE}"
18981896
-DSWIFT_ANDROID_${ANDROID_ARCH}_ICU_I18N:STRING="${ANDROID_ICU_I18N}"

0 commit comments

Comments
 (0)