@@ -1010,6 +1010,31 @@ toolchains::Linux::constructInvocation(const LinkJobAction &job,
10101010 Arguments.push_back (context.Args .MakeArgString (LibProfile));
10111011 }
10121012
1013+ if (getTriple ().isAndroid ()) {
1014+ // FIXME: Android: hard-coded paths to arm; needs to fix for arm64, x86
1015+ Arguments.push_back (" -target" );
1016+ Arguments.push_back (" armv7-none-linux-androideabi" );
1017+ // Arguments.push_back(context.Args.MakeArgString(getTriple().str()));
1018+
1019+ const char * ndkhome = getenv (" ANDROID_NDK_HOME" );
1020+ assert (ndkhome && " ANDROID_NDK_HOME needs to be set to NDK "
1021+ " install directory for linking" );
1022+
1023+ auto libgccpath = Twine (ndkhome) + " /toolchains/"
1024+ " arm-linux-androideabi-4.8/prebuilt/linux-x86_64/"
1025+ " lib/gcc/arm-linux-androideabi/4.8" ;
1026+ Arguments.push_back (" -L" );
1027+ Arguments.push_back (context.Args .MakeArgString (libgccpath));
1028+
1029+ auto libcxxpath = Twine (ndkhome) + " /sources/"
1030+ " cxx-stl/llvm-libc++/libs/armeabi-v7a" ;
1031+ Arguments.push_back (" -L" );
1032+ Arguments.push_back (context.Args .MakeArgString (libcxxpath));
1033+
1034+ Arguments.push_back (" -lgcc" );
1035+ Arguments.push_back (" -lc" );
1036+ }
1037+
10131038 // FIXME: We probably shouldn't be adding an rpath here unless we know ahead
10141039 // of time the standard library won't be copied.
10151040 Arguments.push_back (" -Xlinker" );
@@ -1032,7 +1057,8 @@ toolchains::Linux::constructInvocation(const LinkJobAction &job,
10321057 Arguments.push_back (" -Xlinker" );
10331058 Arguments.push_back (" -T" );
10341059 Arguments.push_back (
1035- context.Args .MakeArgString (Twine (RuntimeLibPath) + " /x86_64/swift.ld" ));
1060+ context.Args .MakeArgString (Twine (RuntimeLibPath) + " /" +
1061+ getTriple ().getArchName () + " /swift.ld" ));
10361062
10371063 // This should be the last option, for convenience in checking output.
10381064 Arguments.push_back (" -o" );
0 commit comments