Skip to content

Commit 8dfdbd1

Browse files
committed
Added '-Blinker' frontend driver option, allowing the linker search path
to be specified. This means swift can now cross-compile executables for linux.
1 parent f9d2276 commit 8dfdbd1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ def use_ld : Joined<["-"], "use-ld=">,
268268
Flags<[DoesNotAffectIncrementalBuild]>,
269269
HelpText<"Specifies the linker to be used">;
270270

271+
def ld_path : Separate<["-"], "Blinker">,
272+
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
273+
HelpText<"Specifies where to look for the linker">;
274+
271275
def Xlinker : Separate<["-"], "Xlinker">,
272276
Flags<[DoesNotAffectIncrementalBuild]>,
273277
HelpText<"Specifies an option which should be passed to the linker">;

lib/Driver/ToolChains.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,12 @@ toolchains::GenericUnix::constructInvocation(const LinkJobAction &job,
12811281
if (!Linker.empty()) {
12821282
Arguments.push_back(context.Args.MakeArgString("-fuse-ld=" + Linker));
12831283
}
1284+
1285+
// Add the linker search path
1286+
if (const Arg *A = context.Args.getLastArg(options::OPT_ld_path)) {
1287+
Arguments.push_back("-B");
1288+
Arguments.push_back(context.Args.MakeArgString(A->getValue()));
1289+
}
12841290

12851291
std::string Target = getTargetForLinker();
12861292
if (!Target.empty()) {

0 commit comments

Comments
 (0)