Skip to content

Commit a3c36da

Browse files
committed
[Bootstrap] Also set DYLD_INSERT_LIBRARIES.
This fixes a problem where `dyld` loads the new `libswiftCore.dylib`, but doesn't realise it's a replacement for the system `libswiftCore.dylib`, so doesn't fix up all the places where there are calls into the latter, the upshot being some very bizarre behaviour. rdar://160273124
1 parent 6a2b600 commit a3c36da

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Utilities/bootstrap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,13 @@ def get_swiftpm_env_cmd(args):
900900

901901
if libs:
902902
if platform.system() == 'Darwin':
903+
# This DYLD_INSERT_LIBRARIES command is necessary to prevent problems
904+
# with dyld failing to realise that the newly built libswiftCore is
905+
# the replacement for the system version.
906+
#
907+
# (This is caused by the install name in the newly built version
908+
# using an `@rpath`.)
909+
env_cmd.append("DYLD_INSERT_LIBRARIES=/usr/lib/swift/libswiftCore.dylib")
903910
env_cmd.append("DYLD_LIBRARY_PATH=%s" % ":".join(libs))
904911
else:
905912
libs_joined = ":".join(libs + args.target_info["paths"]["runtimeLibraryPaths"])

0 commit comments

Comments
 (0)