@@ -463,9 +463,8 @@ function(_add_variant_link_flags)
463
463
list (APPEND result "-Wl,-Bsymbolic" )
464
464
elseif ("${LFLAGS_SDK} " STREQUAL "ANDROID" )
465
465
list (APPEND link_libraries "dl" "log" "atomic" "icudataswift" "icui18nswift" "icuucswift" )
466
- # We provide our own C++ below, so we ask the linker not to do it. However,
467
- # we need to add the math library, which is linked implicitly by libc++.
468
- list (APPEND result "-nostdlib++" "-lm" )
466
+ # We need to add the math library, which is linked implicitly by libc++
467
+ list (APPEND result "-lm" )
469
468
if ("${LFLAGS_ARCH} " MATCHES armv7 )
470
469
set (android_libcxx_path "${SWIFT_ANDROID_NDK_PATH} /sources/cxx-stl/llvm-libc++/libs/armeabi-v7a" )
471
470
elseif ("${LFLAGS_ARCH} " MATCHES aarch64 )
@@ -1371,8 +1370,16 @@ function(_add_swift_library_single target name)
1371
1370
${SWIFTLIB_SINGLE_PRIVATE_LINK_LIBRARIES} )
1372
1371
endif ()
1373
1372
1374
- set_property (TARGET "${target} " PROPERTY
1373
+ # NOTE(compnerd) use the C linker language to invoke `clang` rather than
1374
+ # `clang++` as we explicitly link against the C++ runtime. We were previously
1375
+ # actually passing `-nostdlib++` to avoid the C++ runtime linkage.
1376
+ if (SWIFTLIB_SINGLE_SDK STREQUAL ANDROID )
1377
+ set_property (TARGET "${target} " PROPERTY
1378
+ LINKER_LANGUAGE "C" )
1379
+ else ()
1380
+ set_property (TARGET "${target} " PROPERTY
1375
1381
LINKER_LANGUAGE "CXX" )
1382
+ endif ()
1376
1383
1377
1384
if (target_static )
1378
1385
set_property (TARGET "${target_static} " APPEND_STRING PROPERTY
0 commit comments