Skip to content

Commit 66715b6

Browse files
committed
[android][build.ps1] use the newly built lld when linking swift runtime for android
the linker in the NDK might be too old, and not support all relocations, so we should use the lld we have just built in the toolchain
1 parent aa7ff59 commit 66715b6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

utils/build.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,13 @@ function Build-CMakeProject {
984984
# Add additional linker flags for generating the debug info.
985985
Append-FlagsDefine $Defines CMAKE_SHARED_LINKER_FLAGS "/debug"
986986
Append-FlagsDefine $Defines CMAKE_EXE_LINKER_FLAGS "/debug"
987+
} elseif ($Platform -eq "Android") {
988+
# Use a built lld linker as the Android's NDK linker might be too
989+
# old and not support all required relocations needed by the Swift
990+
# runtime.
991+
$ldPath = ([IO.Path]::Combine($CompilersBinaryCache, "bin", "ld.lld"))
992+
Append-FlagsDefine $Defines CMAKE_SHARED_LINKER_FLAGS "--ld-path=$ldPath"
993+
Append-FlagsDefine $Defines CMAKE_EXE_LINKER_FLAGS "--ld-path=$ldPath"
987994
}
988995
}
989996

0 commit comments

Comments
 (0)