mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
1e82ef8df7
If the replaced symbol goes away in the original library, the replacement key in the replacement descriptor will be null. Handle this by ignoring the replacement entry rather than crashing. rdar://103307821
26 lines
1.2 KiB
Swift
26 lines
1.2 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift-dylib(%t/%target-library-name(LibA)) -DBEFORE -module-name LibA -emit-module -emit-module-path %t/LibA.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_libA.swift
|
|
// RUN: %target-build-swift-dylib(%t/%target-library-name(ReplacementA)) -I%t -L%t -lLibA -module-name ReplacementA -swift-version 5 %S/Inputs/dynamic_replacement_ReplacementA.swift
|
|
// RUN: %target-build-swift-dylib(%t/%target-library-name(LibA)) -module-name LibA -emit-module -emit-module-path %t/LibA.swiftmodule -swift-version 5 %S/Inputs/dynamic_replacement_libA.swift
|
|
// RUN: %target-build-swift -I%t -L%t -lLibA -o %t/main %target-rpath(%t) %s -swift-version 5
|
|
// RUN: %target-codesign %t/main %t/%target-library-name(LibA) %t/%target-library-name(ReplacementA)
|
|
// RUN: %target-run %t/main %t/%target-library-name(LibA) %t/%target-library-name(ReplacementA)
|
|
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: OS=macosx
|
|
// REQUIRES: swift_test_mode_optimize_none
|
|
|
|
import Darwin
|
|
|
|
import LibA
|
|
|
|
private func target_library_name(_ name: String) -> String {
|
|
return "lib\(name).dylib"
|
|
}
|
|
|
|
var executablePath = CommandLine.arguments[0]
|
|
executablePath.removeLast(4)
|
|
_ = dlopen(executablePath + target_library_name("ReplacementA"), RTLD_NOW)
|
|
|
|
A().print()
|