Skip to content

Commit 97dfba0

Browse files
committed
android: do not add rpaths when linking
the dynamic linker doesn't understand them and spams warnings.
1 parent c102d20 commit 97dfba0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ function(_add_swift_library_single target name)
911911
set_target_properties("${target}"
912912
PROPERTIES
913913
INSTALL_NAME_DIR "${install_name_dir}")
914-
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
914+
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT "${SWIFTLIB_SINGLE_SDK}" STREQUAL "ANDROID")
915915
set_target_properties("${target}"
916916
PROPERTIES
917917
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/linux")

lib/Driver/ToolChains.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,15 +1033,17 @@ toolchains::Linux::constructInvocation(const LinkJobAction &job,
10331033

10341034
Arguments.push_back("-lgcc");
10351035
Arguments.push_back("-lc");
1036+
} else {
1037+
// rpaths are not supported on Android.
1038+
1039+
// FIXME: We probably shouldn't be adding an rpath here unless we know ahead
1040+
// of time the standard library won't be copied.
1041+
Arguments.push_back("-Xlinker");
1042+
Arguments.push_back("-rpath");
1043+
Arguments.push_back("-Xlinker");
1044+
Arguments.push_back(context.Args.MakeArgString(RuntimeLibPath));
10361045
}
10371046

1038-
// FIXME: We probably shouldn't be adding an rpath here unless we know ahead
1039-
// of time the standard library won't be copied.
1040-
Arguments.push_back("-Xlinker");
1041-
Arguments.push_back("-rpath");
1042-
Arguments.push_back("-Xlinker");
1043-
Arguments.push_back(context.Args.MakeArgString(RuntimeLibPath));
1044-
10451047
// Always add the stdlib
10461048
Arguments.push_back("-lswiftCore");
10471049

0 commit comments

Comments
 (0)