[swift-corelibs-dev] Running TestFoundation in Instruments

Ian Partridge ian at poncho.org.uk
Thu Aug 3 10:14:27 CDT 2017

Has anyone successfully run the TestFoundation scheme under Instruments?

When I "build for profiling" in Xcode 9 beta 4 I see a linker failure:

Undefined symbols for architecture x86_64:
  "___CFInitializeSwift", referenced from:
      ___CFInitialize in libCoreFoundation.a(CFRuntime.o)
  "___CFSwiftGetBaseClass", referenced from:
      ___CFInitialize in libCoreFoundation.a(CFRuntime.o)
ld: symbol(s) not found for architecture x86_64

These functions are marked @_cdecl which is an attribute added to
enable exporting of top-level Swift functions to C.

CF uses this during initialization of the runtime to call out to
NSSwiftRuntime.swift (mostly for setting up the _CFSwiftBridge
function table).

I guess this exporting of the Swift function isn't working in
optimised builds, for some reason.

Any ideas?

Ian Partridge

More information about the swift-corelibs-dev mailing list