Skip to content

Commit 148e9d8

Browse files
committed
Enable checking for -no-toolchain-stdlib-rpath and use it on this repo's binaries before installing
1 parent 4059f25 commit 148e9d8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ extension GenericUnixToolchain {
128128
let staticExecutable = parsedOptions.hasFlag(positive: .staticExecutable,
129129
negative: .noStaticExecutable,
130130
default: false)
131+
let toolchainStdlibRpath = parsedOptions
132+
.hasFlag(positive: .toolchainStdlibRpath,
133+
negative: .noToolchainStdlibRpath,
134+
default: true)
131135
let hasRuntimeArgs = !(staticStdlib || staticExecutable)
132136

133137
let runtimePaths = try runtimeLibraryPaths(
@@ -137,7 +141,8 @@ extension GenericUnixToolchain {
137141
isShared: hasRuntimeArgs
138142
)
139143

140-
if hasRuntimeArgs && targetTriple.environment != .android {
144+
if hasRuntimeArgs && targetTriple.environment != .android &&
145+
toolchainStdlibRpath {
141146
// FIXME: We probably shouldn't be adding an rpath here unless we know
142147
// ahead of time the standard library won't be copied.
143148
for path in runtimePaths {

Utilities/build-script-helper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def get_swiftpm_options(args):
109109
'-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/linux',
110110
]
111111

112+
if args.action == 'install':
113+
swiftpm_args += ['-Xswiftc', '-no-toolchain-stdlib-rpath']
114+
112115
return swiftpm_args
113116

114117
def install_binary(file, source_dir, install_dir, verbose):

0 commit comments

Comments
 (0)