@@ -339,37 +339,43 @@ toolchains::Darwin::addArgsToLinkStdlib(ArgStringList &Arguments,
339
339
Arguments.push_back (context.Args .MakeArgString (RuntimeLibPath));
340
340
341
341
if (context.Args .hasArg (options::OPT_toolchain_stdlib_rpath)) {
342
- // If the user has explicitly asked for a toolchain stdlib, we should provide one using
343
- // -rpath. This used to be the default behaviour but it was considered annoying in at least
344
- // the swiftpm scenario (see https://bugs.swift.org/browse/SR-1967) and is obsolete in all
345
- // scenarios of deploying for swift-in-the-OS. We keep it here as an optional behaviour so
346
- // that people downloading snapshot toolchains for testing new stdlibs will be able to link to
347
- // the stdlib bundled in that toolchain.
342
+ // If the user has explicitly asked for a toolchain stdlib, we should
343
+ // provide one using -rpath. This used to be the default behaviour but it
344
+ // was considered annoying in at least the swiftpm scenario (see
345
+ // https://bugs.swift.org/browse/SR-1967) and is obsolete in all
346
+ // scenarios of deploying for swift-in-the-OS. We keep it here as an
347
+ // optional behaviour so that people downloading snapshot toolchains for
348
+ // testing new stdlibs will be able to link to the stdlib bundled in that
349
+ // toolchain.
348
350
Arguments.push_back (" -rpath" );
349
351
Arguments.push_back (context.Args .MakeArgString (RuntimeLibPath));
350
352
351
353
} else if (tripleHasSwiftInTheOS (getTriple ()) ||
352
354
context.Args .hasArg (options::OPT_no_stdlib_rpath)) {
353
- // If targeting an OS with Swift in /usr/lib/swift, the LC_ID_DYLIB install_name the stdlib
354
- // will be an absolute path like /usr/lib/swift/libswiftCore.dylib, and we do not need to
355
- // provide an rpath at all.
355
+ // If targeting an OS with Swift in /usr/lib/swift, the LC_ID_DYLIB
356
+ // install_name the stdlib will be an absolute path like
357
+ // /usr/lib/swift/libswiftCore.dylib, and we do not need to provide an
358
+ // rpath at all.
356
359
//
357
- // Also, if the user explicitly asks for no rpath entry, we assume they know what they're
358
- // doing and do not add one here.
360
+ // Also, if the user explicitly asks for no rpath entry, we assume they
361
+ // know what they're doing and do not add one here.
359
362
} else {
360
- // The remaining cases are back-deploying (to OSs predating swift-in-the-OS). In these cases,
361
- // the stdlib will be giving us (via stdlib/linker-support/magic-symbols-for-install-name.c)
362
- // an LC_ID_DYLIB install_name that is rpath-relative, like @rpath/libswiftCore.dylib.
363
+ // The remaining cases are back-deploying (to OSs predating
364
+ // swift-in-the-OS). In these cases, the stdlib will be giving us (via
365
+ // stdlib/linker-support/magic-symbols-for-install-name.c) an LC_ID_DYLIB
366
+ // install_name that is rpath-relative, like @rpath/libswiftCore.dylib.
363
367
//
364
- // If we're linking an app bundle, it's possible there's an embedded stdlib in there, in which
365
- // case we'd want to put @executable_path/../Frameworks in the rpath to find and prefer it,
366
- // but (a) we don't know when we're linking an app bundle and (b) we probably _never_ will be
367
- // because xcode links using clang, not the swift driver.
368
+ // If we're linking an app bundle, it's possible there's an embedded
369
+ // stdlib in there, in which case we'd want to put
370
+ // @executable_path/../Frameworks in the rpath to find and prefer it, but
371
+ // (a) we don't know when we're linking an app bundle and (b) we probably
372
+ // _never_ will be because xcode links using clang, not the swift driver.
368
373
//
369
- // So that leaves us with the case of linking a command-line app. These are only supported by
370
- // installing a secondary package that puts some frozen swift-in-OS libraries in the
371
- // /usr/lib/swift location. That's the best we can give for rpath, though it might fail at
372
- // runtime if the support package isn't installed.
374
+ // So that leaves us with the case of linking a command-line app. These
375
+ // are only supported by installing a secondary package that puts some
376
+ // frozen swift-in-OS libraries in the usr/lib/swift location. That's the
377
+ // best we can give for rpath, though it might fail at runtime if the
378
+ // support package isn't installed.
373
379
Arguments.push_back (context.Args .MakeArgString (" /usr/lib/swift" ));
374
380
}
375
381
}
0 commit comments