From 67dee07edd6aa1f21a81ad261950d41beef20080 Mon Sep 17 00:00:00 2001 From: Ole Begemann Date: Mon, 23 May 2022 17:36:05 +0200 Subject: [PATCH] Fix release build Make some Swift functions public so that the linker can see them when linking CEcho. If they're not public, release builds would fail with undefined symbols errors: Undefined symbols for architecture arm64: "_lookupSection", referenced from: __loadImageFunc in CEcho.o "_registerProtocolConformances", referenced from: __loadImageFunc in CEcho.o "_registerProtocols", referenced from: __loadImageFunc in CEcho.o "_registerTypeMetadata", referenced from: __loadImageFunc in CEcho.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) --- Sources/Echo/Runtime/ImageInspection.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Echo/Runtime/ImageInspection.swift b/Sources/Echo/Runtime/ImageInspection.swift index 3b7178e..e749fcf 100644 --- a/Sources/Echo/Runtime/ImageInspection.swift +++ b/Sources/Echo/Runtime/ImageInspection.swift @@ -56,7 +56,7 @@ let protocolLock = NSLock() var _protocols = Set() @_cdecl("registerProtocols") -func registerProtocols(section: UnsafeRawPointer, size: Int) { +public func registerProtocols(section: UnsafeRawPointer, size: Int) { for i in 0 ..< size / 4 { let start = section.offset(of: i, as: Int32.self) let ptr = start.relativeDirectAddress(as: _ProtocolDescriptor.self) @@ -75,7 +75,7 @@ let conformanceLock = NSLock() var conformances = [UnsafeRawPointer: [ConformanceDescriptor]]() @_cdecl("registerProtocolConformances") -func registerProtocolConformances(section: UnsafeRawPointer, size: Int) { +public func registerProtocolConformances(section: UnsafeRawPointer, size: Int) { for i in 0 ..< size / 4 { let start = section.offset(of: i, as: Int32.self) let ptr = start.relativeDirectAddress(as: _ConformanceDescriptor.self) @@ -137,7 +137,7 @@ let typeLock = NSLock() var _types = Set() @_cdecl("registerTypeMetadata") -func registerTypeMetadata(section: UnsafeRawPointer, size: Int) { +public func registerTypeMetadata(section: UnsafeRawPointer, size: Int) { for i in 0 ..< size / 4 { let start = section.offset(of: i, as: Int32.self) let ptr = start.relativeDirectAddress(as: _ContextDescriptor.self) @@ -161,7 +161,7 @@ typealias mach_header_platform = mach_header #endif @_cdecl("lookupSection") -func lookupSection( +public func lookupSection( _ header: UnsafePointer?, segment: UnsafePointer?, section: UnsafePointer?,