Skip to content

Upstream Driver changes for Swift-in-Apple-OSs #24787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/swift/Basic/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ namespace swift {
/// Return true if the given triple represents any simulator.
bool tripleIsAnySimulator(const llvm::Triple &triple);

/// Returns true if the given triple represents an OS that ships with
/// ABI-stable swift libraries (eg. in /usr/lib/swift).
bool tripleRequiresRPathForSwiftInOS(const llvm::Triple &triple);

/// Returns the platform name for a given target triple.
///
/// For example, the iOS simulator has the name "iphonesimulator", while real
Expand Down
6 changes: 6 additions & 0 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,12 @@ def static_stdlib: Flag<["-"], "static-stdlib">,
def no_static_stdlib: Flag<["-"], "no-static-stdlib">,
Flags<[HelpHidden,DoesNotAffectIncrementalBuild]>,
HelpText<"Don't statically link the Swift standard library">;
def toolchain_stdlib_rpath: Flag<["-"], "toolchain-stdlib-rpath">,
Flags<[HelpHidden,DoesNotAffectIncrementalBuild]>,
HelpText<"Add an rpath entry for the toolchain's standard library, rather than the OS's">;
def no_stdlib_rpath: Flag<["-"], "no-stdlib-rpath">,
Flags<[HelpHidden,DoesNotAffectIncrementalBuild]>,
HelpText<"Don't add any rpath entries.">;

def static_executable : Flag<["-"], "static-executable">,
HelpText<"Statically link the executable">;
Expand Down
18 changes: 18 additions & 0 deletions lib/Basic/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ bool swift::tripleIsAnySimulator(const llvm::Triple &triple) {
tripleIsAppleTVSimulator(triple);
}


bool swift::tripleRequiresRPathForSwiftInOS(const llvm::Triple &triple) {
if (triple.isMacOSX()) {
// macOS 10.14.4 contains a copy of Swift, but the linker will still use an
// rpath-based install name until 10.15.
return triple.isMacOSXVersionLT(10, 15);

} else if (triple.isiOS()) {
return triple.isOSVersionLT(12, 2);

} else if (triple.isWatchOS()) {
return triple.isOSVersionLT(5, 2);
}

// Other platforms don't have Swift installed as part of the OS by default.
return false;
}

DarwinPlatformKind swift::getDarwinPlatformKind(const llvm::Triple &triple) {
if (triple.isiOS()) {
if (triple.isTvOS()) {
Expand Down
Loading